Skip to content

Commit

Permalink
Add validation check for CT/1 having a CL ID
Browse files Browse the repository at this point in the history
  • Loading branch information
bherr2 committed Sep 6, 2023
1 parent a44835c commit 70a9c17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion asctb-api/scripts/generate-draft-validation-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function getData(draftItems) {
"Missing Uberon or CL IDs?",
"Unmapped Data found?",
"Bad Column found?",
"CT/1 has CL ID?"
],
];
const workbook = XLSX.utils.book_new();
Expand All @@ -65,7 +66,7 @@ async function getData(draftItems) {
title,
...data
.split("\n")
.slice(0, 8)
.slice(0, rows[0].length - 1)
.map((d) => {
const status = d.slice(-6);
return status === "passed" ? checkmark : crossmark;
Expand All @@ -85,6 +86,7 @@ async function getData(draftItems) {
crossmark,
crossmark,
crossmark,
crossmark,
]);
console.log(
"Invalid CSV!",
Expand Down
4 changes: 4 additions & 0 deletions asctb-api/src/functions/api.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ function checkMissingIds(column: string[], index: number, row: Row, value: strin
const colName = columnIndexToName(index-1);
warnings.add(`WARNING: Missing RDFS Label for ID ${idValue} at Column: ${colName}, Row: ${row.rowNumber+1} (Code ${WarningCode.MissingCTorAnatomy})`);
}
if (column.join('/') == 'CT/1/ID' && (!idValue || !idValue.startsWith('CL:'))) {
const colName = columnIndexToName(index);
warnings.add(`WARNING: CT/1/ID is not a CL ID (required) at Column: ${colName}, Row: ${row.rowNumber+1} (Code ${WarningCode.NoIdInCT1})`);
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions asctb-api/src/utils/warnings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export enum WarningCode {
InvalidCharacter = 5,
MissingCTorAnatomy = 6,
UnmappedData = 7,
BadColumn = 8
BadColumn = 8,
NoIdInCT1 = 9
}

export const WarningLabels = {
Expand All @@ -19,5 +20,6 @@ export const WarningLabels = {
[WarningCode.InvalidCharacter]: 'Invalid Character found?',
[WarningCode.MissingCTorAnatomy]: 'Missing Uberon or CL IDs?',
[WarningCode.UnmappedData]: 'Unmapped Data found?',
[WarningCode.BadColumn]: 'Bad Column found?'
[WarningCode.BadColumn]: 'Bad Column found?',
[WarningCode.NoIdInCT1]: 'CT/1 has CL ID?',
};

0 comments on commit 70a9c17

Please sign in to comment.