Skip to content

Commit

Permalink
SCHEMA: Fix diffusion and NIRS rules (#1650)
Browse files Browse the repository at this point in the history
* SCHEMA: Check for three bvec rows

* FIX: NIRS channels are recommended, not required

* FIX: Selectors to match required/optional conditions

* FIX: Value of channel type is ACCEL, not ACC
  • Loading branch information
effigies authored Nov 10, 2023
1 parent bf015e6 commit 426de56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/schema/rules/checks/dwi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DWIBvecRows:
- suffix == "dwi"
- '"bvec" in associations'
checks:
- associations.bvec.n_rows == 1
- associations.bvec.n_rows == 3

# 32
DWIMissingBvec:
Expand Down
16 changes: 12 additions & 4 deletions src/schema/rules/checks/nirs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,28 @@ NIRSChannelCount:
ACCELChannelCountReq:
selectors:
- suffix == "nirs"
- count(associations.channels.type, "ACCEL") > 0
checks:
- sidecar.ACCELChannelCount == count(associations.channels.type, "ACCEL")

GYROChannelCountReq:
selectors:
- suffix == "nirs"
- count(associations.channels.type, "GYRO") > 0
checks:
- sidecar.GYROChannelCount == count(associations.channels.type, "GYRO")

MAGNChannelCountReq:
selectors:
- suffix == "nirs"
- count(associations.channels.type, "MAGN") > 0
checks:
- sidecar.MAGNChannelCount == count(associations.channels.type, "MAGN")

ShortChannelCountReq:
selectors:
- suffix == "nirs"
- '"ShortChannelCount" in sidecar'
checks:
- sidecar.ShortChannelCount == count(associations.channels.short_channel, "true")

Expand All @@ -53,11 +57,15 @@ Component:
checks:
- columns.component != null

RequiredChannels:
RecommendedChannels:
issue:
code: NIRS_RECOMMENDED_CHANNELS
message: |
NIRS files SHOULD have an associated channels.tsv file.
level: warning
selectors:
- datatype == "nirs"
- suffix == "optodes"
- extension == ".tsv"
- suffix == "nirs"
- extension == ".snirf"
checks:
- associations.channels != null

Expand Down
2 changes: 1 addition & 1 deletion src/schema/rules/sidecars/nirs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ NirsRequired:
# Following counts required conditions enforced in checks
ACCELChannelCount:
level: optional
level_addendum: required if any channel type is ACC
level_addendum: required if any channel type is ACCEL
GYROChannelCount:
level: optional
level_addendum: required if any channel type is GYRO
Expand Down

0 comments on commit 426de56

Please sign in to comment.