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
110 stars 16 forks source link

Lost conversion from volume to weight #112

Closed hht1230 closed 3 years ago

hht1230 commented 3 years ago

Thanks for making this API available and including an issues tracker. For some branded foods, there now appears to be no way to programmatically convert from a volume serving size ('ml' eg) to grams, so no way to calculate the amount of some foodNutrients per serving.

Eg, for fdcId 678080, servingSize is 240 and servingSizeUnit is "ml". If I want to calculate vitamin C per serving, I can see from foodNutrients that it is 25mg per 100g, but without knowing the weight of this OJ, I can't compute how much there is per serving from the API.

Is it possible to include a conversion factor from a volume serving size to weight for the food item in future versions of the API? It is obviously known, since you must use it to get the 100g values. Or include the foodPortions property, which was really useful, or bring back householdServingFullText and always use a serving size unit of grams.

I use the API for teaching and think it is one of the best resources for good and useful data - thanks for making it available.

KyleMcKillop-USDA commented 3 years ago

Hi @hht1230 Great Question.

So this issue will be exclusive to branded food items, as the other 3 composition datasets use only gram weights.

During the establishment of the branded foods database with the public private partnership, there was a long discussion about volume serving products. In our initial version, there was an attempt for a conversion from ml servings to grams. The issue is that for label-scanned data, this information is not on the package and therefore is not included in the data we receive. The partnership with USDA made a decision to allow per 100ml serving values to ensure that there was a larger selection of products in the branded foods dataset.

There is the possibility that the GDSN-sourced data could provide these conversions, as the data schema allows companies to provide data that is not on the label. Though GDSN-sourced data is a smaller set of our data and this would not apply to label-scanned data, I will ask this question to the partnership to see if the companies providing data through the GDSN would be willing to add this detail.

hht1230 commented 3 years ago

Thanks for the detailed reply. So can I assume that if a branded servingSizeUnit is 'ml', the foodNutrients will be per 100ml? If so, then that solves the issue for me (being able to show eg amount of vitamin C per serving)

KyleMcKillop-USDA commented 3 years ago

@hht1230 That is correct. If the servingSizeUnit is "ml", then nutrients are per 100ml.

hht1230 commented 3 years ago

@Kyle-McKillop Thanks for confirming that. I'll close this.