USDA / USDA-APIs

Do you have feedback, ideas, or questions for USDA APIs? Use this repository's Issue Tracker to join the discussion.
www.usda.gov/developer
107 stars 16 forks source link

How to get measures values in the form array using new api #94

Open ershashi1988 opened 4 years ago

ershashi1988 commented 4 years ago

Hi,

We are using previous api and will get a field measures [] values with below url. https://api.nal.usda.gov/ndb/reports/?ndbno=45167400&type=f&format=json&api_key=## measures": [ { "label": "MUFFINS", "eqv": 48.0, "eunit": "g", "qty": 2.0, "value": "210" } ] Mean while how to get and in which method will return the above field of value with new api

littlebunch commented 4 years ago

For FDC "Branded" foods, I think you can calculate a 100 g (or ml) equivalent "measures" value as (servingSize * foodNutrient.amount)/100. So, using your example, the servingSize is 55, the amount for nutrient 606, Fatty acids, total saturated is .91 (100g equivalent). Thus, the 100 g equivalent for the "55GM" serving size ("measure") is .5 g. Note, unlike SR Legacy, there is only one servingSize per each Branded food.

I'm not sure about the other food types but you can always contact the Food Data Central help desk for further details. HTH