Skip to content

Commit

Permalink
Merge pull request #397 from icgc-argo/develop
Browse files Browse the repository at this point in the history
Merging develop branch into master
  • Loading branch information
hknahal authored Dec 22, 2022
2 parents c2bef4c + c61eb42 commit 7c3bc92
Show file tree
Hide file tree
Showing 33 changed files with 1,389 additions and 210 deletions.
86 changes: 80 additions & 6 deletions references/list.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"yes_no": ["Yes", "No", "Unknown"],
"yes_no_na": ["Yes", "No", "Not applicable", "Unknown"],
"yes_no": ["Yes", "No"],
"yes_no_unk": ["Yes", "No", "Unknown"],
"yes_no_na": ["Yes", "No", "Not applicable"],
"yes_no_na_unk": ["Yes", "No", "Not applicable", "Unknown"],
"exposure_usage": ["Never","Not applicable", "Unknown","Yes, currently","Yes, only in the past"],
"exposure_frequency": [
"Never",
Expand Down Expand Up @@ -29,14 +31,14 @@
"FIGO staging system",
"Lugano staging system",
"Rai staging system",
"Revised International staging system (RISS)",
"Revised International staging system (R-ISS)",
"St Jude staging system"
],
"drug_dosage_units": ["mg/m2", "IU/m2", "ug/m2", "g/m2", "mg/kg"],
"drug_dose_units": ["mg/m2", "IU/m2", "ug/m2", "g/m2", "mg/kg"],
"stage_groups": ["Occult Carcinoma", "Stage 0", "Stage 0a", "Stage 0is", "Stage 1", "Stage 1A", "Stage 1B", "Stage A", "Stage B", "Stage C", "Stage I", "Stage IA", "Stage IA1", "Stage IA2", "Stage IA3", "Stage IAB", "Stage IAE", "Stage IAES", "Stage IAS", "Stage IB", "Stage IB1", "Stage IB2", "Stage IBE", "Stage IBES", "Stage IBS", "Stage IC", "Stage IE", "Stage IEA", "Stage IEB", "Stage IES", "Stage II", "Stage II bulky", "Stage IIA", "Stage IIA1", "Stage IIA2", "Stage IIAE", "Stage IIAES", "Stage IIAS", "Stage IIB", "Stage IIBE", "Stage IIBES", "Stage IIBS", "Stage IIC", "Stage IIE", "Stage IIEA", "Stage IIEB", "Stage IIES", "Stage III", "Stage IIIA", "Stage IIIA1", "Stage IIIA2", "Stage IIIAE", "Stage IIIAES", "Stage IIIAS", "Stage IIIB", "Stage IIIBE", "Stage IIIBES", "Stage IIIBS", "Stage IIIC", "Stage IIIC1", "Stage IIIC2", "Stage IIID", "Stage IIIE", "Stage IIIES", "Stage IIIS", "Stage IIS", "Stage IS", "Stage IV", "Stage IVA", "Stage IVA1", "Stage IVA2", "Stage IVAE", "Stage IVAES", "Stage IVAS", "Stage IVB", "Stage IVBE", "Stage IVBES", "Stage IVBS", "Stage IVC", "Stage IVE", "Stage IVES", "Stage IVS", "Cannot be assessed"],
"t_categories": ["T0","T1","T1a","T1a1","T1a2","T1a(s)","T1a(m)","T1b","T1b1","T1b2","T1b(s)","T1b(m)","T1c","T1d","T1mi","T2","T2(s)","T2(m)","T2a","T2a1","T2a2","T2b","T2c","T2d","T3","T3(s)","T3(m)","T3a","T3b","T3c","T3d","T3e","T4","T4a","T4a(s)","T4a(m)","T4b","T4b(s)","T4b(m)","T4c","T4d","T4e","Ta","Tis","Tis(DCIS)","Tis(LAMN)","Tis(LCIS)","Tis(Paget)","Tis(Paget’s)","Tis pd","Tis pu","TX"],
"n_categories": ["N0","N0a","N0a (biopsy)","N0b","N0b (no biopsy)","N0(i+)","N0(i-)","N0(mol+)","N0(mol-)","N1","N1a","N1a(sn)","N1b","N1c","N1mi","N2","N2a","N2b","N2c","N2mi","N3","N3a","N3b","N3c","N4","NX"],
"m_categories": ["M0","M0(i+)","M1","M1a","M1a(0)","M1a(1)","M1b","M1b(0)","M1b(1)","M1c","M1c(0)","M1c(1)","M1d","M1d(0)","M1d(1)","M1e","MX"],
"m_categories": ["M0","M0(i+)","M1","M1a","M1a(0)","M1a(1)","M1b","M1b(0)","M1b(1)","M1c","M1c(0)","M1c(1)","M1d","M1d(0)","M1d(1)","M1e","MX", "Not applicable"],
"adverse_events": [
"Abdominal distension",
"Abdominal infection",
Expand Down Expand Up @@ -1026,5 +1028,77 @@
"Triple bypass of pancreas",
"Wedge/localised gastric resection",
"Wide Local Excision"
]
],
"primary_site": [
"Accessory sinuses",
"Adrenal gland",
"Anus and anal canal",
"Base of tongue",
"Bladder",
"Bones, joints and articular cartilage of limbs",
"Bones, joints and articular cartilage of other and unspecified sites",
"Brain",
"Breast",
"Bronchus and lung",
"Cervix uteri",
"Colon",
"Connective, subcutaneous and other soft tissues",
"Corpus uteri",
"Esophagus",
"Eye and adnexa",
"Floor of mouth",
"Gallbladder",
"Gum",
"Heart, mediastinum, and pleura",
"Hematopoietic and reticuloendothelial systems",
"Hypopharynx",
"Kidney",
"Larynx",
"Lip",
"Liver and intrahepatic bile ducts",
"Lymph nodes",
"Meninges",
"Nasal cavity and middle ear",
"Nasopharynx",
"Oropharynx",
"Other and ill-defined digestive organs",
"Other and ill-defined sites",
"Other and ill-defined sites in lip, oral cavity and pharynx",
"Other and ill-defined sites within respiratory system and intrathoracic organs",
"Other and unspecified female genital organs",
"Other and unspecified major salivary glands",
"Other and unspecified male genital organs",
"Other and unspecified parts of biliary tract",
"Other and unspecified parts of mouth",
"Other and unspecified parts of tongue",
"Other and unspecified urinary organs",
"Other endocrine glands and related structures",
"Ovary",
"Palate",
"Pancreas",
"Parotid gland",
"Penis",
"Peripheral nerves and autonomic nervous system",
"Placenta",
"Prostate gland",
"Pyriform sinus",
"Rectosigmoid junction",
"Rectum",
"Renal pelvis",
"Retroperitoneum and peritoneum",
"Skin",
"Small intestine",
"Spinal cord, cranial nerves, and other parts of central nervous system",
"Stomach",
"Testis",
"Thymus",
"Thyroid gland",
"Tonsil",
"Trachea",
"Unknown primary site",
"Ureter",
"Uterus, NOS",
"Vagina",
"Vulva"
]
}
46 changes: 46 additions & 0 deletions references/validationFunctions/chemotherapy/drugDose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
*
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0.
* You should have received a copy of the GNU Affero General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/

