TranslatorSRI / CQS

MIT License
0 stars 3 forks source link

Some queries are returning very unusual responses #39

Closed maximusunc closed 2 months ago

maximusunc commented 2 months ago

Given the following query:

curl -X 'POST' \
  'https://cqs.ci.transltr.io/query' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "message": {
    "query_graph": {
      "nodes": {
        "sn": { "categories": ["biolink:ChemicalEntity"] },
        "on": { "categories": ["biolink:Disease"], "ids": ["MONDO:0007982"] }
      },
      "edges": {
        "t_edge": {
          "subject": "sn",
          "object": "on",
          "predicates": ["biolink:treats"],
          "knowledge_type": "inferred"
        }
      }
    }
  }
}' > cqs_response.json

It finishes very quickly, has a single knowledge_graph node, no knowledge_graph edges, and results are missing.

jdr0887 commented 2 months ago

I ran this locally and there were no knowledge_graph.edges and one knowledge_graph.node in the response. I suspected this was due to some merging problem, but that is exactly how the knowledge_graph looked from MoleProChembl. All other KPs returned no knowledge_graph data. There were no message.results. I did, however, change the code to make message.results a Some(vec![]) instead of a None by default.

jdr0887 commented 2 months ago

This is being sent to the WFR to target MolePro:

{"workflow":[{"id":"lookup","runner_parameters":{"allowlist":["infores:molepro"]}},{"id":"score"}],"message":{"query_graph":{"edges":{"e00":{"predicates":["biolink:in_clinical_trials_for"],"subject":"n00","object":"n01"}},"nodes":{"n00":{"categories":["biolink:ChemicalEntity"]},"n01":{"ids":["MONDO:0007982"],"categories":["biolink:DiseaseOrPhenotypicFeature"]}}}}}

And this is the Response per this issue:

{ "workflow": [ { "id": "lookup", "runner_parameters": { "allowlist": [ "infores:molepro" ] } }, { "id": "score", "runner_parameters": {} } ], "message": { "query_graph": { "edges": { "e00": { "predicates": [ "biolink:in_clinical_trials_for" ], "subject": "n00", "object": "n01", "attribute_constraints": [], "qualifier_constraints": [] } }, "nodes": { "n00": { "categories": [ "biolink:ChemicalEntity" ], "set_interpretation": "BATCH", "constraints": [] }, "n01": { "ids": [ "MONDO:0007982" ], "categories": [ "biolink:DiseaseOrPhenotypicFeature" ], "set_interpretation": "BATCH", "constraints": [] } } }, "knowledge_graph": { "edges": {}, "nodes": { "MONDO:0007982": { "name": "metaphyseal chondrodysplasia, Jansen type", "categories": [ "biolink:BiologicalEntity", "biolink:Disease", "biolink:DiseaseOrPhenotypicFeature", "biolink:NamedThing", "biolink:ThingWithTaxon" ], "attributes": [ { "attribute_type_id": "biolink:has_numeric_value", "original_attribute_name": "information_content", "value": 100.0, "value_type_id": "EDAM:data_0006" }, { "attribute_type_id": "biolink:same_as", "original_attribute_name": "equivalent_identifiers", "value": [ "MONDO:0007982", "DOID:0080020", "OMIM:156400", "orphanet:33067", "UMLS:C0265295", "MESH:C537564", "NCIT:C131868", "SNOMEDCT:24629003" ], "value_type_id": "EDAM:data_0006" } ], "is_set": null } } } }, "logs": [] }

maximusunc commented 2 months ago

When I send this query directly to Molepro, it does only include the one knowledge graph node (which is a little unusual, but that node is the node that was asked for, so not really an issue), and they do return an empty results list. So the issue is looking like it's coming from either WFR or CQS. The fix by @jdr0887 mentioned above should take care of this in CQS, but I'll also look to see what's going on in WFR.

maximusunc commented 2 months ago

There is an issue/nuance in WFR where the empty results are being returned as None. This is valid TRAPI and not a validation issue (though just unexpected and we're going to change it to be an empty list), but the CQS should still return an empty results list regardless as well.

jdr0887 commented 2 months ago

Closing since this is resolved.