Adding medication data to BIDS phenotype folder

We need to enter the medication data to a BIDS-compatible file in the phenotype directory. The original data are kept in json format for each subject. There is many aspects we save about a medication, including dose, unit, regimen, indication, BIDS sessions that overlap with it, etc. In putting all this information into a tsv file we thought to give columns for each individual medication, e.g.:

tylenol_duration | tyolenol_doseUnit | tylenol_doseValue | aspirin_duration | aspirin_doseUnit | aspirin_doseValue

This means that the number of columns is large, and if we wanted to put a dataset description file it would be large and repetitive, having for each medication in the example above: duration, doseUnit, doseValue. But the upside is that the whole dataset can be quickly filtered to analyze a single medication, that overlaps with specific sessions, etc. The long vertical format of data storage needs more transformations to use the data.

I wanted to ask the community here if there is a preferred way to include medication in BIDS, or how are you dealing with these problems. My dataset has 450 subjects with 1900 sessions in total. Lot’s of carefully reported medications.

Thank you.

https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#phenotypic-and-assessment-data

How I read that is that the tsv files can have multiple rows with the same participant_id. You could add a dose type column so that participants would have a row for every medication for every session like:

participant_id | dose_type | dose_value | dose_unit | duration | session
sub-01 | tylenol | X | Y | T | ses-01
sub-01 | aspirin | X | Y | T | ses-01
sub-01 | tylenol | X | Y | T | ses-02
sub-01 | aspirin | X | Y | T | ses-02
sub-02 | tylenol | X | Y | T | ses-01

I could also imagine treating each drug as its own <measurement_tool_name>.tsv instead of adding a dose_type column.

This is no way shape or form a preferred way. We unfortunately don’t have any phenotype directories in bids-examples. Curious what others think.

Thanks @rwblair . Your suggestion makes sense. I am also curious if others think the same.