Skip to content

Commit

Permalink
add hed validator issues to main issues object. Await ds level checks…
Browse files Browse the repository at this point in the history
…. add logger debug for response from hed validator
  • Loading branch information
rwblair committed Sep 26, 2023
1 parent 9a6caf9 commit f637904
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
12 changes: 6 additions & 6 deletions bids-validator/src/issues/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ const hedIssues = {
}

export const hedOldToNewLookup = {
104: hedIssues['HED_ERROR'],
105: hedIssues['HED_WARNING'],
106: hedIssues['HED_INTERNAL_ERROR'],
107: hedIssues['HED_INTERNAL_WARNING'],
108: hedIssues['HED_MISSING_VALUE_IN_SIDECAR'],
109: hedIssues['HED_VERSION_NOT_DEFINED']
104: 'HED_ERROR',
105: 'HED_WARNING',
106: 'HED_INTERNAL_ERROR',
107: 'HED_INTERNAL_WARNING',
108: 'HED_MISSING_VALUE_IN_SIDECAR',
109: 'HED_VERSION_NOT_DEFINED'
}

export const nonSchemaIssues = { ...filenameIssues, ...hedIssues }
2 changes: 1 addition & 1 deletion bids-validator/src/validators/bids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function validate(
await summary.update(context)
}
for (const check of perDSChecks) {
check(schema, dsContext, issues)
await check(schema, dsContext, issues)
}

let derivativesSummary: Record<string, ValidationResult> = {}
Expand Down
10 changes: 9 additions & 1 deletion bids-validator/src/validators/hed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import hedValidator from '../deps/hed-validator/index.js'
import { hedOldToNewLookup } from '../issues/list.ts'
import { logger } from '../utils/logger.ts'

const hedArgs = {
eventData: [],
Expand Down Expand Up @@ -80,7 +82,13 @@ export async function hedValidate(schema, dsContext, issues) {
await hedValidator.validator
.validateBidsDataset(hedDs)
.then((hedValidationIssues) => {
console.log(hedValidationIssues)
logger.debug("Issues from hed validator:")
logger.debug(hedValidationIssues)
const newStyle = hedValidationIssues.map(hedIssue => {
issues.addNonSchemaIssue(
hedOldToNewLookup[hedIssue.code], [{...hedIssue.file, evidence: hedIssue.evidence}]
)
})
})
return Promise.resolve()
}
Expand Down

0 comments on commit f637904

Please sign in to comment.