Skip to content

Commit

Permalink
Merge pull request #1980 from effigies/schema/validation-gaps
Browse files Browse the repository at this point in the history
fix(schema): Fix/add schema checks for metadata and associated files
  • Loading branch information
rwblair authored Nov 11, 2024
2 parents 0f65f12 + fb8d713 commit 02e8c16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/schema/rules/checks/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EventsMissing:
- '!match(entities.task, "rest")'
- '!intersects([suffix], ["events", "beh"])'
- extension != ".json"
- (datatype != "meg" || entities.subject != "emptyroom")
- datatype != "meg" || entities.subject != "emptyroom" && entities.task != "noise"
checks:
- '"events" in associations'

Expand All @@ -26,7 +26,7 @@ StimulusFileMissing:
A stimulus file was declared but not found in the dataset.
level: error
selectors:
- suffix == "events"
- intersects([suffix], ["events", "beh"])
- columns.stim_file != null
checks:
- exists(columns.stim_file, "stimuli") == length(columns.stim_file) - count(columns.stim_file, "n/a")
Expand Down
18 changes: 18 additions & 0 deletions src/schema/rules/checks/mri.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,27 @@ SliceTimingElements:
- modality == "mri"
- type(sidecar.SliceTiming) != "null"
- type(nifti_header) != "null"
- type(sidecar.SliceEncodingDirection) == 'null'
checks:
- length(sidecar.SliceTiming) == nifti_header.dim[3]

SliceTimingElementsWithDirection:
issue:
code: SLICETIMING_ELEMENTS
message: |
The number of elements in the 'SliceTiming' array should match the dimension
of the corresponding NIfTI volume matching `SliceEncodingDirection`
level: warning
selectors:
- modality == "mri"
- type(sidecar.SliceTiming) != "null"
- type(nifti_header) != "null"
- sidecar.SliceEncodingDirection
checks:
- sidecar.SliceEncodingDirection[0] != "i" || length(sidecar.SliceTiming) == nifti_header.dim[1]
- sidecar.SliceEncodingDirection[0] != "j" || length(sidecar.SliceTiming) == nifti_header.dim[2]
- sidecar.SliceEncodingDirection[0] != "k" || length(sidecar.SliceTiming) == nifti_header.dim[3]

# 93
EESGreaterThanTRT:
issue:
Expand Down

0 comments on commit 02e8c16

Please sign in to comment.