-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from bcgsc/release/v8.0.2
Release/v8.0.2
- Loading branch information
Showing
20 changed files
with
1,636 additions
and
717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { orderPreferredOntologyTerms } = require('../graphkb'); | ||
|
||
/** | ||
* Given a CIViC EvidenceItem record with its disease property, | ||
* returns the corresponding disease record from GraphKB | ||
* | ||
* @param {ApiConnection} conn graphkb API connector | ||
* @param {object} param1 | ||
* @param {object} param1.rawRecord the EvidenceItem from CIViC | ||
* @returns {object} the disease record from GraphKB | ||
*/ | ||
const getDisease = async (conn, { rawRecord }) => { | ||
let disease; | ||
|
||
// Get corresponding GraphKB Disease by it's doid (disease ontology id) | ||
if (rawRecord.disease) { | ||
let diseaseQueryFilters = {}; | ||
|
||
if (rawRecord.disease.doid) { | ||
diseaseQueryFilters = { | ||
AND: [ | ||
{ sourceId: `doid:${rawRecord.disease.doid}` }, | ||
{ source: { filters: { name: 'disease ontology' }, target: 'Source' } }, | ||
], | ||
}; | ||
} else { | ||
diseaseQueryFilters = { name: rawRecord.disease.name }; | ||
} | ||
|
||
disease = await conn.getUniqueRecordBy({ | ||
filters: diseaseQueryFilters, | ||
sort: orderPreferredOntologyTerms, | ||
target: 'Disease', | ||
}); | ||
} | ||
return disease; | ||
}; | ||
|
||
module.exports = { | ||
getDisease, | ||
}; |
Oops, something went wrong.