Skip to content
Pierre Slamich edited this page Feb 22, 2021 · 5 revisions

Questions asked in the Slack

Question - Volume to Weight conversions

Am I right to assume that servings get converted between volume and weight 1:1? Eg. 240ml will be calculated as 240g? Example: { "_id": "0071464302511" "serving_size": "8 OZA (240 ml)", "serving_size_imported": "8 OZA (240 ml)", "serving_quantity": 240, // ml "nutrition_data_per_imported": "100g", "nutrition_data_per": "100g", "nutriments": { "calcium_100g": 0.008, // g "calcium_serving": 0.019200000000000002, // 0.08*2.4 "calcium_unit": "mg", "calcium_value": 8, // mg } } Not sure how to import this data, because weight/volume conversions depend on density (eg. 1g of beer is 0.98ml, 1g of olive oil is 1.09ml) so if the nutrition data is per "100g" then the serving data can be incorrect if the serving is volume. The bigger problem is if the "nutrition_data_per": "serving", then the "nutrient_100g" values are likely to be incorrect if the serving was in volume, and we don't know also the weight of the serving. So in this case the nutrient values are actually for 100ml, instead of 100g, but currently there is no prop on the foods indicating if the nutrients are for volume instead of weight, except maybe parsing the "serving_size" string. Do you have any ideas how to best handle this?

Answer

we assume 1 g = 1 ml, it's not perfect, but it's reasonably close for most products

== Questions about the OCR == 11:25 Pierre Slamich After that, you fall back on : https://github.com/openfoodfacts/openfoodfacts-dart/blob/master/DOCUMENTATION.md#example-4--send-a-product-to-open-food-facts (edited) 11:25 and 5 for the image: https://github.com/openfoodfacts/openfoodfacts-dart/blob/master/DOCUMENTATION.md#example-5--upload-an-image-for-a-given-product (edited) 11:26 @Sébastien C here’s a simple example 11:26 https://world.openfoodfacts.org/cgi/ingredients.pl?code=13333560&id=ingredients_en&process_image=1&ocr_engine=google_cloud_vision 11:26 Sébastien C What if i use another ocr. How could i parse ingredients so they are accepted by OFF 11:27 for example if my ocr returns "Brownie" that wont be accepted by off 11:27 as ingredient 11:27 Pierre Slamich the OFF OCR is done server side, so you can skip it an use client side (on-device) OCR, and just send us the ingredients as a text string 11:28 you can send us whatever you want, sending “brownie” will be accepted New 11:28 Sébastien C ok 11:28 ingredients need to be separated by coma ? 11:28 Pierre Slamich adding warnings could be a great idea 11:28 ideally, yes 11:29 don’t remove the comas if they are here 11:29 in general, send us the ingredient list as close to the photo as possible 11:29 there’s some preprocessing when you use the server side OCR 11:30

== Gluten == Explain why we can't just mark products as gluten free Pierre Slamich Gluten presence is derived from (the ingredient lists/our ability to parse) 11:14

  • the presence of explicit No Gluten claims 11:15 so for the ingredients, we need to go back for the root 11:15 for any gluten label, we could add it in label (but the risk is that users abuse the feature to mark products as gluten free, without them actually having a gluten free label)

CSV Export

I have downloaded the database once again, using the link you provided in November. However, instead of seeing 1,5 million observations as I did in November, I now see much less (around 500k). Is the link still valid for the most updated and complete full database of Open Food Facts? If not, could you please be kind to provide us with one? If so, maybe you could help clarify why there is less observations now?

It is possible that the export was not successful at some point. It is regenerated every night.

PNNS groups

I have noticed 9 main food categories (in “pnns_groups_1”) and 37 sub-categories (in “pnns_groups_2”). I wonder in what is this classification based. A specific classification system? Also, why is there some classified as “unkown”?

Those are the categories used by the Nutri-Score team (EREN). PNNS stands for the French Programme National Nutrition et Santé. We mapped the Open Food Facts categories to the PNNS categories so that the EREN team could more easily conduct their studies. A lot of their published papers use those PNNS categories.

Similarly we are now also trying to map CIQUAL categories (used by Oqali) to the OFF categories.

Clone this wiki locally