/**
* Requirement to submit either prescribed or actual drug dose.
*/

const validation = () =>
(function validate(inputs) {
const {$row, $name, $field} = inputs;
let result = {valid: true, message: "Ok"};
let checkField = "";

if ($name === 'actual_cumulative_drug_dose') { checkField = 'prescribed_cumulative_drug_dose'; }
else if ($name === 'prescribed_cumulative_drug_dose') { checkField = 'actual_cumulative_drug_dose'; }

// 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.`
};
}
return result;
});

module.exports = validation;
10 changes: 10 additions & 0 deletions references/validationFunctions/common/mxCategoryValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ const validation = () =>
}
}
}
if ($row[tumourStagingSystem] && $row[tumourStagingSystem] != null && !(checkforEmpty($row[tumourStagingSystem]))) {
if ($row[tumourStagingSystem].trim().toLowerCase() == "ajcc 6th edition") {
if ($field && $field != null && !(checkforEmpty($field)) && $field.trim().toLowerCase() === 'not applicable') {
result = {
valid: false,
message: `The designation of '${$field}' in the '${$name}' field is not a valid M category in the ${tumourStagingSystem} '${$row[tumourStagingSystem]}'.`
};
}
}
}
return result;
});
module.exports = validation;
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ const validation = () =>

