-
Notifications
You must be signed in to change notification settings - Fork 4
Corrected the labeling notification to proper BIDS #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8449e03
fix: correct the labeling notification to proper BIDS
CodyCBakerPhD c3a43fc
Merge branch 'main' into fix_label_notification
CodyCBakerPhD 3cf62bc
Merge branch 'main' into fix_label_notification
CodyCBakerPhD a1f87c6
fix bad merge conflict
CodyCBakerPhD 88b0e28
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 84ede46
Merge branch 'main' into fix_label_notification
CodyCBakerPhD 6d32c12
Fix bad merge
CodyCBakerPhD 9443073
fix: bad merge
59c8be6
Merge branch 'main' into fix_label_notification
CodyCBakerPhD 6ca7f54
Merge branch 'main' into fix_label_notification
CodyCBakerPhD e9c7d17
Merge branch 'main' into fix_label_notification
CodyCBakerPhD a812243
Apply suggestion from @candleindark
CodyCBakerPhD 506a59a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e3e7bd2
Update OS list for remote tests in workflow
CodyCBakerPhD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| field="nwbfile.subject.subject_id", | ||
| source_file_paths=nwb_paths, | ||
| data_standards=[nwb2bids.DataStandard.BIDS, nwb2bids.DataStandard.DANDI], | ||
|
|
@@ -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, | ||
|
|
@@ -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, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do with the case
notification.severity == Severity.CRITICALThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those more directly relate to the case where
nwb2bidsproduces an 'invalid' BIDS directoryI think in a follow-up we can maybe warn that this might be the case, though until various BEPs get merged on BIDS side, this warning will nearly always occur so maybe I'd not add that until things stabilize a bit upstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the case, I think we are treading a very fine line here. We are binding the validity of the resulting BIDS directory on the severity of a notification while the severity is more intuitively interpreted as the "severity" of the notification being raised. Also, this special binding is not documented in
nwb2bids/src/nwb2bids/_inspection/_inspection_result.py
Lines 27 to 41 in 0f03ccf
I am not proposing to provide the documentation since I believe the severity level should only be used to signify how severe the notification being raised is. I am proposing to include the
notification.severity == Severity.CRITICALcondition. I.e. instead ofwe should have
After all, if the resulting BIDS dataset is invalid, I don't think we should print the message "BIDS dataset was successfully created!"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - it is a separate enhancement to the main topic of this PR however (and would benefit from even more targeted improvements + testing on separate PR) opened #193