Skip to content

Commit

Permalink
Merge pull request #439 from icgc-argo/develop
Browse files Browse the repository at this point in the history
Data Dictionary v1.24
  • Loading branch information
lindaxiang authored Oct 1, 2024
2 parents 33172b1 + c5c1888 commit 235f94f
Show file tree
Hide file tree
Showing 9 changed files with 858 additions and 31 deletions.
1 change: 1 addition & 0 deletions references/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"St Jude staging system"
],
"drug_dose_units": ["mg/m2", "IU/m2", "ug/m2", "g/m2", "mg/kg", "mg"],
"drug_database": ["KEGG", "PubChem", "NCI Thesaurus"],
"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"],
Expand Down
125 changes: 125 additions & 0 deletions references/validationFunctions/common/drugDatabase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* Copyright (c) 2024 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 drug_rxnormcui, drug_name or drug_database, drug_id, drug_term.
*/

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

// Extract related fields from the row
const drug_rxnormcui = $row.drug_rxnormcui;
const drug_name = $row.drug_name;
const drug_database = $row.drug_database;
const drug_id = $row.drug_id;
const drug_term = $row.drug_term;

// checks for empty fields
const checkforEmpty = (entry) => {
// Check if entry is null or undefined
if (entry === null || entry === undefined) {
return true;
}
// Logic to check if the entry is an empty string or contains only whitespace
return /^\s*$/.test(decodeURI(entry).replace(/^"(.*)"$/, '$1'));
};

// Validate based on the field name
switch ($name) {
case 'drug_rxnormcui':
// If drug_rxnormcui is provided
if (!checkforEmpty($field)) {
if (checkforEmpty(drug_name)) {
result = {
valid: false,
message: `drug_name is required when drug_rxnormcui is provided.`
};
}
if (!checkforEmpty(drug_database) || !checkforEmpty(drug_id) || !checkforEmpty(drug_term) ) {
result = {
valid: false,
message: `drug_database, drug_id and drug_term should be blank when drug_rxnormcui is provided.`
};
}
} else {
// If drug_rxnormcui is not provided
if (!checkforEmpty(drug_name)) {
result = {
valid: false,
message: `drug_name should not be populated when drug_rxnormcui is not provided.`
};
}
if (checkforEmpty(drug_database) || checkforEmpty(drug_id) || checkforEmpty(drug_term) ) {
result = {
valid: false,
message: `drug_database, drug_id and drug_term must be populated when drug_rxnormcui is not provided.`
};
}
}
break;

case 'drug_name':
// If drug_rxnormcui is provided, drug_name must be populated
if (!checkforEmpty(drug_rxnormcui) && checkforEmpty($field)) {
result = {
valid: false,
message: `drug_name is required when drug_rxnormcui is provided.`
};
}
// If drug_rxnormcui is not provided, drug_name should be empty
if (checkforEmpty(drug_rxnormcui) && !checkforEmpty($field)) {
result = {
valid: false,
message: `drug_name should not be populated when drug_rxnormcui is not provided.`
};
}
break;

case 'drug_database':
case 'drug_id':
case 'drug_term':
// If drug_rxnormcui is provided, these fields should be empty
if (!checkforEmpty(drug_rxnormcui) && !checkforEmpty($field)) {
result = {
valid: false,
message: `'${$name}' should be blank when drug_rxnormcui is provided.`
};
}
// If drug_rxnormcui is not provided, these fields must be populated
if (checkforEmpty(drug_rxnormcui) && checkforEmpty($field)) {
result = {
valid: false,
message: `'${$name}' must be populated when drug_rxnormcui is not provided.`
};
}
break;

default:
break;
}

return result;
});


