biothings / biothings_explorer

TRAPI service for BioThings Explorer
https://explorer.biothings.io
Apache License 2.0
10 stars 11 forks source link

using query_id for creative-mode when input ID isn't the primary one #855

Open colleenXu opened 2 months ago

colleenXu commented 2 months ago

815's fix addressed non-creative-mode queries, which is currently the main situation where BTE gets non-primary IDs in queries (other ARAs querying "Service-Provider" endpoints and not using primary IDs).

But it didn't address creative-mode queries. This is an edge-case, since right now BTE mainly receives creative-mode queries from the UI -> ARS - and the UI only sends primary IDs (relies on NameResolver). Theoretically we could get creative-mode queries w/ non-primary IDs if someone queried the ARS or BTE directly.

NeuralFlux commented 2 months ago

@colleenXu can you please add the query you tried here?

colleenXu commented 2 months ago

@NeuralFlux

Here's a quick one (runs in <20 s)

``` { "message": { "query_graph": { "nodes": { "start": { "categories": ["biolink:ChemicalEntity"], "ids": ["UNII:Y43GF64R34"] }, "end": { "categories": ["biolink:Gene"] } }, "edges": { "t_edge": { "subject": "start", "object": "end", "predicates": ["biolink:affects"], "knowledge_type": "inferred", "qualifier_constraints": [ { "qualifier_set": [ { "qualifier_type_id": "biolink:qualified_predicate", "qualifier_value": "biolink:causes" }, { "qualifier_type_id": "biolink:object_aspect_qualifier", "qualifier_value": "activity_or_abundance" }, { "qualifier_type_id": "biolink:object_direction_qualifier", "qualifier_value": "decreased" } ] } ] } } } } } ```

The starting entity is lepirudin UNII:Y43GF64R34, when the primary ID from NodeNorm is currently CHEBI:142437.

Note that NodeNorm CI is updating soon, so primary IDs might change:

Hi everybody! I'm planning to upgrade NodeNorm CI and NameLookup CI to the Guppy release this Monday, August 26 starting at 5pm ET. We should be down for around 4 hours, during which both node normalization and UI autocorrect will be down. If this is a bad time for CI to be down, please let me know and I'll reschedule! I'll provide updates to #outages.

colleenXu commented 2 months ago

@NeuralFlux Let me know if you want more. Maybe one starting with gene or starting with disease ID.

NeuralFlux commented 2 months ago

Great, thank you!

NeuralFlux commented 2 months ago

The fix from #815 is working while debugging, but looks like the result is not updating in-place here. Is this a JavaScript gotcha?

Value of result while debugging:

{
  node_bindings: {
    creativeQuerySubject: [
      {
        id: "CHEBI:142437",
        attributes: [
        ],
        query_id: "UNII:Y43GF64R34",  // successfully catching this
      },
    ],
    creativeQueryObject: [
      {
        id: "NCBIGene:2147",
        attributes: [
        ],
      },
    ],
  },
  analyses: [
    {
      resource_id: "infores:biothings-explorer",
      edge_bindings: {
        eA: [
          {
            id: "701b1490ed6dbffe714c412332892737",
            attributes: [
            ],
          },
          {
            id: "75ca9d529dab136edc273c9001f5a797",
            attributes: [
            ],
          },
          {
            id: "18756253678c8883183d857d6c606064",
            attributes: [
            ],
          },
          {
            id: "5f9c4cf6b7e1e437f1bd4c0a706d7d1d",
            attributes: [
            ],
          },
          {
            id: "3749f65d563b7f3be1d908f6147a8030",
            attributes: [
            ],
          },
        ],
      },
      score: 0.7800124849497231,
    },
  ],
}
NeuralFlux commented 2 months ago

Nvm, it was because InferredQueryHandler was not populating query_id