-
Notifications
You must be signed in to change notification settings - Fork 200
[SCHEMA] Support structured survey data as a BIDS modality #2404
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
Draft
karl-koschutnig
wants to merge
3
commits into
bids-standard:master
Choose a base branch
from
karl-koschutnig:feat/phenotype-modality-structured
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
5775de6
[SCHEMA] Support structured survey data as a BIDS modality
karl-koschutnig 083c77d
[FIX] Update table formatting for survey instrument metadata in docum…
karl-koschutnig 9c1a560
[ENH] Update survey documentation and examples for sleep questionnaire
karl-koschutnig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| # Survey data (instrument-based phenotypic) | ||
|
|
||
| Survey data files contain responses collected from standardized questionnaires or | ||
| assessment instruments. | ||
| They are organized in the same subject- and session-resolved directory hierarchy | ||
| as other BIDS modalities, with one `.tsv` data file per instrument administration | ||
| and a corresponding `.json` sidecar that documents the instrument and its items. | ||
|
|
||
| This representation complements the aggregated `phenotype/` tables described in | ||
| [Phenotypic and assessment data](../modality-agnostic-files/phenotypic-and-assessment-data.md). | ||
| Aggregated phenotype tables MAY be generated from subject-resolved survey data | ||
| and stored under `phenotype/`, | ||
| but the subject-resolved structure is the primary canonical form. | ||
|
|
||
| <!-- | ||
| This block generates a filename templates. | ||
| The inputs for this macro can be found in the directory | ||
| src/schema/rules/files/raw | ||
| and a guide for using macros can be found at | ||
| https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md | ||
| --> | ||
| {{ MACROS___make_filename_template("raw", datatypes=["survey"]) }} | ||
|
|
||
| Survey files MUST be stored in a `survey` subdirectory of the subject (and | ||
| optionally session) directory. | ||
| The `task` entity identifies the instrument (for example, `task-pss` for the | ||
| Perceived Stress Scale). | ||
| The `run` entity MAY be used when the same instrument is administered more than | ||
| once within a session. | ||
|
|
||
| ## Sidecar JSON (`*_survey.json`) | ||
|
|
||
| Each survey `.tsv` file MUST be accompanied by a JSON sidecar. | ||
| Following the [Inheritance Principle](../common-principles.md#the-inheritance-principle), | ||
| the sidecar MAY be placed at any level of the hierarchy | ||
| (for example, at the dataset root as `task-<label>_survey.json`) | ||
| to apply to all survey files with matching entities, | ||
| or alongside individual `.tsv` files with the same filename stem. | ||
| The sidecar documents the instrument-level metadata and the individual items. | ||
|
|
||
| ### Instrument metadata | ||
|
|
||
| The following top-level fields describe the survey instrument and its | ||
| administration context. | ||
|
|
||
| | Field | Requirement | Description | | ||
| | ---------------------- | ----------- | ---------------------------------------------------------------------------------------------------- | | ||
| | `TaskName` | REQUIRED | Short label identifying the instrument as used in this dataset (MUST match the `task` entity value). | | ||
| | `OriginalName` | REQUIRED | Full canonical name of the instrument. | | ||
| | `StimulusType` | REQUIRED | MUST be `"Questionnaire"`. | | ||
| | `FileFormat` | REQUIRED | MUST be `"tsv"`. | | ||
| | `Language` | REQUIRED | Language code for the administered version (for example, `"en"`, `"de-AT"`). | | ||
| | `Respondent` | REQUIRED | Who provided the responses (`"self"`, `"clinician"`, `"parent"`, or similar). | | ||
| | `ShortName` | OPTIONAL | Common abbreviation of the instrument (for example, `"ESQ-3"`). | | ||
| | `Version` | OPTIONAL | Version or edition of the instrument. | | ||
| | `Authors` | OPTIONAL | Array of instrument authors. | | ||
| | `DOI` | OPTIONAL | DOI for the instrument or its primary validation paper. | | ||
| | `License` | OPTIONAL | License under which the instrument may be used. | | ||
| | `Construct` | OPTIONAL | Psychological or clinical construct measured (for example, `"sleep quality"`). | | ||
| | `Instructions` | OPTIONAL | Instructions given to the participant. | | ||
| | `AdministrationMethod` | OPTIONAL | How the instrument was administered (`"online"`, `"paper"`, `"interview"`, `"phone"`, or `"mixed"`). | | ||
| | `SoftwarePlatform` | OPTIONAL | Software used to administer the instrument (for example, `"LimeSurvey"`, `"REDCap"`). | | ||
|
|
||
| ### Item-level metadata | ||
|
|
||
| Any top-level key in the sidecar that is not one of the instrument-level fields | ||
| listed above is treated as a column-level variable definition (for example, `"Q01"`, | ||
| `"item_1"`). | ||
|
|
||
| | Field | Requirement | Description | | ||
| | ------------- | ----------- | --------------------------------------------------------------------------------------------------- | | ||
| | `Description` | REQUIRED | The exact text of the question or item. | | ||
| | `Levels` | OPTIONAL | Mapping of response values to their labels (for example, `{"0": "Not at all", "4": "Very often"}`). | | ||
| | `MinValue` | OPTIONAL | Minimum expected value. | | ||
| | `MaxValue` | OPTIONAL | Maximum expected value. | | ||
| | `DataType` | OPTIONAL | Expected data type of the column (`"string"`, `"integer"`, or `"float"`). | | ||
| | `Units` | OPTIONAL | Units, if applicable. | | ||
|
|
||
| ## Example dataset structure | ||
|
|
||
| ```text | ||
| study/ | ||
| ├── dataset_description.json | ||
| ├── participants.tsv | ||
| ├── task-sleep_survey.json | ||
| ├── sub-01/ | ||
| │ ├── ses-baseline/ | ||
| │ │ └── survey/ | ||
| │ │ └── sub-01_ses-baseline_task-sleep_run-01_survey.tsv | ||
| │ └── ses-week04/ | ||
| │ └── survey/ | ||
| │ ├── sub-01_ses-week04_task-sleep_run-01_survey.tsv | ||
| │ └── sub-01_ses-week04_task-sleep_run-02_survey.tsv | ||
| └── phenotype/ | ||
| └── sleep_summary.tsv | ||
| ``` | ||
|
|
||
| The root-level `task-sleep_survey.json` applies to all `task-sleep` survey files | ||
| through the inheritance principle, avoiding duplication across sessions and runs. | ||
| The `phenotype/` entry is an optional aggregated downstream view of the subject-resolved survey data. | ||
|
|
||
| ## Example `*_survey.tsv` | ||
|
|
||
| ```tsv | ||
| participant_id Q01 Q02 Q03 | ||
| sub-01 7 4 0 | ||
| ``` | ||
|
|
||
| ## Example `task-sleep_survey.json` | ||
|
|
||
| ```json | ||
| { | ||
| "TaskName": "sleep", | ||
| "OriginalName": "Example Sleep Questionnaire", | ||
| "ShortName": "ESQ-3", | ||
| "StimulusType": "Questionnaire", | ||
| "FileFormat": "tsv", | ||
| "Language": "en", | ||
| "Respondent": "self", | ||
| "AdministrationMethod": "online", | ||
| "Q01": { | ||
| "Description": "How many hours did you sleep last night?", | ||
| "MinValue": 0, | ||
| "MaxValue": 24, | ||
| "DataType": "float", | ||
| "Units": "h" | ||
| }, | ||
| "Q02": { | ||
| "Description": "How would you rate your overall sleep quality?", | ||
| "Levels": { | ||
| "1": "Very poor", | ||
| "2": "Poor", | ||
| "3": "Fair", | ||
| "4": "Good", | ||
| "5": "Very good" | ||
| }, | ||
| "MinValue": 1, | ||
| "MaxValue": 5, | ||
| "DataType": "integer" | ||
| }, | ||
| "Q03": { | ||
| "Description": "Did you wake up during the night?", | ||
| "Levels": { | ||
| "0": "No", | ||
| "1": "Yes" | ||
| }, | ||
| "DataType": "integer" | ||
| } | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| # Instrument-based phenotypic survey data | ||
| survey: | ||
| $ref: meta.templates.raw.task | ||
| suffixes: | ||
| - survey | ||
| extensions: | ||
| - .tsv | ||
| - .json | ||
| datatypes: | ||
| - survey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,3 +37,6 @@ nirs: | |
| mrs: | ||
| datatypes: | ||
| - mrs | ||
| survey: | ||
| datatypes: | ||
| - survey | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
quick one (edited/expanded 2026/05/12):
Overall, I like this approach but immediate question -- is there semantical difference between "phenotype" and "survey" in this PR? if not, I would have preferred to stay consistent and make it
phenotype/(orpheno/) (I think I expressed smth like that elsewhere TODO: find refs here). It would then be a consistent principle we already have overall and distilling more for BEPs, e.g. forstimuli/(@bids-standard/bep044 ; TODO: find/add refs). See:stimuli/[{leading entities}_]{entity_plural}.{tsv,json}file(s) #2283and potentially others, one way or another hinting on it, e.g
Then, if there is a desire to generalize "phenotype" into "survey" -- could be done for bids 2.0... WDYT?