diff --git a/.gitignore b/.gitignore index aa7b6b684b..920ec97f05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ site/ .DS_Store -src/.DS_Store -src/04-modality-specific-files/.DS_Store \ No newline at end of file +.idea +venvs diff --git a/.travis.yml b/.travis.yml index dfa507b50b..c8e31367e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,18 @@ -language: node_js -node_js: - - "10" -cache: - directories: - - node_modules # NPM packages -before_script: - - npm install `cat npm-requirements.txt` -script: - - remark src/*.md src/*/*.md --frail +matrix: + include: + - language: node_js + node_js: + - "10" + cache: + directories: + - node_modules # NPM packages + before_script: + - npm install `cat npm-requirements.txt` + script: + - remark src/*.md src/*/*.md --frail + - language: python + python: 3.7 + install: + - pip install yamllint + script: + - yamllint -f standard src/schema/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5df6000e14..58e23d892b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,9 @@ Been here before? Already know what you're looking for in this guide? Jump to th * [Understanding issues](#understanding-issues) * [Commenting on a pull request](#commenting-on-a-pull-request) * [Writing in markdown](#writing-in-markdown) -* [Make a change with a pull request](#making-a-change-with-a-pull-request) +* [Making a change with a pull request](#making-a-change-with-a-pull-request) * [Example pull request](#example-pull-request) +* [Updating the specification schema](#updating-the-schema) * [Fixing Remark errors from Travis](#fixing-travis-remark-errors) * [Recognizing contributions](#recognizing-contributions) @@ -224,6 +225,56 @@ GitHub has a [nice introduction](https://help.github.com/articles/github-flow/) Example-Contribution +## Updating the schema + +Portions of the BIDS specification are defined using YAML files, in order to make the specification machine-readable. +Currently, the only portion of the specification that relies on this schema is the Entity Table, but any changes to the specification should be mirrored in the schema. + +### The format of the schema + +The schema reflects the files and objects in the specification, as well as associations between these objects. +Here is a list of the files and subfolders of the schema, roughly in order of importance: + +- `datatypes/*.yaml`: + Data types supported by the specification. + Each datatype may support many suffixes. + These suffixes are divided into groups based on what extensions and entities are allowed for each. + Data types correspond to subfolders (e.g., `anat`, `func`) in the BIDS structure. +- `auxdatatypes/*.yaml`: + Auxiliary (not directly imaging or data-containing) data types supported by the specification. + Each auxiliary data type is associated with a set of data types, and these auxiliary data types are grouped based on what data types, extensions, and entities are allowed for each. + Examples of auxiliary data types include `channels`, `electrodes`, and `photo`. +- `entities.yaml`: + A list of entities (key/value pairs in folder and filenames) with associated descriptions and formatting rules. + The order of the entities in the file determines the order in which entities must appear in filenames. +- `top_level_files.yaml`: + Modality-agnostic files stored at the top level of a BIDS dataset. + The schema specifies whether these files are required or optional, as well as acceptable extensions for each. +- `modalities.yaml`: + Modalities supported by the specification, along with a list of associated data types. + Modalities are not reflected directly in the BIDS structure, but data types are modality-specific. +- `associated_data.yaml`: + Folders that are commonly contained within the same folder as a BIDS dataset, but which do not follow the BIDS structure internally, such as `code` or `sourcedata`. + The schema specifies which folders are accepted and whether they are required or optional. + +### Making a change to the schema + +#### 1. Ensure that changes to the specification are matched in the schema + +The schema formalizes the rules described in the specification text, so you must ensure that any changes which impact the rules of the specification (including, but not limited to, adding new entities, suffixes, datatypes, modalities, etc.) are reflected in the schema as well. + +#### 2. Generate an updated entity table before pushing your changes + +Run the Python script `tools/bids_schema.py`: + +```bash +python tools/bids_schema.py entity src/schema/ src/99-appendices/04-entity-table.md +``` + +#### 3. Push your changes + +For more information on making general changes with a pull request, please review [Making a change with a pull request](#making-a-change-with-a-pull-request). + ## Fixing Travis Remark errors We use a linter called [Remarkjs](https://github.com/remarkjs/remark-lint) to ensure all of diff --git a/src/99-appendices/04-entity-table.md b/src/99-appendices/04-entity-table.md index e460e28488..704e6020a9 100644 --- a/src/99-appendices/04-entity-table.md +++ b/src/99-appendices/04-entity-table.md @@ -1,33 +1,48 @@ # Appendix IV: Entity table This section compiles the entities (key-value pairs) described throughout this -specification, and establishes a common order within a filename. For example, if -a file has an acquisition and reconstruction label, the acquisition entity must -precede the reconstruction entity. REQUIRED and OPTIONAL entities for a given -file type are denoted. Entity formats indicate whether the value is alphanumeric +specification, and establishes a common order within a filename.  +For example, if a file has an acquisition and reconstruction label, the +acquisition entity must precede the reconstruction entity. +REQUIRED and OPTIONAL entities for a given file type are denoted. +Entity formats indicate whether the value is alphanumeric (`