Skip to content

Commit f6bd5c5

Browse files
committed
feat: Split out deprecation warning for age=="89+"
1 parent 96c2b52 commit f6bd5c5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/issues/list.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ export const bidsIssues: IssueDefinitionRecord = {
133133
reason:
134134
'A column required in a TSV file has been redefined in a sidecar file. This redefinition is being ignored.',
135135
},
136+
TSV_PSEUDO_AGE_DEPRECATED: {
137+
severity: 'warning',
138+
reason: 'Use of the value "89+" in column "age" is deprecated. Use 89 for all ages 89 and over.',
139+
},
136140
INVALID_GZIP: {
137141
severity: 'error',
138142
reason: 'The gzip file could not be decompressed. It may be corrupt or misnamed.',

src/schema/tables.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,23 @@ export function evalColumns(
257257
rule: schemaPath,
258258
}
259259

260+
const ageCheck = name == 'age'
261+
let ageWarningIssued = false
262+
260263
const column = context.columns[name] as string[]
261264
for (const [index, value] of column.entries()) {
262265
if (!checkValue(value, spec)) {
266+
if (ageCheck && value === '89+') {
267+
if (!ageWarningIssued) {
268+
ageWarningIssued = true
269+
context.dataset.issues.add({
270+
code: 'TSV_PSEUDO_AGE_DEPRECATED',
271+
location: context.path,
272+
line: index + 2,
273+
})
274+
}
275+
continue
276+
}
263277
const issueMessage = `'${value}'` +
264278
(value.match(/^\s*(NA|na|nan|NaN|n\/a)\s*$/) ? ", did you mean 'n/a'?" : '')
265279
context.dataset.issues.add({

0 commit comments

Comments
 (0)