/* checks for a string just consisting of whitespace */
const checkforEmpty = (entry) => {return /^\s+$/g.test(decodeURI(entry).replace(/^"(.*)"$/, '$1'))};

if ((!$field || checkforEmpty($field)) && (stateOfProgression(diseaseStatus) || relapseOrRecurrence)) {
result = {valid: false, message: `'${$name}' is a required field if 'disease_status_at_followup' is set a state of progression, relapse, or recurrence.` }

if ($name === 'recurrence_tumour_staging_system') {
if (!(!$field || checkforEmpty($field)) && !stateOfProgression(diseaseStatus) && !relapseOrRecurrence) {
result = {valid: false, message: `'${$name}' should not be submitted if 'disease_status_at_followup' is not a state of progression, relapse, or recurrence.` }
}
}
else if (!(!$field || checkforEmpty($field)) && !stateOfProgression(diseaseStatus) && !relapseOrRecurrence) {
result = {valid: false, message: `'${$name}' cannot be provided if 'disease_status_at_followup' is not a state of progression, relapse, or recurrence.` }
else {
if ((!$field || checkforEmpty($field)) && (stateOfProgression(diseaseStatus) || relapseOrRecurrence)) {
result = {valid: false, message: `'${$name}' is a required field if 'disease_status_at_followup' is set a state of progression, relapse, or recurrence.` }
}
else if (!(!$field || checkforEmpty($field)) && !stateOfProgression(diseaseStatus) && !relapseOrRecurrence) {
result = {valid: false, message: `'${$name}' should not be submitted if 'disease_status_at_followup' is not a state of progression, relapse, or recurrence.` }
}
}
}
return result;
Expand Down
46 changes: 46 additions & 0 deletions references/validationFunctions/hormone_therapy/drugDose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
*
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0.
* You should have received a copy of the GNU Affero General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/

/**
* Requirement to submit either prescribed or actual drug dose.
*/

const validation = () =>
(function validate(inputs) {
const {$row, $name, $field} = inputs;
let result = {valid: true, message: "Ok"};
let checkField = "";

if ($name === 'actual_cumulative_drug_dose') { checkField = 'prescribed_cumulative_drug_dose'; }
else if ($name === 'prescribed_cumulative_drug_dose') { checkField = 'actual_cumulative_drug_dose'; }

// 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.`
};
}
return result;
});

module.exports = validation;
46 changes: 46 additions & 0 deletions references/validationFunctions/immunotherapy/drugDose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
*
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0.
* You should have received a copy of the GNU Affero General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/

/**
* Requirement to submit either prescribed or actual drug dose.
*/

const validation = () =>
(function validate(inputs) {
const {$row, $name, $field} = inputs;
let result = {valid: true, message: "Ok"};
let checkField = "";

if ($name === 'actual_cumulative_drug_dose') { checkField = 'prescribed_cumulative_drug_dose'; }
else if ($name === 'prescribed_cumulative_drug_dose') { checkField = 'actual_cumulative_drug_dose'; }

// 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.`
};
}
return result;
});

module.exports = validation;
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2022 The Ontario Institute for Cancer Research. All rights reserved
*
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0.
* You should have received a copy of the GNU Affero General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/

/**
* Enforces requirement on lymph_nodes_examined_method if lymph_nodes_examined_status is 'Yes'. If 'lymph_nodes_examined_status' is any other value, then 'lymph_nodes_examined_method' should not be submitted.
* @param {object} $row
* @param {string} $field
* @param {string} $name
*/
const validation = () =>
(function validate(inputs) {
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 lymphNodesExaminedStatus = $row.lymph_nodes_examined_status.trim().toLowerCase();

/* 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)) {
if (lymphNodesExaminedStatus === 'yes') {
result = { valid: false, message: `The '${$name}' field must be submitted if the 'lymph_nodes_examined_status' field is 'Yes'`};
}
}
else {
if (notExamined.includes(lymphNodesExaminedStatus)) {
result = { valid: false, message: `The '${$name}' field should not be submitted if the 'lymph_nodes_examined_status' field is '${lymphNodesExaminedStatus}'`};
}
}
return result;
});

module.exports = validation;
Loading

0 comments on commit 7c3bc92

Please sign in to comment.