-
Notifications
You must be signed in to change notification settings - Fork 188
[ENH] BEP044 - Stim-BIDS #2022
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
base: master
Are you sure you want to change the base?
[ENH] BEP044 - Stim-BIDS #2022
Conversation
Implement the standardization of stimulus files and their annotations within the BIDS specifications. * **Add new file `src/modality-specific-files/stimuli.md`** - Describe the specifications for the stimuli directory. - Include guidelines for storing stimulus files and their annotations. - Define what goes into `stimuli.tsv/json`, `annotations.tsv/json`, and `stim-<label>.json`. - Use the same style as other modality-specific docs to design the tables, variables, and examples. * **Modify `src/modality-specific-files/task-events.md`** - Add a section detailing the standardization of stimulus files and their annotations within the BIDS specifications. - Include examples of how to use the `stim_file` and `stim_id` columns in `events.tsv` files. - Provide guidelines for storing stimulus files in the `/stimuli` directory. - Expand the definition of the `stim_file` column to include `stim_id`. * **Modify `src/schema/objects/columns.yaml`** - Update the definition of the `stim_file` column to ensure consistency in stimulus file references. - Add the `stim_id` column definition for `events.tsv` files. * **Modify `src/schema/rules/checks/events.yaml`** - Add a check for missing stimulus files declared in `events.tsv`. - Add a check for missing `stim_id` references in `events.tsv`. * **Modify `src/schema/rules/sidecars/events.yaml`** - Specify the `StimulusPresentation` metadata field for `events.tsv` files. - Include the `stim_id` column in the metadata field specifications. * **Modify `src/schema/objects/entities.yaml`** - Add entities described in the document with proper requirement levels and descriptions. * **Modify `src/schema/objects/suffixes.yaml`** - Add suffixes for `{audio, image, video, audiovideo}`. - Include the file extensions and descriptions for each suffix. * **Add new file `src/schema/rules/sidecars/stimulus.yaml`** - Define sidecar tables for `stimuli.tsv/json`, `annotations.tsv/json`, and `stim-<label>.json`. - Use the same style as other modality-specific docs to design the tables. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/neuromechanist/bids-specification?shareId=XXXX-XXXX-XXXX-XXXX).
Add stimuli specifications to BIDS
for more information, see https://pre-commit.ci
will do a bit of clean up to get less red in CI and maybe see if we can get the HTML version of the BEP to render |
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.
initial quick pass with little recommendations etc
95db096
to
95c76f3
Compare
Quote the complex expression in StimulusIdExists check to prevent YAML from misinterpreting the parentheses and comma as a nested dictionary structure. This was causing test failures across all Python versions in CI.
Handle both suffix-based and stem-based file groups in the filename template rendering code. Previously, the code assumed all groups had suffixes, but stem-based groups like stimuli.tsv and participants.tsv use stem instead.
- Add part__stimuli entity definition for flexible stimulus part labels - Update test to handle stem-based files in stimuli datatype - Update test fixture to use local schema when available - Remove complex entity overrides in favor of context-specific entities
- Add comprehensive pattern matching for stimuli files in template tests - Handle root-level files (stimuli.tsv, annotations.tsv) and entity files - Stimuli files don't follow standard subject/session patterns
- Update metaschema to support stem-based rules in raw files - Add path support to both stemRule and suffixRule for stimuli - Fix stimuli check expression to use valid syntax instead of lambda - Replace for_any/lambda with standard exists/count expression pattern
- Allow stemRule in raw files alongside suffixRule for stimuli support - Add path and entities support to stemRule for completeness - Add path support to suffixRule for custom directory handling - Fix filename rendering to handle stem files without underscore prefix - Maintains backward compatibility with all existing file patterns
Remove invisible Unicode Zero Width Joiner (U+200D) character that was causing UnicodeDecodeError on Windows systems using cp1252 encoding. Maintains all functionality while ensuring Windows compatibility.
- Replace hardcoded examples with filename template macros in stimuli.md - Streamline and clarify stimulus organization section in events.md - Add distinction between stim files and stimuli directory in behavioral experiments
for more information, see https://pre-commit.ci
- Implement make_root_filename_template for directories like /stimuli - Register new macro in main.py following existing patterns - Update stimuli.md to use new root template macro - Addresses placement, prefix, and annotation files issues
- Remove incorrect datatype designation from stimuli rules - Create schema-driven root filename template macro for path-based rules - Update stimuli.md to use proper root template macro - Fix understanding: stimuli is root-level directory, not subject datatype
- Create make_root_filename_template macro for root-level directories like /stimuli - Update bidsschematools to skip path-based rules (without datatypes) in entity table and filename templates - Remove stimuli from entity-table.md as it doesn't follow subject-scoped entity ordering - Dynamically look up entity definitions from schema instead of hardcoding mappings
The test was failing because it tried to access datatypes attribute on all rules, including the new stimuli rules that use path-based organization instead.
… stimuli tables - Add explicit schema path loading to make_sidecar_table to avoid caching issues - Temporarily comment out stimuli.Stimuli tables that need namespace fixes - File tree generation from schema is now working for /stimuli directory
- Fix entity format labels in root template macro (use <label> instead of hardcoded) - Add explicit schema loading to make_columns_table to avoid caching issues - Re-enable all stimuli tables (sidecar and columns) that now work correctly - File tree now properly shows stim-<label>[_part-<label>] format
…macro Add generic root-level template macro for non-datatype directories
- Show .<extension> when more than 2 extensions exist for same suffix - Keep stem files (stimuli.tsv, annotations.tsv) explicit for clarity - Keep events files explicit (only 2 extensions) - Consolidate audio/image/video/audiovideo files (5-6 extensions each)
The <extension> placeholder was being interpreted as an HTML tag and hidden. Now using <extension> for HTML output while keeping <extension> for PDF.
Update prior to making PR out of Draft:
|
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.
lgtm
"raw", | ||
path="stimuli") | ||
}} | ||
|
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.
This PR addresses #153 by introducing specifications for handling and standardizing stimulus files and their annotations within the BIDS specifications. The changes focus on improving the organization, referencing, and metadata of stimulus files to enhance consistency, reusability, and efficiency.
Important
HTML render of the stimuli page : https://bids-specification--2022.org.readthedocs.build/en/2022/modality-agnostic-files/stimuli.html
Note
The issue: #153
Google Doc
Example PR: bids-standard/bids-examples#433
Known issues:
/src/schema/rules/files/raw
requiredatatype
. Stimuli might be a special data type that can only be present at the root of the dataset. So, the datatype field is missing for now.cc: @bids-standard/bep044 and @monique2208