Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy_remote_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: ./.github/workflows/testing.yml
with:
pytest_markexpr: 'remote'
os_list: '["macos-13","macos-latest","ubuntu-latest"]'
os_list: '["windows-2022","windows-latest","macos-15-intel","macos-latest","ubuntu-latest"]'
python_list: '["3.13"]'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7 changes: 7 additions & 0 deletions src/nwb2bids/_command_line_interface/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from .._converters._run_config import RunConfig
from .._core._convert_nwb_dataset import convert_nwb_dataset
from .._inspection._inspection_result import Severity
from .._tools._pluralize import _pluralize


Expand Down Expand Up @@ -121,3 +122,9 @@ def _run_convert_nwb_dataset(

if console_notification != "" and not silent:
rich_click.echo(message=console_notification)

not_any_failures = not any(notification.severity == Severity.ERROR for notification in notifications)
if not_any_failures and not silent:
text = "BIDS dataset was successfully created!"
console_notification = rich_click.style(text=text, fg="green")
rich_click.echo(message=console_notification)
13 changes: 7 additions & 6 deletions src/nwb2bids/bids_models/_bids_session_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ def _check_fields(self, file_paths: list[pathlib.Path] | list[pydantic.HttpUrl])
title="Invalid session ID",
reason=(
"The session ID contains invalid characters. "
"BIDS allows only dashes to be used as separators in session entity label. "
"Underscores, spaces, slashes, and special characters (including #) are expressly forbidden."
"BIDS allows only the plus sign to be used as a separator in the subject entity label. "
"Underscores, dashes, spaces, slashes, and other special characters (including #) are "
"expressly forbidden."
),
solution="Rename the session without using spaces or underscores.",
solution="Rename the session without using any special characters except for `+`.",
examples=[
"`ses_01` -> `ses-01`",
"`session #2` -> `session-2`",
"`id 2 from 9/1/25` -> `id-2-9-1-25`",
"`ses_01` -> `ses+01`",
"`session #2` -> `session+2`",
"`id 2 from 9/1/25` -> `id+2+9+1+25`",
],
field="nwbfile.session_id",
source_file_paths=file_paths,
Expand Down
2 changes: 1 addition & 1 deletion src/nwb2bids/bids_models/_model_globals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_VALID_ID_REGEX = r"^[A-Za-z0-9]+"
_VALID_ID_REGEX = r"^[A-Za-z0-9+]+"
_VALID_SPECIES_REGEX = r"([A-Z][a-z]* [a-z]+)|(http://purl.obolibrary.org/obo/NCBITaxon_\d+)"
_VALID_BIDS_SEXES = {
value: True
Expand Down
13 changes: 7 additions & 6 deletions src/nwb2bids/bids_models/_participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ def _check_fields(self, file_paths: list[pathlib.Path] | list[pydantic.HttpUrl])
title="Invalid participant ID",
reason=(
"The participant ID contains invalid characters. "
"BIDS allows only dashes to be used as separators in subject entity label. "
"Underscores, spaces, slashes, and special characters (including #) are expressly forbidden."
"BIDS allows only the plus sign to be used as a separator in the subject entity label. "
"Underscores, dashes, spaces, slashes, and other special characters (including #) are "
"expressly forbidden."
),
solution="Rename the subject without using spaces or underscores.",
solution="Rename the subject without using any special characters except for `+`.",
examples=[
"`ab_01` -> `ab-01`",
"`subject #2` -> `subject-2`",
"`id 2 from 9/1/25` -> `id-2-9-1-25`",
"`ab_01` -> `ab+01`",
"`subject #2` -> `subject+2`",
"`id 2 from 9/1/25` -> `id+2+9+1+25`",
],
field="nwbfile.subject.subject_id",
source_file_paths=file_paths,
Expand Down
33 changes: 17 additions & 16 deletions tests/integration/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def test_messages_1(problematic_nwbfile_path_1: pathlib.Path, temporary_bids_dir
nwb2bids.InspectionResult(
title="Invalid participant ID",
reason=(
"The participant ID contains invalid characters. BIDS allows only dashes to be used as separators in "
"subject entity label. Underscores, spaces, slashes, and special characters (including #) are "
"expressly forbidden."
"The participant ID contains invalid characters. BIDS allows only the plus sign to be used as a "
"separator in the subject entity label. Underscores, dashes, spaces, slashes, and other special "
"characters (including #) are expressly forbidden."
),
solution="Rename the subject without using spaces or underscores.",
examples=["`ab_01` -> `ab-01`", "`subject #2` -> `subject-2`", "`id 2 from 9/1/25` -> `id-2-9-1-25`"],
solution="Rename the subject without using any special characters except for `+`.",
examples=["`ab_01` -> `ab+01`", "`subject #2` -> `subject+2`", "`id 2 from 9/1/25` -> `id+2+9+1+25`"],
Comment on lines +41 to +46
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A follow-up PR will add a common registry for notifications to avoid the need for this ctrl+r duplication (as discussed in #103)

field="nwbfile.subject.subject_id",
source_file_paths=nwb_paths,
data_standards=[nwb2bids.DataStandard.BIDS, nwb2bids.DataStandard.DANDI],
Expand Down Expand Up @@ -118,12 +118,12 @@ def test_messages_2(problematic_nwbfile_path_2: pathlib.Path, temporary_bids_dir
nwb2bids.InspectionResult(
title="Invalid participant ID",
reason=(
"The participant ID contains invalid characters. BIDS allows only dashes to be used as separators in "
"subject entity label. Underscores, spaces, slashes, and special characters (including #) are "
"expressly forbidden."
"The participant ID contains invalid characters. BIDS allows only the plus sign to be used as a "
"separator in the subject entity label. Underscores, dashes, spaces, slashes, and other special "
"characters (including #) are expressly forbidden."
),
solution="Rename the subject without using spaces or underscores.",
examples=["`ab_01` -> `ab-01`", "`subject #2` -> `subject-2`", "`id 2 from 9/1/25` -> `id-2-9-1-25`"],
solution="Rename the subject without using any special characters except for `+`.",
examples=["`ab_01` -> `ab+01`", "`subject #2` -> `subject+2`", "`id 2 from 9/1/25` -> `id+2+9+1+25`"],
field="nwbfile.subject.subject_id",
source_file_paths=nwb_paths,
target_file_paths=None,
Expand All @@ -135,14 +135,15 @@ def test_messages_2(problematic_nwbfile_path_2: pathlib.Path, temporary_bids_dir
title="Invalid session ID",
reason=(
"The session ID contains invalid characters. "
"BIDS allows only dashes to be used as separators in session entity label. "
"Underscores, spaces, slashes, and special characters (including #) are expressly forbidden."
"BIDS allows only the plus sign to be used as a separator in the subject entity label. "
"Underscores, dashes, spaces, slashes, and other special characters "
"(including #) are expressly forbidden."
),
solution="Rename the session without using spaces or underscores.",
solution="Rename the session without using any special characters except for `+`.",
examples=[
"`ses_01` -> `ses-01`",
"`session #2` -> `session-2`",
"`id 2 from 9/1/25` -> `id-2-9-1-25`",
"`ses_01` -> `ses+01`",
"`session #2` -> `session+2`",
"`id 2 from 9/1/25` -> `id+2+9+1+25`",
],
field="nwbfile.session_id",
source_file_paths=nwb_paths,
Expand Down
Loading