Skip to content

Commit

Permalink
(deno) TSV type check overhaul. (#1987)
Browse files Browse the repository at this point in the history
* Modify tsv column value type checks to use user defined types if specified in sidecar and schema rules for that column are in the 'json schema' defined style outlined in bids-standard/bids-specification#1838

* Fix merge

* Remove unused ts error suppression

* missed a merge markers

* Update bids-validator/src/schema/applyRules.ts

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

---------

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
  • Loading branch information
rwblair and effigies authored Jun 7, 2024
1 parent 5b7a364 commit aa76b84
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 209 deletions.
94 changes: 52 additions & 42 deletions bids-validator/src/issues/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IssueDefinitionRecord } from '../types/issues.ts'
import { IssueDefinitionRecord } from "../types/issues.ts";

export const filenameIssues: IssueDefinitionRecord = {
MISSING_DATASET_DESCRIPTION: {
Expand All @@ -7,93 +7,103 @@ export const filenameIssues: IssueDefinitionRecord = {
'A dataset_description.json file is required in the root of the dataset',
},
INVALID_ENTITY_LABEL: {
severity: 'error',
severity: "error",
reason:
"entity label doesn't match format found for files with this suffix",
},
ENTITY_WITH_NO_LABEL: {
severity: 'error',
reason: 'Found an entity with no label.',
severity: "error",
reason: "Found an entity with no label.",
},
MISSING_REQUIRED_ENTITY: {
severity: 'error',
reason: 'Missing required entity for files with this suffix.',
severity: "error",
reason: "Missing required entity for files with this suffix.",
},
ENTITY_NOT_IN_RULE: {
severity: 'error',
severity: "error",
reason:
'Entity not listed as required or optional for files with this suffix',
"Entity not listed as required or optional for files with this suffix",
},
DATATYPE_MISMATCH: {
severity: 'error',
severity: "error",
reason:
'The datatype directory does not match datatype of found suffix and extension',
"The datatype directory does not match datatype of found suffix and extension",
},
ALL_FILENAME_RULES_HAVE_ISSUES: {
severity: 'error',
severity: "error",
reason:
'Multiple filename rules were found as potential matches. All of them had at least one issue during filename validation.',
"Multiple filename rules were found as potential matches. All of them had at least one issue during filename validation.",
},
EXTENSION_MISMATCH: {
severity: 'error',
severity: "error",
reason:
'Extension used by file does not match allowed extensions for its suffix',
"Extension used by file does not match allowed extensions for its suffix",
},
JSON_KEY_REQUIRED: {
severity: 'error',
severity: "error",
reason: "A data file's JSON sidecar is missing a key listed as required.",
},
JSON_KEY_RECOMMENDED: {
severity: 'warning',
reason: 'A data files JSON sidecar is missing a key listed as recommended.',
severity: "warning",
reason: "A data files JSON sidecar is missing a key listed as recommended.",
},
TSV_ERROR: {
severity: 'error',
reason: 'generic place holder for errors from tsv files',
severity: "error",
reason: "generic place holder for errors from tsv files",
},
TSV_COLUMN_MISSING: {
severity: 'error',
reason: 'A required column is missing',
severity: "error",
reason: "A required column is missing",
},
TSV_COLUMN_ORDER_INCORRECT: {
severity: 'error',
reason: 'Some TSV columns are in the incorrect order',
severity: "error",
reason: "Some TSV columns are in the incorrect order",
},
TSV_ADDITIONAL_COLUMNS_NOT_ALLOWED: {
severity: 'error',
severity: "error",
reason:
'A TSV file has extra columns which are not allowed for its file type',
"A TSV file has extra columns which are not allowed for its file type",
},
TSV_INDEX_VALUE_NOT_UNIQUE: {
severity: 'error',
severity: "error",
reason:
'An index column(s) was specified for the tsv file and not all of the values for it are unique.',
"An index column(s) was specified for the tsv file and not all of the values for it are unique.",
},
TSV_VALUE_INCORRECT_TYPE: {
severity: 'error',
severity: "error",
reason:
"A value in a column did match the acceptable type for that column headers specified format.",
},
TSV_VALUE_INCORRECT_TYPE_NONREQUIRED: {
severity: "warning",
reason:
'A value in a column did match the acceptable type for that column headers specified format.',
"A value in a column did match the acceptable type for that column headers specified format.",
},
TSV_COLUMN_TYPE_REDEFINED: {
severity: "warning",
reason:
"A column required in a TSV file has been redefined in a sidecar file. This redefinition is being ignored.",
},
CHECK_ERROR: {
severity: 'error',
severity: "error",
reason:
'generic place holder for errors from failed `checks` evaluated from schema.',
"generic place holder for errors from failed `checks` evaluated from schema.",
},
NOT_INCLUDED: {
severity: 'error',
severity: "error",
reason:
'Files with such naming scheme are not part of BIDS specification. This error is most commonly ' +
'caused by typos in file names that make them not BIDS compatible. Please consult the specification and ' +
'make sure your files are named correctly. If this is not a file naming issue (for example when including ' +
"Files with such naming scheme are not part of BIDS specification. This error is most commonly " +
"caused by typos in file names that make them not BIDS compatible. Please consult the specification and " +
"make sure your files are named correctly. If this is not a file naming issue (for example when including " +
'files not yet covered by the BIDS specification) you should include a ".bidsignore" file in your dataset (see' +
' https://github.com/bids-standard/bids-validator#bidsignore for details). Please ' +
'note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS ' +
'or behavioural logs in proprietary formats) should be placed in the /sourcedata folder.',
" https://github.com/bids-standard/bids-validator#bidsignore for details). Please " +
"note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS " +
"or behavioural logs in proprietary formats) should be placed in the /sourcedata folder.",
},
EMPTY_FILE: {
severity: 'error',
reason: 'Empty files not allowed.',
severity: "error",
reason: "Empty files not allowed.",
},
}
};

export const nonSchemaIssues = { ...filenameIssues }
export const nonSchemaIssues = { ...filenameIssues };
Loading

0 comments on commit aa76b84

Please sign in to comment.