Skip to content

Commit

Permalink
getTherapy() on lowercases
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieulemieux committed May 28, 2024
1 parent 84615a5 commit 48a4e87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/civic/therapy.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,22 @@ const resolveTherapies = (evidenceItem) => {
*/
const getTherapy = async (conn, therapyRecord) => {
const name = therapyRecord.name.toLowerCase().trim();
const ncitId = therapyRecord.ncitId.toLowerCase().trim();

// Trying with the ncitId
if (therapyRecord.ncitId) {
if (ncitId) {
try {
return await conn.getUniqueRecordBy({
filters: [
{ source: { filters: { name: NCIT_SOURCE_DEFN.name }, target: 'Source' } },
{ sourceId: therapyRecord.ncitId },
{ sourceId: ncitId },
{ name },
],
sort: orderPreferredOntologyTerms,
target: 'Therapy',
});
} catch (err) {
logger.error(`had NCIt therapy mapping (${therapyRecord.ncitId}) named (${therapyRecord.name}) but failed to fetch from graphkb: ${err}`);
logger.error(`had NCIt therapy mapping (${ncitId}) named (${therapyRecord.name}) but failed to fetch from graphkb`);
throw err;
}
}
Expand Down

0 comments on commit 48a4e87

Please sign in to comment.