module.exports = validation;
3 changes: 0 additions & 3 deletions schemas/biomarker.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
"name": "test_interval",
"valueType": "integer",
"restrictions": {
"range": {
"exclusiveMin": 0
},
"script": "#/script/biomarker/intervalOrId"
},
"meta": {
Expand Down
60 changes: 54 additions & 6 deletions schemas/chemotherapy.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,75 @@
"description": "The unique RxNormID assigned to the treatment regimen drug.",
"valueType": "string",
"meta": {
"validationDependency": true,
"core": true,
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin",
"validationDependency": true,
"dependsOn": "chemotherapy.drug_database",
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin. \n\nIf the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "RxNormCUI"
},
"restrictions": {
"required": true
"script": "#/script/common/drugDatabase"
}
},
{
"name": "drug_name",
"description": "Name of agent or drug administered to donor as part of the treatment regimen.",
"valueType": "string",
"meta": {
"validationDependency": true,
"core": true,
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin",
"validationDependency": true,
"dependsOn": "chemotherapy.drug_rxnormcui",
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin. \n\nIf the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Chemotherapy Drug Name"
},
"restrictions": {
"required": true
"script": "#/script/common/drugDatabase"
}
},
{
"name": "drug_database",
"description": "Indicate the drug database where drug term is found.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "chemotherapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug Database"
},
"restrictions": {
"script": "#/script/common/drugDatabase",
"codeList": "#/list/drug_database"
}
},
{
"name": "drug_id",
"description": "Indicate the identifier from the drug_database for the drug.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "chemotherapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug ID"
},
"restrictions": {
"script": "#/script/common/drugDatabase"
}
},
{
"name": "drug_term",
"description": "Indicate the drug term as it exists in the database specified in the drug_database.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "chemotherapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug Term"
},
"restrictions": {
"script": "#/script/common/drugDatabase"
}
},
{
Expand Down
10 changes: 2 additions & 8 deletions schemas/follow_up.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@
"name": "interval_of_followup",
"valueType": "integer",
"restrictions": {
"required": true,
"range": {
"exclusiveMin": 0
}
"required": true
},
"meta": {
"core": true,
Expand Down Expand Up @@ -153,10 +150,7 @@
"name": "relapse_interval",
"valueType": "integer",
"restrictions": {
"script": "#/script/follow_up/relapse_interval",
"range": {
"exclusiveMin": 0
}
"script": "#/script/follow_up/relapse_interval"
},
"meta": {
"core": true,
Expand Down
58 changes: 54 additions & 4 deletions schemas/hormone_therapy.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@
"valueType": "string",
"meta": {
"core": true,
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin",
"validationDependency": true,
"dependsOn": "hormone_therapy.drug_database",
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin. \n\nIf the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "RxNormCUI"
},
"restrictions": {
"required": true
"script": "#/script/common/drugDatabase"
}
},
{
Expand All @@ -68,11 +70,59 @@
"valueType": "string",
"meta": {
"core": true,
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin",
"validationDependency": true,
"dependsOn": "hormone_therapy.drug_rxnormcui",
"notes": "This field uses standardized vocabulary from the RxNorm database (https://www.nlm.nih.gov/research/umls/rxnorm), provided by the NIH.\n\nYou can search for RX Norm values through the web interface (https://mor.nlm.nih.gov/RxNav/) or API (https://mor.nlm.nih.gov/download/rxnav/RxNormAPIs.html).\n\nFor example, to find the rxnormcui based on drug name, you can use: https://rxnav.nlm.nih.gov/REST/rxcui.json?name=leucovorin or https://mor.nlm.nih.gov/RxNav/search?searchBy=String&searchTerm=leucovorin. \n\nIf the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Hormone Therapy Drug Name"
},
"restrictions": {
"required": true
"script": "#/script/common/drugDatabase"
}
},
{
"name": "drug_database",
"description": "Indicate the drug database where drug term is found.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "hormone_therapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug Database"
},
"restrictions": {
"script": "#/script/common/drugDatabase",
"codeList": "#/list/drug_database"
}
},
{
"name": "drug_id",
"description": "Indicate the identifier from the drug_database for the drug.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "hormone_therapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug ID"
},
"restrictions": {
"script": "#/script/common/drugDatabase"
}
},
{
"name": "drug_term",
"description": "Indicate the drug term as it exists in the database specified in the drug_database.",
"valueType": "string",
"meta": {
"core": true,
"validationDependency": true,
"dependsOn": "hormone_therapy.drug_rxnormcui",
"notes": "If the drugs don't exist in RxNorm, please indicate drug_database, drug_id and drug_term where the drugs information can be found.",
"displayName": "Drug Term"
},
"restrictions": {
"script": "#/script/common/drugDatabase"
}
},
{
Expand Down
Loading

0 comments on commit 235f94f

Please sign in to comment.