Skip to content

Commit e1aa32a

Browse files
committed
Duration should be allowed in files without timeline
1 parent 2d74edf commit e1aa32a

File tree

5 files changed

+68
-12
lines changed

5 files changed

+68
-12
lines changed

bids/validator/tsvValidator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class BidsHedTsvValidator extends BidsValidator {
246246
_checkNoTime(elements) {
247247
const timeIssues = []
248248
for (const element of elements) {
249-
if (element.parsedHedString.tags.some((tag) => this.special.temporalTags.has(tag.schemaTag.name))) {
249+
if (element.parsedHedString.tags.some((tag) => this.special.timelineTags.has(tag.schemaTag.name))) {
250250
timeIssues.push(
251251
BidsHedIssue.fromHedIssue(
252252
generateIssue('temporalTagInNonTemporalContext', { string: element.hedString, tsvLine: element.tsvLine }),

data/json/reservedTags.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"ERROR_CODE": "DEF_INVALID",
1414
"noSpliceInGroup": false,
1515
"forbiddenSubgroupTags": [],
16-
"isTemporalTag": false,
16+
"requiresTimeline": false,
1717
"requiresDef": false,
1818
"otherAllowedNonDefTags": null
1919
},
@@ -31,7 +31,7 @@
3131
"ERROR_CODE": "DEF_EXPAND_INVALID",
3232
"noSpliceInGroup": true,
3333
"forbiddenSubgroupTags": ["Def", "Def-expand"],
34-
"isTemporalTag": false,
34+
"requiresTimeline": false,
3535
"requiresDef": false,
3636
"otherAllowedNonDefTags": []
3737
},
@@ -49,7 +49,7 @@
4949
"ERROR_CODE": "DEFINITION_INVALID",
5050
"noSpliceInGroup": true,
5151
"forbiddenSubgroupTags": ["Def", "Def-expand"],
52-
"isTemporalTag": false,
52+
"requiresTimeline": false,
5353
"requiresDef": false,
5454
"otherAllowedNonDefTags": []
5555
},
@@ -67,7 +67,7 @@
6767
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
6868
"noSpliceInGroup": false,
6969
"forbiddenSubgroupTags": [],
70-
"isTemporalTag": true,
70+
"requiresTimeline": true,
7171
"requiresDef": false,
7272
"otherAllowedNonDefTags": ["Duration", "Onset", "Offset", "Inset"]
7373
},
@@ -85,7 +85,7 @@
8585
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
8686
"noSpliceInGroup": false,
8787
"forbiddenSubgroupTags": [],
88-
"isTemporalTag": true,
88+
"requiresTimeline": false,
8989
"requiresDef": false,
9090
"otherAllowedNonDefTags": ["Delay"]
9191
},
@@ -103,7 +103,7 @@
103103
"ERROR_CODE": "TAG_GROUP_ERROR",
104104
"noSpliceInGroup": true,
105105
"forbiddenSubgroupTags": [],
106-
"isTemporalTag": false,
106+
"requiresTimeline": false,
107107
"requiresDef": false,
108108
"otherAllowedNonDefTags": []
109109
},
@@ -121,7 +121,7 @@
121121
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
122122
"noSpliceInGroup": false,
123123
"forbiddenSubgroupTags": [],
124-
"isTemporalTag": true,
124+
"requiresTimeline": true,
125125
"requiresDef": true,
126126
"otherAllowedNonDefTags": ["Delay"]
127127
},
@@ -139,7 +139,7 @@
139139
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
140140
"noSpliceInGroup": false,
141141
"forbiddenSubgroupTags": [],
142-
"isTemporalTag": true,
142+
"requiresTimeline": true,
143143
"requiresDef": true,
144144
"otherAllowedNonDefTags": ["Delay"]
145145
},
@@ -157,7 +157,7 @@
157157
"ERROR_CODE": "TEMPORAL_TAG_ERROR",
158158
"noSpliceInGroup": false,
159159
"forbiddenSubgroupTags": [],
160-
"isTemporalTag": true,
160+
"requiresTimeline": true,
161161
"requiresDef": true,
162162
"otherAllowedNonDefTags": ["Delay"]
163163
}

