openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
GNU Affero General Public License v3.0
633 stars 371 forks source link

Use Ciqual database to compute nutriscore for single ingredient product #6198

Open alexgarel opened 2 years ago

alexgarel commented 2 years ago

Problem

We have some products which are made of a single ingredient.

Those products are excluded from the requirement to display nutrition facts (see Annex V (p 37) of EU regulation 1169/2011)

When producer is a small producer he may not be able to conduct such analysis, which cost are high. Because we do not have nutritional data, we do not compute nutriscore for such products and small producers feels at a disadvantage.

Describe the solution you'd like

For a lot of those products we may find the entry corresponding to ingredient in Ciqual database. Can we use it ?

I don't know though how to do it. Could it be a robotoff task ? Or a specific rule in the code ? Maybe we should apply this rule only under a certain category like "Single ingredient product" ?

Describe alternatives you've considered

No response

Additional context

No response

Number of products impacted

Don't know how to measure it.

Time per product

No response

stephanegigandet commented 2 years ago

We should not add nutrition facts from CIQUAL to the product data, but we could use it when we display it. e.g. instead of having an empty nutrition facts table, we display the CIQUAL data for the category, and we could use that data to compute the Nutri-Score.

We probably should do that only for a subset of CIQUAL categories (e.g. only the single ingredients one as you suggest).

github-actions[bot] commented 2 years ago

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

CharlesNepote commented 2 years ago

A first step could be to display the average values of the category (we already use it in the "compare to:" column when the product do have nutrition values): image

Ciqual might not be far better than our average values.

It is starting here in the product page template: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/templates/web/pages/product/product_page.tt.html#L216

The function display_nutrition_table is here: https://github.com/openfoodfacts/openfoodfacts-server/blob/92bf91f53a955e4cc83f7e91e5d438dc7229fe16/lib/ProductOpener/Display.pm#L9749

It's calling this template: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/templates/web/pages/product/includes/nutrition_facts_table.tt.html