Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Nov 4, 2024
2 parents c0560dd + 9eabfa1 commit 2a772fe
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
3 changes: 1 addition & 2 deletions src/graph/kg_edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ export default class KGEdge {
addAdditionalAttributes(name: string, value: string | string[] | TrapiAttribute[]): void {
// special handling for full edge attributes
if (name === 'edge-attributes') {
if (this.attributes[name]) this.attributes[name] = [...this.attributes[name], ...value as TrapiAttribute[]];
else this.attributes[name] = value as TrapiAttribute[];
this.attributes[name] = value as TrapiAttribute[];
return;
}

Expand Down
26 changes: 0 additions & 26 deletions src/graph/knowledge_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,35 +174,9 @@ export default class KnowledgeGraph {
});

//handle TRAPI APIs (Situation A of https://github.com/biothings/BioThings_Explorer_TRAPI/issues/208) and APIs that define 'edge-atributes' in x-bte
const seenPmids = new Set();
kgEdge.attributes['edge-attributes']?.forEach((attribute) => {
// Do not add multiple SemmedDB sentences/other "supporting study results" from the same publication
if (attribute.attribute_type_id === "biolink:has_supporting_study_result" && attribute?.attributes?.find((attr) => attr.attribute_type_id === "biolink:publications")) {
const publication = attribute.attributes.find((attr) => attr.attribute_type_id === "biolink:publications").value;
// publication has been seen or cap reached
if (seenPmids.has(publication) || seenPmids.size >= 50) {
seenPmids.add(publication);
return;
}
seenPmids.add(publication);
}

attributes.push(attribute);
});

// update evidence count after PMIDs have been merged (for SemmedDB)
if (seenPmids.size != 0) {
const evidenceAttr = attributes.find(attr => attr.attribute_type_id === 'biolink:evidence_count');
if (evidenceAttr) {
evidenceAttr.value = seenPmids.size;
} else {
attributes.push({
attribute_type_id: 'biolink:evidence_count',
value: seenPmids.size,
});
}
}

return attributes;
}

Expand Down
2 changes: 1 addition & 1 deletion src/inferred_mode/inferred_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class InferredQueryHandler {
this.CREATIVE_LIMIT = process.env.CREATIVE_LIMIT ? parseInt(process.env.CREATIVE_LIMIT) : 500;
this.CREATIVE_TIMEOUT = process.env.CREATIVE_TIMEOUT_S
? parseInt(process.env.CREATIVE_TIMEOUT) * 1000
: 4.75 * 60 * 1000;
: 4.50 * 60 * 1000;
}

get queryIsValid(): boolean {
Expand Down

0 comments on commit 2a772fe

Please sign in to comment.