Skip to content

Commit 294d1c4

Browse files
committed
2 parents 1637448 + 0c2672c commit 294d1c4

File tree

24 files changed

+977
-31
lines changed

24 files changed

+977
-31
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: "Publish schema"
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
tags:
8+
- "schema-*"
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
env:
19+
GIT_AUTHOR_NAME: BIDS CI
20+
GIT_AUTHOR_EMAIL: [email protected]
21+
GIT_COMMITTER_NAME: BIDS CI
22+
GIT_COMMITTER_EMAIL: [email protected]
23+
24+
permissions:
25+
contents: write
26+
id-token: write
27+
28+
jobs:
29+
publish:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
filter: "blob:none"
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: 3
39+
- name: Install bidsschematools
40+
run: |
41+
pip install --upgrade tools/schemacode
42+
git clean -fxd tools/schemacode
43+
- name: Checkout jsr-dist
44+
run: |
45+
git checkout -t origin/jsr-dist
46+
- name: Regenerate schema
47+
run: bst export > schema.json
48+
- name: Regenerate context types
49+
run: |
50+
jq .meta.context schema.json \
51+
| npx quicktype --src-lang schema --lang ts -t Context --just-types \
52+
> context.ts
53+
- name: Regenerate metaschema types
54+
run: |
55+
# Name the file schema so the type will be named Schema
56+
bst export-metaschema > /tmp/schema.json
57+
npx --package=json-schema-to-typescript json2ts --unknownAny /tmp/schema.json > metaschema.ts
58+
- name: Determine next version
59+
run: |
60+
BASE=$( jq -r .schema_version schema.json )
61+
if [[ "$BASE" =~ ^[0-9]*.[0-9]*.[0-9]*$ ]]; then
62+
# Release, so unconditionally update version
63+
VERSION=$BASE
64+
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
65+
else
66+
DENOVER=$( jq -r .version jsr.json )
67+
# Get the reference of the latest commit to touch the schema directory
68+
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
69+
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
70+
PREFIX=${DENOVER%+*}
71+
let SERIAL=1+${PREFIX#$BASE.}
72+
else
73+
SERIAL=1
74+
fi
75+
VERSION="$BASE.$SERIAL+$HASH"
76+
fi
77+
echo VERSION=$VERSION | tee -a $GITHUB_ENV
78+
env:
79+
REF: ${{ github.ref }}
80+
- name: Check for changes, set version and commit
81+
run: |
82+
if ! git diff -s --exit-code; then
83+
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
84+
git add jsr.json schema.json context.ts metaschema.ts
85+
git commit -m "Update schema JSR distribution"
86+
git push
87+
fi
88+
- name: Publish to JSR
89+
if: success()
90+
run: |
91+
npx jsr publish

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: check-added-large-files
1616
- id: check-case-conflict
1717
- repo: https://github.com/python-jsonschema/check-jsonschema
18-
rev: 0.29.1
18+
rev: 0.29.2
1919
hooks:
2020
- id: check-dependabot
2121
- id: check-github-workflows
@@ -67,7 +67,7 @@ repos:
6767
- id: codespell
6868
args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"]
6969
- repo: https://github.com/pre-commit/mirrors-mypy
70-
rev: v1.11.1
70+
rev: v1.11.2
7171
hooks:
7272
- id: mypy
7373
# Sync with project.optional-dependencies.typing

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ BIDS currently supports the following data modalities with more to come in the f
3030
- microscopy
3131
- NIRS
3232
- motion
33+
- MRS
3334

3435
# Formatting your data with BIDS
3536

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ nav:
1919
- Microscopy: modality-specific-files/microscopy.md
2020
- Near-Infrared Spectroscopy: modality-specific-files/near-infrared-spectroscopy.md
2121
- Motion: modality-specific-files/motion.md
22+
- Magnetic Resonance Spectroscopy: modality-specific-files/magnetic-resonance-spectroscopy.md
2223
- Derivatives:
2324
- BIDS Derivatives: derivatives/introduction.md
2425
- Common data types and metadata: derivatives/common-data-types.md

src/appendices/cross-modality-correspondence.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ The reason for this is that the MRI needs to be corrected for nonlinear gradient
1212
in order to fit the accompanying PET scans for co-registration
1313
(Knudsen et al. 2020, [doi:10.1177/0271678X20905433](https://doi.org/10.1177/0271678X20905433);
1414
Norgaard et al. 2019, [doi:10.1016/j.neuroimage.2019.05.055](https://doi.org/10.1016/j.neuroimage.2019.05.055)).
15+
16+
## MRS-MRI correspondence
17+
18+
It is typical to acquire high-resolution 3D anatomical MR images alongside MRS data for
19+
voxel/slab placement, co-registration, and partial-volume tissue correction of metabolite concentrations.
20+
To avoid incorrectly matching an MRS dataset with a corresponding anatomical MR image,
21+
it is RECOMMENDED that the field `AnatomicalImage` be included in the MRS sidecar JSON files.

src/introduction.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ For example:
184184
PsyArXiv.
185185
[doi:10.31234/osf.io/w6z79](https://doi.org/10.31234/osf.io/w6z79)
186186

187+
#### MRS
188+
189+
- (publication forthcoming)
190+
187191
### Research Resource Identifier (RRID)
188192

189193
BIDS has also a

0 commit comments

Comments
 (0)