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

Nutrition values for extra small serving (e.g. less than 1 g spray) cannot be extrapolated to 100g #5848

Closed
CharlesNepote opened this issue Oct 6, 2021 · 9 comments · Fixed by #8403 or #8424
Assignees
Labels
🧽 Data quality - Nutrition 🧽 Data quality https://wiki.openfoodfacts.org/Quality ✨ Feature Features or enhancements to Open Food Facts server ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.

Comments

@CharlesNepote
Copy link
Member

CharlesNepote commented Oct 6, 2021

Is your feature request related to a problem? Please describe.

As of today (2021-10) we have 149 oils that should be Nutri-Score C, at most, but which are B (0.95% of the category). Nearly all these products are sprays. Producers are displaying nutrition facts per serving. As a serving represent less than 1g (spray), all the values are 0. Eg, https://world.openfoodfacts.org/product/0077890440834/olive-oil-cooking-spray-wegmans
This has bad effects:

  • the products seem very healthy (!)
  • the Nutri-Score is wrong
  • we can't compare the products
  • etc.

Describe the solution you'd like

To be discussed

  • Nutri-Score is not shown if all values are 0 and category is different from mineral waters, etc.? + alert to the user
  • Nutri-Score not shown if product has values too different from category mean? + alert to the user
  • Values not exported (json, api, CSV) if all values are 0 and category is different from mineral waters, etc.

Number of products

@CharlesNepote CharlesNepote added the ✨ Feature Features or enhancements to Open Food Facts server label Oct 6, 2021
@stephanegigandet stephanegigandet changed the title Sprays and wrong Nutri-Score Nutrition values for extra small serving (e.g. less than 1 g spray) cannot be extrapolated to 100g Oct 11, 2021
@stephanegigandet
Copy link
Contributor

I think the right solution is to not compute per 100g values from per serving nutrition facts if the serving size is too small (e.g. 1 g or less).

@CharlesNepote
Copy link
Member Author

I think the right solution is to not compute per 100g values from per serving nutrition facts if the serving size is too small (e.g. 1 g or less)

I agree, but I think we also need:

  • to check whether the values per 1g are not given with 3 decimals (on the contrary, it could be ok)
  • to explain, probably at the beginning of the product page, why the Nutri-Score or other scores are not calculated; eg. "We cannot extrapolate values or scores for serving which are less than 1g"
  • to explain, at the beginning of the "Nutrition facts" section, that the values entered for less than 1g may not be relevant.

@CharlesNepote CharlesNepote added 🧽 Data quality https://wiki.openfoodfacts.org/Quality 🧽 Data quality - Nutrition labels Oct 12, 2021
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. label Jan 11, 2022
@john-gom
Copy link
Contributor

john-gom commented Mar 13, 2023

I did some simple queries looking for products that indicate that the nutriscore can be computed but have zero quantities of the following nutrients:

  • energy
  • carbohydrates
  • salt
  • calcium

{"misc_tags":"en:nutriscore-computed", $and: [{$or:[{"nutriments.energy":0}, {"nutriments.energy": {$exists: false}}]},{$or:[{"nutriments.carbohydrates":0}, {"nutriments.carbohydrates": {$exists: false}}]}, {$or:[{"nutriments.salt":0}, {"nutriments.salt": {$exists: false}}]}, {$or:[{"nutriments.calcium":0}, {"nutriments.calcium": {$exists: false}}]}]}

Looking at the results I'm not sure that a nutriscore should be calculated for any of them as either the serving is too small or there is is some problem with the data.

Previous comments mention still including mineral waters for nutriscore, but is this even appropriate? Would it be simpler to not calculate the nutriscore at all of key nutrients are either missing or all zero?

@john-gom
Copy link
Contributor

Could link this in to the same set of nutrients we are marking with an * in issue #7610

@john-gom john-gom self-assigned this Apr 24, 2023
@john-gom
Copy link
Contributor

john-gom commented May 8, 2023

Looking at various example it seems like one of the biggest issues is with US regulations requiring that nutrition is labelled per serving, whereas in the EU the amount per 100g/100ml must be supplied (I think!) (https://www.nutricalc.co.uk/expert-papers/rounding-nutrition-values-for-labelling/)

So, looking at the US as a worst case, Fat, say, only needs to be expressed to the nearest 0.5g for values less than 5g per portion. That means that a product that states 0g fat per serving could still have up to 0.5g fat per serving, i.e. 50% fat if the serving size is 1g. The question, therefore, is what is an acceptable range of inaccuracy? If the portion size is 10g then a fat per serving of 0g could be between 0 and 5%.

Different nutrients have different impacts on the nutriscore. For example the worst level for sugar is 45% whereas the worst for saturated fat is 10%. However, having different thresholds for different ingredients could be overly-complicated and difficult to explain to users.

Again, taking fat as an example, it feels to me that a range of 0 to 2.5% (i.e. a portion size of 5g) would be OK, although it might be clearer to stick with a whole number like 10g for the threshold.

The rule, therefore, would be that nutrients with a value of 0 (with no decimal places) won't be extrapolated for portion sizes of less than 5g/5ml (or 10g if that is preferred). This could be made more complicated, e.g. what if the fat is 0.0g with a portion size of 1g, but I think it would be easier to start simple and initially only handle the exact "0" cases.

In data terms, this would mean there would be no "_100g" figure for the nutrient that is not extrapolated, so the nutriscore calculation would not be performed and a number of tags would be added, like "en:nutrition-not-enough-data-to-compute-nutrition-score".

On the data entry screen we could maybe show a question mark, as we do at the moment, for nutrients that have not been extrapolated. We could add a warning icon below the table to explain that per serving values of "0" are not converted to 100g / 100ml values for serving sizes of 5g / 5ml or less.

@stephanegigandet @CharlesNepote what do you think of this approach?

@stephanegigandet
Copy link
Contributor

stephanegigandet commented May 9, 2023

Hi @john-gom, thanks a lot for the investigation into US rules. I think we should stick to a simpler rule: if serving size is less than 5g (or 10g), then we don't extrapolate any nutrient to 100g. Otherwise it will be very weird and difficult to understand if we have some nutrients and not others. And the fact that a nutrient is 0g doesn't make much difference I think. If fat is 1g and serving size is 5g, the 100g value could be 10.1g or 29.9g...

@aleene
Copy link
Contributor

aleene commented May 9, 2023

For completeness sake I moved the sprays outside the olive oils. Often the sprays have additional ingredients and cannot be seen as olive oils

@john-gom
Copy link
Contributor

I've changed the code to simply not calculate 100g figures from serving figures if the serving quantity <= 5. However, this looks like it would only affect around 500 products based on the following query:

[
  {
    $match:
      {
        nutrition_data: "on",
        nutrition_data_per: "serving",
        serving_quantity: {
          $ne: 0,
          $lte: 5,
        },
      },
  },
  {
    $count:
      "string",
  },
]

john-gom added a commit that referenced this issue May 22, 2023
…e = '0', fixes #5848 (#8403)

* Don't calculate 100g nutriment if serving_quantity <=5 and value = '0'

* perltidy fixes

* Don't extrapolate any ingredients if serving size is less than 5g

* Show warning against serving size

* Perltidy fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 Data quality - Nutrition 🧽 Data quality https://wiki.openfoodfacts.org/Quality ✨ Feature Features or enhancements to Open Food Facts server ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.
Projects
Archived in project
4 participants