-
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
Conversation
fix: adjust tests
| "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`"], |
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.
A follow-up PR will add a common registry for notifications to avoid the need for this ctrl+r duplication (as discussed in #103)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
==========================================
- Coverage 87.02% 86.51% -0.51%
==========================================
Files 32 32
Lines 1025 1031 +6
==========================================
Hits 892 892
- Misses 133 139 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
candleindark
left a comment
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.
Pointed out a small possible issue to look into.
| rich_click.echo(message=console_notification) | ||
|
|
||
| not_any_failures = not notifications or not any( | ||
| notification.severity == Severity.ERROR for notification in notifications |
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.CRITICAL
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.
Those more directly relate to the case where nwb2bids produces an 'invalid' BIDS directory
I 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.
Those more directly relate to the case where nwb2bids produces an 'invalid' BIDS directory
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
| @enum.unique | |
| class Severity(enum.Enum): | |
| """ | |
| Quantifier of relative severity (how important it is to resolve) for inspection results. | |
| The larger the value, the more critical it is. | |
| If an issue can be categorized in multiple ways, the most severe category should be chosen. | |
| """ | |
| INFO = enum.auto() # Not an indication of problem but information of status or confirmation | |
| HINT = enum.auto() # Data is valid but could be improved | |
| WARNING = enum.auto() # Data is not recognized as valid. Changes are needed to ensure validity | |
| ERROR = enum.auto() # Data is recognized as invalid | |
| CRITICAL = enum.auto() # A serious invalidity in data |
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.CRITICAL condition. I.e. instead of
any(
notification.severity == Severity.ERROR for notification in notifications
)we should have
any(
notification.severity == Severity.ERROR or notification.severity == Severity.CRITICAL for notification in notifications
)
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
| rich_click.echo(message=console_notification) | ||
|
|
||
| not_any_failures = not notifications or not any( | ||
| notification.severity == Severity.ERROR for notification in notifications |
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.
Those more directly relate to the case where nwb2bids produces an 'invalid' BIDS directory
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
| @enum.unique | |
| class Severity(enum.Enum): | |
| """ | |
| Quantifier of relative severity (how important it is to resolve) for inspection results. | |
| The larger the value, the more critical it is. | |
| If an issue can be categorized in multiple ways, the most severe category should be chosen. | |
| """ | |
| INFO = enum.auto() # Not an indication of problem but information of status or confirmation | |
| HINT = enum.auto() # Data is valid but could be improved | |
| WARNING = enum.auto() # Data is not recognized as valid. Changes are needed to ensure validity | |
| ERROR = enum.auto() # Data is recognized as invalid | |
| CRITICAL = enum.auto() # A serious invalidity in data |
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.CRITICAL condition. I.e. instead of
any(
notification.severity == Severity.ERROR for notification in notifications
)we should have
any(
notification.severity == Severity.ERROR or notification.severity == Severity.CRITICAL for notification in notifications
)
After all, if the resulting BIDS dataset is invalid, I don't think we should print the message "BIDS dataset was successfully created!"
Co-authored-by: Isaac To <[email protected]>
for more information, see https://pre-commit.ci
|
@candleindark primary comment offloaded to #193 for further improvement and standalone testing This PR is all about the core logic of the actual BIDS labelling |
Noticed while putting together #173