Skip to content

Commit dc52740

Browse files
authored
Merge pull request #938 from bids-standard/allow_na
allow 'n/a' in channels status column
2 parents 8887074 + a45b4c3 commit dc52740

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bids-validator/validators/tsv/checkStatusCol.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
const Issue = require('../../utils').issues.Issue
22

3+
/**
4+
* Checks status column in a electroencephalography _channels.tsv file to
5+
* ensure its values are only * 'good', 'bad', or 'n/a'
6+
* @param {string[]} rows - Each row of a tsv file to be checked.
7+
* @param {Object} file - File of rows being checked, used for error message if
8+
* problem is found.
9+
* @param {Object[]} issues - Array of issue objects to add to if problem is
10+
* found.
11+
* @returns {null} Results of this function are stored in issues.
12+
*/
313
const checkStatusCol = function(rows, file, issues) {
414
const header = rows[0]
515
const statusColumn = header.indexOf('status')
616
if (statusColumn !== -1) {
717
for (let i = 1; i < rows.length; i++) {
818
const line = rows[i]
919
const status = line[statusColumn]
10-
if (status !== 'good' && status !== 'bad') {
20+
if (status !== 'good' && status !== 'bad' && status != 'n/a') {
1121
issues.push(
1222
new Issue({
1323
file: file,
1424
evidence: line,
1525
line: i + 1,
16-
reason: 'the status column values should either be good or bad ',
26+
reason:
27+
'the status column values should either be good, bad, or n/a',
1728
code: 125,
1829
}),
1930
)

0 commit comments

Comments
 (0)