Skip to content

Commit

Permalink
Merge pull request #392 from bcgsc/feature/DEVSU-2344-potential-chemo…
Browse files Browse the repository at this point in the history
…resistance-context

DEVSU-2344
  • Loading branch information
mathieulemieux authored Oct 17, 2024
2 parents 8d76fe8 + 29c584e commit a664414
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/api/graphkb.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const graphkbAutocomplete = async (targetType, graphkbToken, keyword = null) =>
if (targetType === 'context') {
query.target = 'Vocabulary';
query.queryType = 'ancestors';
query.filters = {name: 'therapeutic efficacy'};
query.filters = {name: 'therapeutic indicator'};
} else {
if (targetType === 'evidenceLevel') {
query.target = 'EvidenceLevel';
Expand All @@ -49,7 +49,7 @@ const graphkbAutocomplete = async (targetType, graphkbToken, keyword = null) =>
}
}

return request({
const res = await request({
url: `${uri}/query`,
method: 'POST',
body: JSON.stringify(query),
Expand All @@ -59,6 +59,19 @@ const graphkbAutocomplete = async (targetType, graphkbToken, keyword = null) =>
'Content-Type': 'application/json',
},
});

// DEVSU-2344; Filtering results for context route
// Needs to be done after the query since cannot be combined with ancestors as a subquery
if (targetType === 'context') {
res.result = res.result.filter((term) => {
return [
'resistance', 'sensitivity', 'toxicity',
].includes(term.displayName);
});
res.metadata.records = res.result.length;
}

return res;
};

/* Get IPR evidence level descriptions from GraphKB
Expand Down

0 comments on commit a664414

Please sign in to comment.