Skip to content

Commit

Permalink
Merge pull request #91 from CBIIT/MVS-295
Browse files Browse the repository at this point in the history
MVS-295
  • Loading branch information
fmanuelos authored Feb 27, 2023
2 parents 8100e87 + 9647b6d commit 8f6d173
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
34 changes: 21 additions & 13 deletions server/components/caDSR.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const synchronziedLoadSynonmysfromNCIT = (ncitids, idx, next) => {
return;
}
let syn = [];
https.get(config.NCIt_url[4] + ncitids[idx], (rsp) => {
https.get(config.NCIt_url[6] + ncitids[idx], (rsp) => {
let html = '';
rsp.on('data', (dt) => {
html += dt;
Expand All @@ -309,25 +309,34 @@ const synchronziedLoadSynonmysfromNCIT = (ncitids, idx, next) => {
if (d.synonyms !== undefined) {
let tmp = {}
tmp[ncitids[idx]] = {};
tmp[ncitids[idx]].preferredName = d.preferredName;
tmp[ncitids[idx]].preferredName = d.name;
tmp[ncitids[idx]].code = d.code;
tmp[ncitids[idx]].definitions = d.definitions;
tmp[ncitids[idx]].synonyms = [];
let checker_arr = [];
d.synonyms.forEach(data => {
if(checker_arr.indexOf((data.termName+"@#$"+data.termGroup+"@#$"+data.termSource).trim().toLowerCase()) !== -1) return;
if (checker_arr.indexOf((data.name + "@#$" + data.termType + "@#$" + data.source).trim().toLowerCase()) !== -1) return;

let obj = {};
obj.termName = data.termName;
obj.termGroup = data.termGroup;
obj.termSource = data.termSource;
tmp[ncitids[idx]].synonyms.push(obj);
checker_arr.push((data.termName+"@#$"+data.termGroup+"@#$"+data.termSource).trim().toLowerCase());
obj.termName = data.name;
obj.termGroup = data.termType;
obj.termSource = data.source;
//only keep NCI synonyms
if (obj.termSource == "NCI") {
if (obj.termGroup == "PT") {
tmp[ncitids[idx]].synonyms.unshift(obj);
} else {
tmp[ncitids[idx]].synonyms.push(obj);
}
}

checker_arr.push((data.name + "@#$" + data.termType + "@#$" + data.source).trim().toLowerCase());
});
if (d.additionalProperties !== undefined) {
if (d.properties !== undefined) {
tmp[ncitids[idx]].additionalProperties = [];
d.additionalProperties.forEach(data => {
d.properties.forEach(data => {
let obj = {};
obj.name = data.name;
obj.name = data.type;
obj.value = data.value;
tmp[ncitids[idx]].additionalProperties.push(obj);
});
Expand All @@ -348,9 +357,8 @@ const synchronziedLoadSynonmysfromNCIT = (ncitids, idx, next) => {
if (ncitids.length == idx) {
return next('Success');
} else {
return next("NCIT finished number: " + idx + " of " + ncitids.length + "\n");
return next("NCIT finished number: " + idx + " of " + ncitids.length + " : " + ncitids[idx] +"\n");
}

});

}).on('error', (e) => {
Expand Down
3 changes: 2 additions & 1 deletion server/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const all = {
'http://nciws-d790.nci.nih.gov:15080/evsrestapi2/api/v1/ctrp/concept/',
'https://ncit.nci.nih.gov/ncitbrowser/pages/concept_details.jsf?dictionary=CTCAE&type=synonym&code=',
'https://evsrestapi.nci.nih.gov/evsrestapi/api/v1/ctrp/concept/',
'https://evsrestapi-stage.nci.nih.gov/evsrestapi/api/v1/conceptList?db=weekly&properties=Code,Preferred_Name,FULL_SYN,DEFINITION&concepts='
'https://evsrestapi-stage.nci.nih.gov/evsrestapi/api/v1/conceptList?db=weekly&properties=Code,Preferred_Name,FULL_SYN,DEFINITION&concepts=',
'https://api-evsrest.nci.nih.gov/api/v1/concept/ncit/'
],

// GDC searchable nodes
Expand Down
2 changes: 1 addition & 1 deletion server/data_files/gdc_values.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/data_files/ncit_details.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/service/search/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const exportMapping = (req, res) => {
tmp_data.t_t = map.term_type;
}
for(let code of map.n_c){
tmp_data.ncit_v.push(ncit_details[code] !== undefined ? ncit_details[code].pname : '');
tmp_data.ncit_v.push(ncit_details[code] !== undefined ? ncit_details[code].preferredName : '');
}
tmp_data.ncit_v = Array.isArray(tmp_data.ncit_v) ? tmp_data.ncit_v.join('|') : tmp_data.ncit_v;
}
Expand Down
7 changes: 2 additions & 5 deletions server/service/search/search.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const _ = require('lodash');
const shared = require('./shared');
const folderPath = path.join(__dirname, '..', '..', 'data');
// const git = require('nodegit');
// const Excel = require('exceljs');
var cdeData = {};
var gdcData = {};

Expand Down Expand Up @@ -785,10 +786,6 @@ const updateSynonumsNcit = (req, res) => {

res.end('Success!!');
});




};

const loadSynonyms_continue = (req, res) => {
Expand Down Expand Up @@ -1329,7 +1326,7 @@ const updateGDCDataMappings = async (req, res) => {
} else {
entry.i_c_s = "";
}
entry.term_type = "PT";
entry.term_type = "";
current_mappings[prop_id].push(entry);
}
}
Expand Down

0 comments on commit 8f6d173

Please sign in to comment.