Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source record URLs to provenance #243

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/biolink-model/common/infores-catalog-v0.2.8.json

This file was deleted.

2 changes: 1 addition & 1 deletion assets/biolink-model/common/infores-catalog-v0.2.9.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/biolink-model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ export function deprecatedPredicateToPredicateAndQualifiers(predicate) {
}

export function inforesToProvenance(infores) {
const provenance = INFORES_CATALOG[infores];
const provenance = INFORES_CATALOG[infores.id];
if (!provenance) {
return false;
}
provenance.records = infores.records;
return provenance;
}

Expand Down
7 changes: 4 additions & 3 deletions lib/trapi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function creativeAnswersToSummary (qid, answers, maxHops) {

const queryType = answerToQueryType(answers[0]);
function agentToName(agent) {
return bl.inforesToProvenance(agent).name;
return bl.inforesToProvenance({'id': agent, 'records': []}).name;
}

const [sfs, errors] = creativeAnswersToSummaryFragments(answers, nodeRules, edgeRules, maxHops);
Expand Down Expand Up @@ -589,14 +589,15 @@ function getPublications() {
}

function getPrimarySource(sources) {
for (let source of sources) {
for (let source of sources) {
const id = cmn.jsonGet(source, 'resource_id', false);
const role = cmn.jsonGet(source, 'resource_role', false);
const records = cmn.jsonGet(source, 'source_record_urls', []);
if (!role || !id) {
continue;
}
else if (role === 'primary_knowledge_source') {
return [id];
return [{'id': id, 'records': records}];
}
}

Expand Down
2 changes: 1 addition & 1 deletion utilities/node/inforesToInforesMini.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inforesEntries.forEach((inforesEntry) => {
{
inforesMini[inforesEntry.id] = {
name: inforesEntry.name || inforesEntry.id,
url: (inforesEntry.xref && inforesEntry.xref.length > 0) ? inforesEntry.xref[0] : null,
wiki: (inforesEntry.xref && inforesEntry.xref.length > 0) ? inforesEntry.xref[0] : null,
knowledge_level: cleanupKnowledgeLevel(inforesEntry['knowledge level'])
};
}
Expand Down