Skip to content

Commit 556e86d

Browse files
authored
Merge pull request #1095 from bids-standard/fix_recording_regex
Fix recording regex.
2 parents 7f9e596 + 453ff79 commit 556e86d

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

bids-validator/bids_validator/rules/file_level_rules.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575

7676
"dwi": {
77-
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?dwi[\\/\\\\]\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(_(?:@@@_dwi_type_@@@)\\.(@@@_dwi_ext_@@@)|(?:recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
77+
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?dwi[\\/\\\\]\\1(_\\2)?(?:_acq-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?((?:_@@@_dwi_type_@@@)\\.(@@@_dwi_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
7878
"tokens": {
7979
"@@@_dwi_ext_@@@": ["nii\\.gz", "nii", "json", "bvec", "bval"],
8080
"@@@_dwi_type_@@@": ["dwi", "sbref"],
@@ -119,7 +119,7 @@
119119
},
120120

121121
"func": {
122-
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?func[\\/\\\\]\\1(_\\2)?_task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_ce-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?((?:@@@_func_ext_@@@)|(?:recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
122+
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?func[\\/\\\\]\\1(_\\2)?_task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_ce-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?((?:@@@_func_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
123123
"tokens": {
124124
"@@@_func_ext_@@@": [
125125
"_bold\\.nii\\.gz",

bids-validator/bids_validator/rules/top_level_rules.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
},
2020

2121
"func_top": {
22-
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:recording-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_ce-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?(@@@_func_top_ext_@@@)$",
22+
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_ce-[a-zA-Z0-9]+)?(?:_dir-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?((?:@@@_func_top_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
2323
"tokens": {
2424
"@@@_func_top_ext_@@@": [
2525
"_bold\\.json",
2626
"_sbref\\.json",
2727
"_events\\.json",
2828
"_events\\.tsv",
29-
"_physio\\.json",
30-
"_stim\\.json",
3129
"_beh\\.json"
30+
],
31+
"@@@_cont_ext_@@@": [
32+
"_physio\\.json",
33+
"_stim\\.json"
3234
]
3335
}
3436
},
@@ -102,7 +104,7 @@
102104
"regexp": "^[\\/\\\\](?:acq-[a-zA-Z0-9]+_)?(?:dir-[a-zA-Z0-9]+_)epi\\.json$"
103105
},
104106
"other_top_files": {
105-
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:recording-[a-zA-Z0-9]+_)?(?:task-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(@@@_other_top_files_ext_@@@)$",
107+
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?(?:task-[a-zA-Z0-9]+_)?(?:acq-[a-zA-Z0-9]+_)?(?:rec-[a-zA-Z0-9]+_)?(?:run-[0-9]+_)?(?:recording-[a-zA-Z0-9]+_)?(@@@_other_top_files_ext_@@@)$",
106108
"tokens": {
107109
"@@@_other_top_files_ext_@@@": ["physio\\.json", "stim\\.json"]
108110
}

bids-validator/utils/__tests__/type.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,24 @@ describe('type.js', () => {
1717
),
1818
).toBe(true)
1919
})
20+
21+
it('does not throw an error for recording entity in physio data at root of the dataset', () => {
22+
expect(
23+
type.isBIDS(
24+
'/task-matchingpennies_recording-eyetracking_physio.json',
25+
),
26+
).toBe(true)
27+
})
28+
29+
const physio_task_modalities = ['eeg', 'ieeg', 'meg', 'func', 'beh']
30+
physio_task_modalities.map(mod => {
31+
it(`does not throw an error for recording entity in ${mod} physio data`, () => {
32+
expect(
33+
type.isBIDS(
34+
`/sub-05/${mod}/sub-05_task-matchingpennies_recording-eyetracking_physio.tsv.gz`,
35+
),
36+
).toBe(true)
37+
})
38+
})
2039
})
2140
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"codecov": "./node_modules/.bin/codecov",
1111
"test": "bids-validator/bin/test-submodule-exists && jest",
1212
"npmPublish": "cd bids-validator && publish",
13+
"lernaPublish": "./node_modules/.bin/lerna publish && ./tools/post_publish.sh",
1314
"web-dev": "cd bids-validator-web && yarn dev",
1415
"web-build": "cd bids-validator-web && yarn build",
1516
"web-export": "yarn web-build && cd bids-validator-web && yarn next export"

tools/post_publish.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
# Generate a dev version with no tag and push. Meant to be called immediately after publishing new version with tag/npm package.
3+
set -e
4+
./node_modules/.bin/lerna version prepatch --preid dev --no-git-tag-version
5+
git add bids-validator-web/package-lock.json bids-validator-web/package.json bids-validator/package-lock.json bids-validator/package.json lerna.json
6+
git commit -m "setting dev version"
7+
git push

0 commit comments

Comments
 (0)