Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration should be allowed in files without timeline #239

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bids/validator/tsvValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class BidsHedTsvValidator extends BidsValidator {
_checkNoTime(elements) {
const timeIssues = []
for (const element of elements) {
if (element.parsedHedString.tags.some((tag) => this.special.temporalTags.has(tag.schemaTag.name))) {
if (element.parsedHedString.tags.some((tag) => this.special.timelineTags.has(tag.schemaTag.name))) {
timeIssues.push(
BidsHedIssue.fromHedIssue(
generateIssue('temporalTagInNonTemporalContext', { string: element.hedString, tsvLine: element.tsvLine }),
Expand Down
18 changes: 9 additions & 9 deletions data/json/reservedTags.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ERROR_CODE": "DEF_INVALID",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": false,
"requiresTimeline": false,
"requiresDef": false,
"otherAllowedNonDefTags": null
},
Expand All @@ -31,7 +31,7 @@
"ERROR_CODE": "DEF_EXPAND_INVALID",
"noSpliceInGroup": true,
"forbiddenSubgroupTags": ["Def", "Def-expand"],
"isTemporalTag": false,
"requiresTimeline": false,
"requiresDef": false,
"otherAllowedNonDefTags": []
},
Expand All @@ -49,7 +49,7 @@
"ERROR_CODE": "DEFINITION_INVALID",
"noSpliceInGroup": true,
"forbiddenSubgroupTags": ["Def", "Def-expand"],
"isTemporalTag": false,
"requiresTimeline": false,
"requiresDef": false,
"otherAllowedNonDefTags": []
},
Expand All @@ -67,7 +67,7 @@
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": true,
"requiresTimeline": true,
"requiresDef": false,
"otherAllowedNonDefTags": ["Duration", "Onset", "Offset", "Inset"]
},
Expand All @@ -85,7 +85,7 @@
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": true,
"requiresTimeline": false,
"requiresDef": false,
"otherAllowedNonDefTags": ["Delay"]
},
Expand All @@ -103,7 +103,7 @@
"ERROR_CODE": "TAG_GROUP_ERROR",
"noSpliceInGroup": true,
"forbiddenSubgroupTags": [],
"isTemporalTag": false,
"requiresTimeline": false,
"requiresDef": false,
"otherAllowedNonDefTags": []
},
Expand All @@ -121,7 +121,7 @@
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": true,
"requiresTimeline": true,
"requiresDef": true,
"otherAllowedNonDefTags": ["Delay"]
},
Expand All @@ -139,7 +139,7 @@
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": true,
"requiresTimeline": true,
"requiresDef": true,
"otherAllowedNonDefTags": ["Delay"]
},
Expand All @@ -157,7 +157,7 @@
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
"noSpliceInGroup": false,
"forbiddenSubgroupTags": [],
"isTemporalTag": true,
"requiresTimeline": true,
"requiresDef": true,
"otherAllowedNonDefTags": ["Delay"]
}
Expand Down
2 changes: 1 addition & 1 deletion parser/reservedChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ReservedChecker {
this.requiresDefTags = ReservedChecker._getSpecialTagsByProperty('requiresDef')
this.groupTags = ReservedChecker._getSpecialTagsByProperty('tagGroup')
this.exclusiveTags = ReservedChecker._getSpecialTagsByProperty('exclusive')
this.temporalTags = ReservedChecker._getSpecialTagsByProperty('isTemporalTag')
this.timelineTags = ReservedChecker._getSpecialTagsByProperty('requiresTimeline')
this.noSpliceInGroup = ReservedChecker._getSpecialTagsByProperty('noSpliceInGroup')
this.hasForbiddenSubgroupTags = new Set(
[...ReservedChecker.reservedMap.values()]
Expand Down
2 changes: 1 addition & 1 deletion tests/bidsTests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DefinitionManager } from '../parser/definitionManager'
//const skipMap = new Map([['definition-tests', ['invalid-missing-definition-for-def', 'invalid-nested-definition']]])
const skipMap = new Map()
const runAll = true
const runMap = new Map([['duplicate-tag-tests', ['invalid-duplicate-multiple-onset']]])
const runMap = new Map([['delay-tests', ['delay-non-timeline-file']]])

describe('BIDS validation', () => {
const schemaMap = new Map([['8.3.0', undefined]])
Expand Down
56 changes: 56 additions & 0 deletions tests/testData/bidsTests.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,62 @@ export const bidsTestData = [
),
],
},
{
testname: 'delay-non-timeline-file',
explanation: 'A delay tag in not allowed in a file without a timeline',
schemaVersion: '8.3.0',
definitions: ['(Definition/Acc/#, (Acceleration/# m-per-s^2, Red))', '(Definition/MyColor, (Label/Pie))'],
sidecar: {
event_code: {
HED: {
face: '(Delay/5.0 s, (Red))',
},
},
},
eventsString: 'event_code\tHED\nn/a\t(Delay/5.0 s, (Blue))\n',
sidecarErrors: [],
tsvErrors: [
BidsHedIssue.fromHedIssue(
generateIssue('temporalTagInNonTemporalContext', {
string: '(Delay/5.0 s, (Blue))',
}),
{
path: 'delay-non-timeline-file.tsv',
relativePath: 'delay-non-timeline-file.tsv',
},
{ tsvLine: '2' },
),
],
comboErrors: [
BidsHedIssue.fromHedIssue(
generateIssue('temporalTagInNonTemporalContext', {
string: '(Delay/5.0 s, (Blue))',
}),
{
path: 'delay-non-timeline-file.tsv',
relativePath: 'delay-non-timeline-file.tsv',
},
{ tsvLine: '2' },
),
],
},
{
testname: 'duration-non-timeline-file',
explanation: 'A duration tag is allowed a file without a timeline',
schemaVersion: '8.3.0',
definitions: ['(Definition/Acc/#, (Acceleration/# m-per-s^2, Red))', '(Definition/MyColor, (Label/Pie))'],
sidecar: {
event_code: {
HED: {
face: '(Duration/5.0 s, (Red))',
},
},
},
eventsString: 'event_code\tHED\nn/a\t(Duration/5.0 s, (Blue))\n',
sidecarErrors: [],
tsvErrors: [],
comboErrors: [],
},
],
},
{
Expand Down
Loading