parser/reservedChecker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ReservedChecker {
3131
this.requiresDefTags = ReservedChecker._getSpecialTagsByProperty('requiresDef')
3232
this.groupTags = ReservedChecker._getSpecialTagsByProperty('tagGroup')
3333
this.exclusiveTags = ReservedChecker._getSpecialTagsByProperty('exclusive')
34-
this.temporalTags = ReservedChecker._getSpecialTagsByProperty('isTemporalTag')
34+
this.timelineTags = ReservedChecker._getSpecialTagsByProperty('requiresTimeline')
3535
this.noSpliceInGroup = ReservedChecker._getSpecialTagsByProperty('noSpliceInGroup')
3636
this.hasForbiddenSubgroupTags = new Set(
3737
[...ReservedChecker.reservedMap.values()]

tests/bidsTests.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { DefinitionManager } from '../parser/definitionManager'
1414
//const skipMap = new Map([['definition-tests', ['invalid-missing-definition-for-def', 'invalid-nested-definition']]])
1515
const skipMap = new Map()
1616
const runAll = true
17-
const runMap = new Map([['duplicate-tag-tests', ['invalid-duplicate-multiple-onset']]])
17+
const runMap = new Map([['delay-tests', ['delay-non-timeline-file']]])
1818

1919
describe('BIDS validation', () => {
2020
const schemaMap = new Map([['8.3.0', undefined]])

tests/testData/bidsTests.data.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,62 @@ export const bidsTestData = [
17141714
),
17151715
],
17161716
},
1717+
{
1718+
testname: 'delay-non-timeline-file',
1719+
explanation: 'A delay tag in not allowed in a file without a timeline',
1720+
schemaVersion: '8.3.0',
1721+
definitions: ['(Definition/Acc/#, (Acceleration/# m-per-s^2, Red))', '(Definition/MyColor, (Label/Pie))'],
1722+
sidecar: {
1723+
event_code: {
1724+
HED: {
1725+
face: '(Delay/5.0 s, (Red))',
1726+
},
1727+
},
1728+
},
1729+
eventsString: 'event_code\tHED\nn/a\t(Delay/5.0 s, (Blue))\n',
1730+
sidecarErrors: [],
1731+
tsvErrors: [
1732+
BidsHedIssue.fromHedIssue(
1733+
generateIssue('temporalTagInNonTemporalContext', {
1734+
string: '(Delay/5.0 s, (Blue))',
1735+
}),
1736+
{
1737+
path: 'delay-non-timeline-file.tsv',
1738+
relativePath: 'delay-non-timeline-file.tsv',
1739+
},
1740+
{ tsvLine: '2' },
1741+
),
1742+
],
1743+
comboErrors: [
1744+
BidsHedIssue.fromHedIssue(
1745+
generateIssue('temporalTagInNonTemporalContext', {
1746+
string: '(Delay/5.0 s, (Blue))',
1747+
}),
1748+
{
1749+
path: 'delay-non-timeline-file.tsv',
1750+
relativePath: 'delay-non-timeline-file.tsv',
1751+
},
1752+
{ tsvLine: '2' },
1753+
),
1754+
],
1755+
},
1756+
{
1757+
testname: 'duration-non-timeline-file',
1758+
explanation: 'A duration tag is allowed a file without a timeline',
1759+
schemaVersion: '8.3.0',
1760+
definitions: ['(Definition/Acc/#, (Acceleration/# m-per-s^2, Red))', '(Definition/MyColor, (Label/Pie))'],
1761+
sidecar: {
1762+
event_code: {
1763+
HED: {
1764+
face: '(Duration/5.0 s, (Red))',
1765+
},
1766+
},
1767+
},
1768+
eventsString: 'event_code\tHED\nn/a\t(Duration/5.0 s, (Blue))\n',
1769+
sidecarErrors: [],
1770+
tsvErrors: [],
1771+
comboErrors: [],
1772+
},
17171773
],
17181774
},
17191775
{

0 commit comments

Comments
 (0)