Skip to content

Commit

Permalink
feat: allow passing a lookup csv to populate or overwrite values
Browse files Browse the repository at this point in the history
In the case that values extracted from the BIDS data are missing or incorrect, you can pass a --lookup_csv file and a list of --lookup_fields . For every field listed, the value for that participant is grabbed from the lookup csv and included in the image03.csv instead of the value deduced from the BIDS data.
  • Loading branch information
elizabethlorenc committed Oct 2, 2024
1 parent 7256313 commit ea6313b
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 170 deletions.
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ Extract NIMH Data Archive compatible metadata from Brain Imaging Data Structure

## Usage

usage: bids2nda [-h] [-e EXPID_MAPPING] BIDS_DIRECTORY GUID_MAPPING OUTPUT_DIRECTORY

usage: bids2nda [-h] [-e EXPID_MAPPING] [--lookup_csv LOOKUP_CSV] [--lookup_fields LOOKUP_FIELDS [LOOKUP_FIELDS ...]] BIDS_DIRECTORY GUID_MAPPING OUTPUT_DIRECTORY
BIDS to NDA converter.

positional arguments:
BIDS_DIRECTORY Location of the root of your BIDS compatible directory.
GUID_MAPPING Path to a text file with participant_id to GUID mapping.
You will need to use the GUID Tool
(https://ndar.nih.gov/contribute.html) to generate GUIDs
for your participants.
OUTPUT_DIRECTORY Directory where NDA files will be stored.
BIDS_DIRECTORY Location of the root of your BIDS compatible directory
GUID_MAPPING Path to a text file with participant_id to GUID mapping. You will need to use the GUID Tool (https://ndar.nih.gov/contribute.html) to generate GUIDs for
your participants.
OUTPUT_DIRECTORY Directory where NDA files will be stored

optional arguments:
-h, --help Show this help message and exit.
-e EXPID_MAPPING Path to a text file with experiment name to NDA experiment ID mapping.
options:
-h, --help show this help message and exit
-e EXPID_MAPPING, --expid_mapping EXPID_MAPPING
Path to a text file with experiment name to NDA experiment ID mapping.
--lookup_csv LOOKUP_CSV
Path to a csv with data we need for the image03.csv, i.e. ndar_subject01.csv
--lookup_fields LOOKUP_FIELDS [LOOKUP_FIELDS ...]
List of column names to grab from the lookup csv. i.e. --lookup_fields interview_age sex


## GUID_MAPPING file format
Expand All @@ -42,6 +44,22 @@ The BIDS task name should match the value associated with the "task-" key in the

The NDA experiment ID number(s) are received from NDA after setting the study up through the NDA website [here](https://ndar.nih.gov/user/dashboard/collections.html).

## LOOKUP_CSV
This can be any csv file, including something like the ndar_subject01.csv, with data
you want to use to populate the image03.csv file.

This is useful in cases where the BIDS-derived data is missing or incorrect, such as
the calculation of interview_age in months, which is only approximated based on age in years
from the BIDS data.

## LOOKUP_FIELDS
If you pass a lookup csv, you need to specify which columns you want to use to populate
the image03.csv. The column names must match, so if you're trying to populate the interview_age
column in the image03.csv, your lookup csv must have a column with the same name.

You can pass more than one value, separated by spaces, like:
--lookup_fields interview_age gender

## Example outputs
See [/examples](/examples)

Loading

0 comments on commit ea6313b

Please sign in to comment.