From c31ff45243857e09f86f0edb871d35c2342af947 Mon Sep 17 00:00:00 2001 From: Hardeep Date: Thu, 8 Jun 2023 10:55:25 -0400 Subject: [PATCH 1/5] Updated valdiation script for lymph_nodes_examined_method to take into account when lymph_nodes_examined_status has exception value 'unknown' --- .../lymphNodesExaminedMethod.js | 2 +- .../lymphNodesExaminedMethod.test.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/references/validationFunctions/primary_diagnosis/lymphNodesExaminedMethod.js b/references/validationFunctions/primary_diagnosis/lymphNodesExaminedMethod.js index 8076d43..2a96a87 100644 --- a/references/validationFunctions/primary_diagnosis/lymphNodesExaminedMethod.js +++ b/references/validationFunctions/primary_diagnosis/lymphNodesExaminedMethod.js @@ -29,7 +29,7 @@ const validation = () => const {$row, $name, $field} = inputs; let result = {valid: true, message: "Ok"}; - const notExamined = ['cannot be determined', 'no', 'no lymph nodes found in resected specimen', 'not applicable']; + const notExamined = ['cannot be determined', 'no', 'no lymph nodes found in resected specimen', 'not applicable', 'unknown']; /* checks for a string just consisting of whitespace */ const checkforEmpty = (entry) => {return /^\s+$/g.test(decodeURI(entry).replace(/^"(.*)"$/, '$1'))}; diff --git a/tests/primary_diagnosis/lymphNodesExaminedMethod.test.js b/tests/primary_diagnosis/lymphNodesExaminedMethod.test.js index aacfb46..2fb9ec0 100644 --- a/tests/primary_diagnosis/lymphNodesExaminedMethod.test.js +++ b/tests/primary_diagnosis/lymphNodesExaminedMethod.test.js @@ -60,6 +60,26 @@ const myUnitTests = { } ) ], + [ + 'lymph nodes examined status is unknown and lymph_nodes_examined_method is left blank', + true, + loadObjects(primary_diagnosis, + { + "lymph_nodes_examined_status": "Unknown", + "lymph_nodes_examined_method": "" + } + ) + ], + [ + 'lymph nodes examined status is unknown and lymph_nodes_examined_method is submitted', + false, + loadObjects(primary_diagnosis, + { + "lymph_nodes_examined_status": "Unknown", + "lymph_nodes_examined_method": "Imaging" + } + ) + ], [ 'lymph nodes were examined and lymph_nodes_examined_method not submitted', false, From 28b5e238a4d5f534a640392d6f039bbf2be4878f Mon Sep 17 00:00:00 2001 From: Hardeep Date: Thu, 8 Jun 2023 11:37:36 -0400 Subject: [PATCH 2/5] Updated tumour_grade validation script to take into account exception values ("unknown" and "not applicable") on tumour_grading_system --- .../validationFunctions/specimen/tumourGrade.js | 6 ++++++ tests/specimen/tumourGrade.test.js | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/references/validationFunctions/specimen/tumourGrade.js b/references/validationFunctions/specimen/tumourGrade.js index 4f92504..068a434 100644 --- a/references/validationFunctions/specimen/tumourGrade.js +++ b/references/validationFunctions/specimen/tumourGrade.js @@ -95,6 +95,12 @@ const validation = () => case 'nuclear grading system for dcis': codeList = tieredGradingList; break; + case 'unknown': + codeList = ['unknown']; + break; + case 'not applicable': + codeList = ['not applicable']; + break; } if (!codeList.includes($field.trim().toLowerCase())) { diff --git a/tests/specimen/tumourGrade.test.js b/tests/specimen/tumourGrade.test.js index 538228d..fe920ed 100644 --- a/tests/specimen/tumourGrade.test.js +++ b/tests/specimen/tumourGrade.test.js @@ -203,6 +203,22 @@ const unitTests = [ tumour_grade: 'g4' }), ], + [ + 'tumour_grading_system has an exception value of "not applicable", while tumour_grade is submitted as "G3"', + false, + loadObjects(specimen, { + tumour_grading_system: 'Not applicable', + tumour_grade: 'G3', + }), + ], + [ + 'tumour_grading_system has an exception value of "unknown", while tumour_grade is submitted as "G2"', + false, + loadObjects(specimen, { + tumour_grading_system: 'unknown', + tumour_grade: 'G2', + }), + ], // [ // 'both grade system and grade are undefined', // false, From ed30bad516a457c69476520da563b263c983c5b3 Mon Sep 17 00:00:00 2001 From: Hardeep Date: Fri, 28 Jul 2023 18:17:17 -0400 Subject: [PATCH 3/5] Added 'validationDependecy' field to each of the actual/prescribed dose fields --- schemas/chemotherapy.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schemas/chemotherapy.json b/schemas/chemotherapy.json index 8325865..d0bdb4c 100644 --- a/schemas/chemotherapy.json +++ b/schemas/chemotherapy.json @@ -103,6 +103,7 @@ "meta": { "core": true, "displayName": "Prescribed Cumulative Drug Dose", + "validationDependency": true, "dependsOn": "chemotherapy.actual_cumulative_drug_dose", "notes": "Either the 'actual_cumulative_drug_dose' or the 'prescribed_cumulative_drug_dose' field must be submitted." } @@ -120,6 +121,7 @@ "meta": { "core": true, "displayName": "Actual Cumulative Drug Dose", + "validationDependency": true, "dependsOn": "chemotherapy.prescribed_cumulative_drug_dose", "notes": "Either the 'actual_cumulative_drug_dose' or the 'prescribed_cumulative_drug_dose' field must be submitted." } From 6857a0f3ee5b370bbe0ae382de3dfaa5cb6edcbc Mon Sep 17 00:00:00 2001 From: Hardeep Date: Fri, 28 Jul 2023 18:18:46 -0400 Subject: [PATCH 4/5] Updated drugDose validation script to check 'chemotherapy_drug_dose_units' field for exception value of 'not applicable' and then check that the prescribed and actual drug dose fields are not submitted --- .../chemotherapy/drugDose.js | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/references/validationFunctions/chemotherapy/drugDose.js b/references/validationFunctions/chemotherapy/drugDose.js index 28ab234..cfc5653 100644 --- a/references/validationFunctions/chemotherapy/drugDose.js +++ b/references/validationFunctions/chemotherapy/drugDose.js @@ -33,12 +33,23 @@ const validation = () => // checks for a string just consisting of whitespace const checkforEmpty = (entry) => {return /^\s+$/g.test(decodeURI(entry).replace(/^"(.*)"$/, '$1'))}; - - if ( (!$field || $field === null || checkforEmpty($field)) && (!($row[checkField]) || $row[checkField] === null || checkforEmpty(!($row[checkField])))) { - result = { - valid: false, - message: `Either the 'actual_cumulative_drug_dose' or the 'prescribed_cumulative_drug_dose' fields must be submitted.` - }; + + // Check for when chemotherapy dose has a clinical exception value of 'not applicable' + if ($row.chemotherapy_drug_dose_units && $row.chemotherapy_drug_dose_units != null && !(checkforEmpty($row.chemotherapy_drug_dose_units)) && $row.chemotherapy_drug_dose_units.trim().toLowerCase() === 'not applicable') { + if ($field && $field != null && !(checkforEmpty($field))) { + result = { + valid: false, + message: `The '${$name}' field cannot be submitted when 'chemotherapy_drug_dose_units' = 'Not applicable'` + }; + } + } + else { + if ( (!$field || $field === null || checkforEmpty($field)) && (!($row[checkField]) || $row[checkField] === null || checkforEmpty(!($row[checkField])))) { + result = { + valid: false, + message: `Either the 'actual_cumulative_drug_dose' or the 'prescribed_cumulative_drug_dose' fields must be submitted.` + }; + } } return result; }); From 540c7fa01bf398881fa1057a631026626a34cfb0 Mon Sep 17 00:00:00 2001 From: Hardeep Date: Fri, 28 Jul 2023 18:19:44 -0400 Subject: [PATCH 5/5] added unit tests checking 'chemotherapy_drug_dose_units' for exception value of 'not applicable' and prescribed/actual drug dose field values --- tests/chemotherapy/drugDose.test.js | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/chemotherapy/drugDose.test.js b/tests/chemotherapy/drugDose.test.js index 32326c3..fe02e8e 100644 --- a/tests/chemotherapy/drugDose.test.js +++ b/tests/chemotherapy/drugDose.test.js @@ -57,6 +57,25 @@ const myUnitTests = { "prescribed_cumulative_drug_dose": 350 } ) + ], + [ + 'chemotherapy_drug_dose_units is not applicable and actual_cumulative_drug_dose is submitted', + false, + loadObjects(chemotherapy, + { + "chemotherapy_drug_dose_units": 'not applicable', + "actual_cumulative_drug_dose": 300, + } + ) + ], + [ + 'chemotherapy_drug_dose_units is not applicable and actual_cumulative_drug_dose is not submitted', + true, + loadObjects(chemotherapy, + { + "chemotherapy_drug_dose_units": 'not applicable' + } + ) ] ], 'prescribed_cumulative_drug_dose': [ @@ -88,6 +107,25 @@ const myUnitTests = { } ) ], + [ + 'chemotherapy_drug_dose_units is not applicable and prescribed_cumulative_drug_dose is submitted', + false, + loadObjects(chemotherapy, + { + "chemotherapy_drug_dose_units": 'not applicable', + "prescribed_cumulative_drug_dose": 350 + } + ) + ], + [ + 'chemotherapy_drug_dose_units is not applicable and prescribed_cumulative_drug_dose is not submitted', + true, + loadObjects(chemotherapy, + { + "chemotherapy_drug_dose_units": 'not applicable' + } + ) + ], [ 'Both cumulative_drug_dose and prescribed_cumulative_drug_dose are missing', false,