From db22e4a88e0b8a5f760890cb94138d2f3747a2e6 Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Mon, 31 Aug 2020 12:08:16 -0500 Subject: [PATCH 1/3] add schemas directory, direct copy from spec repo yml files --- bids-validator/package.json | 1 + bids-validator/schemas/associated_data.yaml | 9 ++ .../schemas/auxdatatypes/channels.yaml | 15 ++ .../schemas/auxdatatypes/electrodes.yaml | 14 ++ .../schemas/auxdatatypes/events.yaml | 15 ++ .../schemas/auxdatatypes/photo.yaml | 13 ++ bids-validator/schemas/datatypes/anat.yaml | 58 ++++++++ bids-validator/schemas/datatypes/beh.yaml | 28 ++++ bids-validator/schemas/datatypes/dwi.yaml | 43 ++++++ bids-validator/schemas/datatypes/eeg.yaml | 33 +++++ bids-validator/schemas/datatypes/fmap.yaml | 33 +++++ bids-validator/schemas/datatypes/func.yaml | 52 +++++++ bids-validator/schemas/datatypes/ieeg.yaml | 34 +++++ bids-validator/schemas/datatypes/meg.yaml | 62 ++++++++ bids-validator/schemas/entities.yaml | 135 ++++++++++++++++++ bids-validator/schemas/index.js | 61 ++++++++ bids-validator/schemas/modalities.yaml | 24 ++++ bids-validator/schemas/python_regex.json | 39 +++++ bids-validator/schemas/regex.json | 39 +++++ bids-validator/schemas/top_level_files.yaml | 26 ++++ bids-validator/utils/schemaTypes.js | 15 ++ bids-validator/utils/type.js | 8 +- 22 files changed, 756 insertions(+), 1 deletion(-) create mode 100644 bids-validator/schemas/associated_data.yaml create mode 100644 bids-validator/schemas/auxdatatypes/channels.yaml create mode 100644 bids-validator/schemas/auxdatatypes/electrodes.yaml create mode 100644 bids-validator/schemas/auxdatatypes/events.yaml create mode 100644 bids-validator/schemas/auxdatatypes/photo.yaml create mode 100644 bids-validator/schemas/datatypes/anat.yaml create mode 100644 bids-validator/schemas/datatypes/beh.yaml create mode 100644 bids-validator/schemas/datatypes/dwi.yaml create mode 100644 bids-validator/schemas/datatypes/eeg.yaml create mode 100644 bids-validator/schemas/datatypes/fmap.yaml create mode 100644 bids-validator/schemas/datatypes/func.yaml create mode 100644 bids-validator/schemas/datatypes/ieeg.yaml create mode 100644 bids-validator/schemas/datatypes/meg.yaml create mode 100644 bids-validator/schemas/entities.yaml create mode 100644 bids-validator/schemas/index.js create mode 100644 bids-validator/schemas/modalities.yaml create mode 100644 bids-validator/schemas/python_regex.json create mode 100644 bids-validator/schemas/regex.json create mode 100644 bids-validator/schemas/top_level_files.yaml create mode 100644 bids-validator/utils/schemaTypes.js diff --git a/bids-validator/package.json b/bids-validator/package.json index e65ab54ae..51fdb7000 100644 --- a/bids-validator/package.json +++ b/bids-validator/package.json @@ -30,6 +30,7 @@ "hed-validator": "^1.3.2", "ignore": "^4.0.2", "is-utf8": "^0.2.1", + "js-yaml": "^3.14.0", "jshint": "^2.9.6", "lerna": "^3.15.0", "minimatch": "3.0.4", diff --git a/bids-validator/schemas/associated_data.yaml b/bids-validator/schemas/associated_data.yaml new file mode 100644 index 000000000..b54ca34fb --- /dev/null +++ b/bids-validator/schemas/associated_data.yaml @@ -0,0 +1,9 @@ +--- +- code/: + - required: false +- derivatives/: + - required: false +- sourcedata/: + - required: false +- stimuli/: + - required: false diff --git a/bids-validator/schemas/auxdatatypes/channels.yaml b/bids-validator/schemas/auxdatatypes/channels.yaml new file mode 100644 index 000000000..a90620897 --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/channels.yaml @@ -0,0 +1,15 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - channels + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + task: required + run: optional diff --git a/bids-validator/schemas/auxdatatypes/electrodes.yaml b/bids-validator/schemas/auxdatatypes/electrodes.yaml new file mode 100644 index 000000000..b630ad589 --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/electrodes.yaml @@ -0,0 +1,14 @@ +--- +- datatypes: + - eeg + - ieeg + suffixes: + - electrodes + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + acq: optional + space: optional diff --git a/bids-validator/schemas/auxdatatypes/events.yaml b/bids-validator/schemas/auxdatatypes/events.yaml new file mode 100644 index 000000000..3c0ec521c --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/events.yaml @@ -0,0 +1,15 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - events + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + task: required + run: optional diff --git a/bids-validator/schemas/auxdatatypes/photo.yaml b/bids-validator/schemas/auxdatatypes/photo.yaml new file mode 100644 index 000000000..e104d04aa --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/photo.yaml @@ -0,0 +1,13 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - photo + extensions: + - .jpg + entities: + sub: required + ses: optional + acq: optional diff --git a/bids-validator/schemas/datatypes/anat.yaml b/bids-validator/schemas/datatypes/anat.yaml new file mode 100644 index 000000000..6d2f296c9 --- /dev/null +++ b/bids-validator/schemas/datatypes/anat.yaml @@ -0,0 +1,58 @@ +--- +# First group +- suffixes: + - T1w + - T2w + - T1rho + - T1map + - T2map + - T2star + - FLAIR + - FLASH + - PD + - PDmap + - PDT2 + - inplaneT1 + - inplaneT2 + - angio + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + run: optional + acq: optional + ce: optional + rec: optional +# Second group +- suffixes: + - defacemask + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + run: optional + acq: optional + ce: optional + rec: optional + mod: optional +# Third group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + run: optional + acq: optional + ce: optional + rec: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/beh.yaml b/bids-validator/schemas/datatypes/beh.yaml new file mode 100644 index 000000000..536e88321 --- /dev/null +++ b/bids-validator/schemas/datatypes/beh.yaml @@ -0,0 +1,28 @@ +--- +# First group +- suffixes: + - stim + - physio + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional + recording: optional +# Second group +- suffixes: + - events + - beh + extensions: + - .tsv + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional diff --git a/bids-validator/schemas/datatypes/dwi.yaml b/bids-validator/schemas/datatypes/dwi.yaml new file mode 100644 index 000000000..40f516e47 --- /dev/null +++ b/bids-validator/schemas/datatypes/dwi.yaml @@ -0,0 +1,43 @@ +--- +# First group +- suffixes: + - dwi + extensions: + - .nii.gz + - .nii + - .json + - .bvec + - .bval + entities: + sub: required + ses: optional + acq: optional + dir: optional + run: optional +# Second group +- suffixes: + - sbref + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + acq: optional + dir: optional + run: optional +# Third group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + acq: optional + dir: optional + run: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/eeg.yaml b/bids-validator/schemas/datatypes/eeg.yaml new file mode 100644 index 000000000..101c4b5c7 --- /dev/null +++ b/bids-validator/schemas/datatypes/eeg.yaml @@ -0,0 +1,33 @@ +--- +# First group +- suffixes: + - eeg + extensions: + - .json + - .edf + - .vhdr + - .vmrk + - .eeg + - .set + - .fdt + - .bdf + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional +# Second group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/fmap.yaml b/bids-validator/schemas/datatypes/fmap.yaml new file mode 100644 index 000000000..98d0f6c45 --- /dev/null +++ b/bids-validator/schemas/datatypes/fmap.yaml @@ -0,0 +1,33 @@ +--- +# First group +- suffixes: + - phasediff + - phase1 + - phase2 + - magnitude1 + - magnitude2 + - magnitude + - fieldmap + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + acq: optional + run: optional +# Second group +- suffixes: + - epi + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + acq: optional + ce: optional + dir: required + run: optional diff --git a/bids-validator/schemas/datatypes/func.yaml b/bids-validator/schemas/datatypes/func.yaml new file mode 100644 index 000000000..62a26b60b --- /dev/null +++ b/bids-validator/schemas/datatypes/func.yaml @@ -0,0 +1,52 @@ +--- +# First group +- suffixes: + - bold + - cbv + - phase + - sbref + extensions: + - .nii.gz + - .nii + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + ce: optional + rec: optional + dir: optional + run: optional + echo: optional +# Second group +- suffixes: + - events + extensions: + - .tsv + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + ce: optional + rec: optional + dir: optional + run: optional + echo: optional +# Third group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + rec: optional + run: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/ieeg.yaml b/bids-validator/schemas/datatypes/ieeg.yaml new file mode 100644 index 000000000..0a4fda251 --- /dev/null +++ b/bids-validator/schemas/datatypes/ieeg.yaml @@ -0,0 +1,34 @@ +--- +# First group +- suffixes: + - ieeg + extensions: + - .mefd/ + - .json + - .edf + - .vhdr + - .eeg + - .vmrk + - .set + - .fdt + - .nwb + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional +# Second group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/meg.yaml b/bids-validator/schemas/datatypes/meg.yaml new file mode 100644 index 000000000..5b72b0b6c --- /dev/null +++ b/bids-validator/schemas/datatypes/meg.yaml @@ -0,0 +1,62 @@ +--- +# First group +- suffixes: + - meg + extensions: + - / # corresponds to BTi/4D data + - .ds/ + - .json + - .fif + - .sqd + - .con + - .raw + - .ave + - .mrk + - .kdf + - .mhd + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional + proc: optional + split: optional +# Second group +- suffixes: + - headshape + extensions: + - .pos + - .txt + entities: + sub: required + ses: optional + acq: optional + space: optional +- suffixes: + - markers + extensions: + - .json + entities: + sub: required + ses: optional + task: optional + acq: optional + space: optional +# Third group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional + proc: optional + split: optional + space: optional + recording: optional diff --git a/bids-validator/schemas/entities.yaml b/bids-validator/schemas/entities.yaml new file mode 100644 index 000000000..bc04a1591 --- /dev/null +++ b/bids-validator/schemas/entities.yaml @@ -0,0 +1,135 @@ +--- +sub: + name: Subject + description: | + A person or animal participating in the study. + format: label +ses: + name: Session + description: | + A logical grouping of neuroimaging and behavioral data consistent across + subjects. + Session can (but doesn't have to) be synonymous to a visit in a + longitudinal study. + In general, subjects will stay in the scanner during one session. + However, for example, if a subject has to leave the scanner room and then + be re-positioned on the scanner bed, the set of MRI acquisitions will still + be considered as a session and match sessions acquired in other subjects. + Similarly, in situations where different data types are obtained over + several visits (for example fMRI on one day followed by DWI the day after) + those can be grouped in one session. + Defining multiple sessions is appropriate when several identical or similar + data acquisitions are planned and performed on all -or most- subjects, + often in the case of some intervention between sessions (e.g., training). + format: label +task: + name: Task + format: label + description: | + Each task has a unique label that MUST only consist of letters and/or + numbers (other characters, including spaces and underscores, are not + allowed). + Those labels MUST be consistent across subjects and sessions. +acq: + name: Acquisition + description: | + The OPTIONAL acq-