Closed colleenXu closed 1 year ago
Specifically interested in @tokebe's view of this idea of dropping results when the analyses.edge_binding edges reference aux-graphs...
we could decide to drop these results! (if we want data for descendant IDs, we'll include them in the batch of IDs we send and ideally get edges back with no auxiliary graph references)
Note that COHD's dev instance seems to be on TRAPI 1.4 (we can access it through the registration we currently use, but they also registered a separate yaml for TRAPI 1.4)
However, I haven't checked their /query
responses to see if they are using the aux-graph/result.analyses as we expect, and whether we can use it to develop and test our code for this issue...
From my post here: https://github.com/biothings/biothings_explorer/issues/597#issuecomment-1502686927
Deleted the previous comment (oops? should have edited or hidden it instead?).
@tokebe and I agreed to adjust the API_LIST config file rather than use SmartAPI overrides, because the names of the APIs were different between registrations.
The adjustments are in this branch https://github.com/biothings/biothings_explorer/compare/main...trapi1-4-overrides and include...
Above linked PR currently drops all KP result edges that have support graphs, per 1-on-1 discussion with @colleenXu. This might change if there's a good case in which we'd want to keep support graphs.
Note that support graphs on the result analysis are also not kept, but not used as criteria for dropping a result edge (these support graphs would typically explain result scoring, which we also don't use from TRAPI KPs).
Note that I'm not sure that CHP's TRAPI 1.4 instance is working (dev only; http://chp.thayer.dartmouth.edu/query
). When querying it directly, I'm getting either an empty response or a malformed error response. Looks like BTE is handling this somewhat...but I dunno if it could handle it more gracefully / intelligently?
BTE log example:
{
"timestamp": "2023-05-30T20:10:35.710Z",
"level": "ERROR",
"message": "call-apis: Failed POST http://chp.thayer.dartmouth.edu (1 ID): Gene > expressed_in > GrossAnatomicalStructure: (TypeError: Cannot read properties of undefined (reading 'id'))",
"code": null
},
You’re seeing this error because you have DEBUG = True
in your
Django settings file. Change that to False
, and Django will
display a standard page generated by the handler for this status code.
Background
analyses.support_graphs
should be related to its scoring, we can ignore itresult.analyses.resource_id
Overview
I use this sub-query for my example results below
``` { "message": { "query_graph": { "nodes": { "n0": { "ids":["MONDO:0005377"], "categories":["biolink:DiseaseOrPhenotypicFeature"], "name": "noonan" }, "n1": { "categories":["biolink:Gene"] } }, "edges": { "eA": { "subject": "n0", "object": "n1", "predicates": ["biolink:caused_by"] } } } } } ```Our sub-queries to TRAPI KPs are 1-hop Predict "style" TRAPI queries with batches of IDs sent in each request.
We expect two kinds of results in the TRAPI-1.4 responses (mirrors the two scenarios of #603)...
no ID/node-expansion was involved
result.analyses
, so BTE can take that object'sedge_bindings
and they should be just like theresult.edge_bindings
in TRAPI 1.3attributes
array where theattribute_type_id
is "biolink:support_graphs")example result
This is a "fake" expected result that isn't based on a real response from a TRAPI-1.4 KP... ``` { "node_bindings": { "n0": [ { "id": "MONDO:0005377" } ], "n1": [ { "id": "NCBIGene:3315" } ] }, "analyses": [ { "resource_id": "infores:automat-biolink", "edge_bindings": { "eA": [ { "id": "54d9ed32bec4d12369592709e20c997f" } ] } "score": 0.8 } ] } ```ID/node-expansion was involved
READ THIS FIRST:
Notes:
result.analyses
. But the edge(s)? in that object'sedge_bindings
may reference an auxiliary graph. When this happens, we expect 1 element in theattributes
array where theattribute_type_id
is "biolink:support_graphs". Thevalue
of that Attribute object should be 1 or more keys for auxiliary-graphs...auxiliary_graphs
section of our TRAPI responseknowledge_graph.edges
section of our TRAPI responseresult.analyses.edge_bindings
. So we'd basically ignore the nested auxiliary-graphs and their edges...Examples: