biothings / biothings_explorer

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

SmartAPI yaml with x-bte annotation for BioThings FoodData Central #683

Closed colleenXu closed 6 months ago

colleenXu commented 1 year ago

Information on the creation and deployment of this API is here: https://github.com/biothings/pending.api/issues/66

andrewsu commented 1 year ago

example record https://biothings.ncats.io/fooddata/association/333008-1267

{
  "_id": "333008-1267",
  "_version": 1,
  "object": {
    "chebiId": "CHEBI:140951",
    "nutrientAmount": 0.048,
    "nutrientAmountUnits": "g",
    "nutrientId": 1267,
    "nutrientName": "SFA 20:0",
    "nutrientRank": 11100
  },
  "relation": {
    "code": "A",
    "description": "Analytical",
    "nutrientMaxAmount": 0.052,
    "nutrientMedianAmount": 0.048,
    "nutrientMinAmount": 0.046,
    "sourceCode": "1",
    "sourceDescription": "Analytical or derived from analytical"
  },
  "subject": {
    "description": "Cookies, oatmeal, soft, with raisins",
    "fdcId": 333008,
    "foodCategory": "Baked Products",
    "foodOnId": "FOODON_00003294",
    "ndbNumber": 100192
  }
}
colleenXu commented 10 months ago

Related infores stuff is ready but not deployed yet:

colleenXu commented 10 months ago

Here's the SmartAPI yaml w/ x-bte annotation for BioThings FoodData Central. This yaml is registered in SmartAPI Registry.

I haven't made a PR to add this to BTE's regular use (for the config file, API_LIST variable): I'm waiting until we address the next step below and we're closer to the next release cycle to make a PR with all the KPs we want to add.

Example query

send a POST request to the api-specific endpoint, BioThings FoodData Central only. Like `http://localhost:3000/v1/smartapi/895ec14a3650ec7ad85959a2d1554e2f/query`. This works even when the KP isn't included in BTE's config Put this in the request body: It's querying with Beta-sitosterol (aka `CHEBI:27693`) ``` { "message": { "query_graph": { "nodes": { "n0": { "ids": ["CHEBI:27693"], "categories": ["biolink:SmallMolecule"] }, "n1": { "categories": ["biolink:Food"] } }, "edges": { "e01": { "subject": "n0", "object": "n1" } } } } } ``` You should get a response with this edge (from this [data in the BioThings API](https://biothings.ncats.io/fooddata/query?q=object.chebiId:%22CHEBI:27693%22%20AND%20object.nutrientAmount:%3E0), based on this [operation's example](https://github.com/NCATS-Tangerine/translator-api-registry/blob/8e6b904a0c11104450297fe32fe00003e77b3f91/fooddata_central/smartapi.yaml#L641): * subject: beta-Sitosterol (primary ID in SRI NodeNorm `PUBCHEM.COMPOUND:222284`, CHEBI in BioThings API is `CHEBI:27693`) * object: "Oil, peanut" (`FOODON:FOODON_03309857`, not recognized by SRI NodeNorm) ``` "85a6e63f1ae130c8fbb78d0906427573": { "predicate": "biolink:food_component_of", "subject": "PUBCHEM.COMPOUND:222284", "object": "FOODON:FOODON_03309857", "attributes": [], "sources": [ { "resource_id": "infores:fooddata-central", "resource_role": "primary_knowledge_source" }, { "resource_id": "infores:biothings-fooddata-central", "resource_role": "aggregator_knowledge_source", "upstream_resource_ids": [ "infores:fooddata-central" ] }, { "resource_id": "infores:service-provider-trapi", "resource_role": "aggregator_knowledge_source", "upstream_resource_ids": [ "infores:biothings-fooddata-central" ] } ] }, ```


Next steps: DONE

EDIT: this change has been deployed to all instances of pending BioThings APIs (our instance biothings.ncats.io up to ITRB prod biothings.transltr.io; we are currently using ITRB prod).

We will need to make a parser change / use post-processing on the FOODON IDs.

Biolink-model folks have told us to use the BioRegistry regex strings for ID-format, and BioRegistry shows that FOODON IDs should be 8-digit numeric. Right now our IDs all start with "FOODON_". We hadn't heard this policy clarification when we were setting up this API and wondering about the ID format.


And some small notes:

colleenXu commented 9 months ago

After discussion with Andrew yesterday, I've opened an issue for the next steps.

However, it should be fine if these next steps aren't done by the time we add this API to BTE's regular use - we can still go forward with deploying.

colleenXu commented 7 months ago

Edited the post above: the FOODON ID edit is done. So this is ready to deploy

colleenXu commented 7 months ago

Added to the PR linked above to add this to BTE's regular use (for the config file, API_LIST variable).

We'll try to get it into Translator's Lobster release (dev/CI -> Test this Friday)

tokebe commented 6 months ago

Deployed to Prod.