Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
markmikkelsen committed Aug 27, 2024
2 parents 1637448 + 0c2672c commit 294d1c4
Show file tree
Hide file tree
Showing 24 changed files with 977 additions and 31 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/publish_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Publish schema"

on:
push:
branches:
- "master"
tags:
- "schema-*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
GIT_AUTHOR_NAME: BIDS CI
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: BIDS CI
GIT_COMMITTER_EMAIL: [email protected]

permissions:
contents: write
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: "blob:none"
- uses: actions/setup-python@v5
with:
python-version: 3
- name: Install bidsschematools
run: |
pip install --upgrade tools/schemacode
git clean -fxd tools/schemacode
- name: Checkout jsr-dist
run: |
git checkout -t origin/jsr-dist
- name: Regenerate schema
run: bst export > schema.json
- name: Regenerate context types
run: |
jq .meta.context schema.json \
| npx quicktype --src-lang schema --lang ts -t Context --just-types \
> context.ts
- name: Regenerate metaschema types
run: |
# Name the file schema so the type will be named Schema
bst export-metaschema > /tmp/schema.json
npx --package=json-schema-to-typescript json2ts --unknownAny /tmp/schema.json > metaschema.ts
- name: Determine next version
run: |
BASE=$( jq -r .schema_version schema.json )
if [[ "$BASE" =~ ^[0-9]*.[0-9]*.[0-9]*$ ]]; then
# Release, so unconditionally update version
VERSION=$BASE
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
else
DENOVER=$( jq -r .version jsr.json )
# Get the reference of the latest commit to touch the schema directory
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
PREFIX=${DENOVER%+*}
let SERIAL=1+${PREFIX#$BASE.}
else
SERIAL=1
fi
VERSION="$BASE.$SERIAL+$HASH"
fi
echo VERSION=$VERSION | tee -a $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Check for changes, set version and commit
run: |
if ! git diff -s --exit-code; then
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
git add jsr.json schema.json context.ts metaschema.ts
git commit -m "Update schema JSR distribution"
git push
fi
- name: Publish to JSR
if: success()
run: |
npx jsr publish
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: check-added-large-files
- id: check-case-conflict
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
rev: 0.29.2
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down Expand Up @@ -67,7 +67,7 @@ repos:
- id: codespell
args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
# Sync with project.optional-dependencies.typing
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BIDS currently supports the following data modalities with more to come in the f
- microscopy
- NIRS
- motion
- MRS

# Formatting your data with BIDS

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nav:
- Microscopy: modality-specific-files/microscopy.md
- Near-Infrared Spectroscopy: modality-specific-files/near-infrared-spectroscopy.md
- Motion: modality-specific-files/motion.md
- Magnetic Resonance Spectroscopy: modality-specific-files/magnetic-resonance-spectroscopy.md
- Derivatives:
- BIDS Derivatives: derivatives/introduction.md
- Common data types and metadata: derivatives/common-data-types.md
Expand Down
7 changes: 7 additions & 0 deletions src/appendices/cross-modality-correspondence.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ The reason for this is that the MRI needs to be corrected for nonlinear gradient
in order to fit the accompanying PET scans for co-registration
(Knudsen et al. 2020, [doi:10.1177/0271678X20905433](https://doi.org/10.1177/0271678X20905433);
Norgaard et al. 2019, [doi:10.1016/j.neuroimage.2019.05.055](https://doi.org/10.1016/j.neuroimage.2019.05.055)).

## MRS-MRI correspondence

It is typical to acquire high-resolution 3D anatomical MR images alongside MRS data for
voxel/slab placement, co-registration, and partial-volume tissue correction of metabolite concentrations.
To avoid incorrectly matching an MRS dataset with a corresponding anatomical MR image,
it is RECOMMENDED that the field `AnatomicalImage` be included in the MRS sidecar JSON files.
4 changes: 4 additions & 0 deletions src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ For example:
PsyArXiv.
[doi:10.31234/osf.io/w6z79](https://doi.org/10.31234/osf.io/w6z79)

#### MRS

- (publication forthcoming)

### Research Resource Identifier (RRID)

BIDS has also a
Expand Down
Loading

0 comments on commit 294d1c4

Please sign in to comment.