Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
colleenXu opened this issue Aug 3, 2023 · 7 comments
Closed
Labels
data source On Test Related changes are deployed to Test server x-bte

Comments

@colleenXu
Copy link
Collaborator

Information on the creation and deployment of this API is here: biothings/pending.api#66

@andrewsu
Copy link
Member

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
Copy link
Collaborator Author

Related infores stuff is ready but not deployed yet:

@colleenXu
Copy link
Collaborator Author

colleenXu commented Dec 27, 2023

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, based on this operation's example:

  • 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:

  • API has association-based records, yay!
  • For our operations, I've set object.nutrientAmount > 0. We then cover 4717 / 6011 records (78% of dataset) where the nutrient was actually found in the food.
  • I included some notes for fields that could be possible future edge-attributes in the yaml
  • I didn't use the more-specific "has_nutrient / nutrient_of" predicates because it wasn't clear that all the chemicals are nutrients. The FoodData Central website says "nutrient" a lot, but it also says "Provides a broad snapshot in time of the nutrients and other components found in a wide variety of foods and food products" (emphasis mine).

@colleenXu
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

@colleenXu
Copy link
Collaborator Author

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)

@colleenXu colleenXu added the On CI Related changes are deployed to CI server label Mar 7, 2024
@tokebe tokebe added On Test Related changes are deployed to Test server and removed On CI Related changes are deployed to CI server labels Mar 14, 2024
@tokebe
Copy link
Member

tokebe commented Apr 17, 2024

Deployed to Prod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data source On Test Related changes are deployed to Test server x-bte
Projects
None yet
Development

No branches or pull requests

3 participants