-
Notifications
You must be signed in to change notification settings - Fork 51
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
[EEG-BIDS] Add support for events.json file & HED Tags #769
Conversation
@cmadjar I made the database_lib additions - I haven't had a chance to re-test the import however. I'll try to get to this by end of week |
Bug:
Also to note: |
This PR now supports assembly of events' HED tags using the HEDtools web service. |
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.
@jesscall thank you for working on this!!
I tested the following:
- no
events.json
anywhere => 👍 task-faceO_events.json
at the root directory of the BIDS dataset => for some reason, the content ofphysiological_event_parameter_category
does not populateDescription
andHED
fields
12 2 boundary NULL NULL
13 2 checker-left NULL NULL
14 2 checker-right NULL NULL
15 2 e-254 NULL NULL
16 2 e-255 NULL NULL
17 2 face-inverted NULL NULL
18 2 face-upright NULL NULL
19 2 house-inverted NULL NULL
20 2 house-upright NULL NULL
21 2 press-left NULL NULL
22 2 press-right NULL NULL
I would have expected to see Description
="boundary event" and HED
="Experiment-procedure" for LevelName
="boundary"
sub-OTT501_task-faceO_events.json
in the subject directory => tablesphysiological_event_parameter
andphysiological_event_parameter_category
do not get populated for some reason (physiological_event_file
,physiological_event_archive
andphysiological_task_event
get populated though)
File used for testing: the file you sent me on Slack last Friday.
|
||
return event_paths | ||
|
||
def grep_event_file_id_from_event_path(self, event_file_path): |
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.
Is event_file_path
supposed to be the TSV file?
Also, what would happen if an event file is common to all physiological files? Maybe the wrong eventFileID could be returned?
Example:
EventFileID PhysiologicalFileID FileType FilePath
1 1 tsv <BIDS_ROOT_DIR>/task-faceO_events.tsv
2 1 json <BIDS_ROOT_DIR>/task-faceO_events.json
3 2 tsv <BIDS_ROOT_DIR>/task-faceO_events.tsv
4 2 json <BIDS_ROOT_DIR>/task-faceO_events.json
looking at the return of the function, it looks like it would return EventFileID
= 1 (for TSV) or 2 (for JSON) which are linked to PhysiologicalFileID
1 even though this is PhysiologicalFileID
2 that is under process.
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.
yes it takes in the event_tsv file
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.
ok. But what happens in the example above where the same TSV file links to two different PhysiologicalFileID
? Would it just return the first PhysiologicalFileID
encountered? If so, sounds like a possible major bug, no?
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.
Where do you see the case where two tsv point to the same physioFile?
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.
when the event.tsv file is identical for all EEG files and therefore put directly under root. I believe this is possible in BIDS.
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.
The event.json file can be shared by all subjects. I don't think the events.tsv can ? This means that ALL recordings have the same events/ stimulus? Seems unlikely, but I could be wrong. Do you have an example of this in the spec somewhere?
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.
From the BIDS specs: https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html
It is also possible to have a single events.tsv file describing events for all participants and runs (see [Inheritance Principle](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#the-inheritance-principle)).
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.
Fixed by passing in physioFileID as a param in the query
Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca>
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.
@jesscall see replies to your comments.
Also, once the LORIS side has been changed to link the file types to ImagingFileTypes
, a little reminder to modify the code here to reflect on the DB structure
|
||
return event_paths | ||
|
||
def grep_event_file_id_from_event_path(self, event_file_path): |
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.
ok. But what happens in the example above where the same TSV file links to two different PhysiologicalFileID
? Would it just return the first PhysiologicalFileID
encountered? If so, sounds like a possible major bug, no?
Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca>
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 👍 Waiting for aces/Loris#8036 to be merged on the LORIS to merge this PR.
* refactoring how bids_import handles event files: fetch, insert, archiving of tsv & json * bugfixes! * add event tables to database_lib * lint * missed one * ? * some more fixes after testing import with db libs * hed-assemble events * lint * more lint edits * rm prints * rm print * fixed bug with storing events.json and naming of archive * Apply suggestions from code review Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca> * Fix values for save to parameter_category_level * lint * trying to fix flake8 * flake 8? Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca> * Update python/lib/eeg.py Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca> * fixing grwp eventFileID function * fix EOL error * keep making syntax errors :( Co-authored-by: Cécile Madjar <cecile.madjar@mcin.ca>
Add support to bids_import for
*events.json
file & HED TagsScope
This PR refactors how the bids_import handles event files. It adds support for an event.json file in which HED tags can be stored. The PR edits the fetching and inserting of event files and adds an archiving feature similar to the annotation files.
Information
Please reference this documentation for more info on HED Tags in BIDS
Testing
*events.json
file at the root of the RB BIDS directory.*events.json
file in a subject directory (and renaming) and make sure the import still runs as expected.