diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000000..c4e38c1d1d --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,26 @@ +--- +name: Shellcheck + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + shellcheck: + name: Check shell scripts + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt update && sudo apt install -y shellcheck + - name: shellcheck + run: | + git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b2f40321ca..c074a6681e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks +ci: + skip: [shellcheck] exclude: 'tools/schemacode/bidsschematools/tests/data/broken_dataset_description.json' repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -13,7 +15,7 @@ repos: - id: check-added-large-files - id: check-case-conflict - repo: https://github.com/psf/black - rev: 24.4.0 + rev: 24.4.2 hooks: - id: black files: ^tools/(?!schemacode) @@ -55,7 +57,7 @@ repos: - id: codespell args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy # Sync with project.optional-dependencies.typing @@ -71,3 +73,7 @@ repos: - types-jsonschema args: ["tools/schemacode/bidsschematools"] pass_filenames: false + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck diff --git a/scripts/test_tag b/scripts/test_tag index f11ef697dd..64e0ddd20f 100755 --- a/scripts/test_tag +++ b/scripts/test_tag @@ -9,7 +9,7 @@ EPOCH="$(date +%s)" GIT_DIR=$( git rev-parse --git-dir ) -REPO_ROOT=$( ls -d ${GIT_DIR%.git} ) +REPO_ROOT=$( ls -d "${GIT_DIR%.git}" ) VERSION_FILE="$REPO_ROOT/src/schema/SCHEMA_VERSION" diff --git a/src/common-principles.md b/src/common-principles.md index 3d9bc233af..08ef8e6a4f 100644 --- a/src/common-principles.md +++ b/src/common-principles.md @@ -658,6 +658,21 @@ for more information. ## The Inheritance Principle +In some circumstances, there can be multiple data files for which +all or a subset of the relevant metadata is precisely equivalent. +Where this occurs, +it may be preferable to define those metadata *only once*, +and be placed on the filesystem in such a way that those files +are deemed to be *applicable* to each relevant data file individually, +but *not* be erroneously associated with other data files +to which the metadata contained within are not applicable. +The Inheritance Principle defines a systematized set of rules +to determine which metadata files to associate with which data files. +Further, because multiple metadata files may apply to an individual data file, +the Principle defines the *order of precedence* of such metadata files contents. + +### Rules + 1. Any metadata file (such as `.json`, `.bvec` or `.tsv`) MAY be defined at any directory level. 1. For a given data file, any metadata file is applicable to that data file if: @@ -687,7 +702,7 @@ for more information. same key present in another metadata file at a lower level (though it is RECOMMENDED to minimize the extent of such overrides). -Corollaries: +### Corollaries 1. As per rule 3, metadata files applicable only to a specific participant / session MUST be defined in or below the directory corresponding to that participant / session; @@ -704,6 +719,8 @@ Corollaries: a key-value in a later file does not imply the "unsetting" of that field (indeed removal of existing fields is not possible). +### Examples + Example 1: Demonstration of inheritance principle {{ MACROS___make_sidecar_table("pet.PETTime") }} -We refer to the common principles for the standards for describing dates and timestamps, including possibilities for anonymization (see [Units](../common-principles.md#units)). +We refer to the common principles for the standards for describing dates and timestamps, including possibilities for deidentification (see [Units](../common-principles.md#units)). #### Reconstruction diff --git a/src/schema/objects/columns.yaml b/src/schema/objects/columns.yaml index 3ccb32d324..5ca387a007 100644 --- a/src/schema/objects/columns.yaml +++ b/src/schema/objects/columns.yaml @@ -19,7 +19,7 @@ acq_time__scans: Acquisition time refers to when the first data point in each run was acquired. Furthermore, if this header is provided, the acquisition times of all files from the same recording MUST be identical. - Datetime format and their anonymization are described in + Datetime format and their deidentification are described in [Units](SPEC_ROOT/common-principles.md#units). type: string format: datetime @@ -28,7 +28,7 @@ acq_time__sessions: display_name: Session acquisition time description: | Acquisition time refers to when the first data point of the first run was acquired. - Datetime format and their anonymization are described in + Datetime format and their deidentification are described in [Units](SPEC_ROOT/common-principles.md#units). type: string format: datetime diff --git a/src/schema/objects/metadata.yaml b/src/schema/objects/metadata.yaml index 57515dd6f0..1b13a6a614 100644 --- a/src/schema/objects/metadata.yaml +++ b/src/schema/objects/metadata.yaml @@ -1646,7 +1646,7 @@ LabelingLocationDescription: Description of the location of the labeling plane (`"CASL"` or `"PCASL"`) or the labeling slab (`"PASL"`) that cannot be captured by fields `LabelingOrientation` or `LabelingDistance`. - May include a link to an anonymized screenshot of the planning of the + May include a link to a deidentified screenshot of the planning of the labeling slab/plane with respect to the imaging slab or slices `*_asllabeling.*`. Based on DICOM macro C.8.13.5.14. diff --git a/src/schema/objects/suffixes.yaml b/src/schema/objects/suffixes.yaml index 4fe6fe1868..5f57b28ba8 100644 --- a/src/schema/objects/suffixes.yaml +++ b/src/schema/objects/suffixes.yaml @@ -515,7 +515,7 @@ asllabeling: value: asllabeling display_name: ASL Labeling Screenshot description: | - An anonymized screenshot of the planning of the labeling slab/plane + A deidentified screenshot of the planning of the labeling slab/plane with respect to the imaging slab or slices. This screenshot is based on DICOM macro C.8.13.5.14. beh: