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

docs: Get the Nutri-Score #7892

Merged
merged 9 commits into from
Apr 30, 2024
19 changes: 11 additions & 8 deletions docs/api/tutorial-dev-journey.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ To identify the potential users' needs, Dave has met with some conscious consume
- **Anna** is a 25-year old New Yorker who **doesn't drink soda**, but **her nephew does**. She wants to **compare the nutrition facts of two cola brands**, and **its variants** (`diet`, `zero`, and so on) to decide which one to buy.
- **Stefano** is a 36-year old Italian who follows a **plant-based diet** and wants to **avoid the intake of palm oil**. He's looking for a **breakfast cereal brand** that does not use **palm oil** nor **additives** and has a **great nutriscore (A)**.



[]()Dev Journey 1: Comparing sodas for Anna
[]()Dev Journey 2: Finding healthy breakfast cereals for Stefano
[]()Dev Journey 3: Adding missing products
[]()Dev Journey 4: Get the Nutri-Score
[]()Dev Journey 5: Get the Eco-Score
[]()Dev Journey 6: Get ingredient related analysis on new or existing products (Nova, allergens, additives…)
### Developer journeys

- []()Dev Journey 1: <a href="docs/reference/api-tutorials/comparing-sodas-for-anna.md">Comparing sodas for Anna</a>
- []()Dev Journey 2: <a href="docs/reference/api-tutorials/finding-healthy-cereals.md">Finding healthy breakfast cereals for Stefano</a>
- []()Dev Journey 3: <a href="docs/reference/api-tutorials/adding-missing-products.md">Adding missing products</a>
- []()Dev Journey 4: <a href="docs/reference/api-tutorials/get-the-nutri-score.md">Get the Nutri-Score</a>
- []()Dev Journey 5: <a href="docs/reference/api-tutorials/get-the-eco-score.md">Get the Eco-Score</a>
- []()Dev Journey 6: <a href="docs/reference/api-tutorials/get-ingredient-related-analysis.md">Get ingredient related analysis on new or existing products (Nova, allergens, additives…)</a>
- []()Dev Journey 7: <a href="docs/reference/api-tutorials/folksonomy-engine.md
">Adding non-standard fields to a food product using Folksonomy Engine</a>
- []()Dev Journey 8: Retrieving and adding prices to products (Coming soon)
96 changes: 96 additions & 0 deletions docs/introduction/get-the-nutriscore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

### Introduction
- If you can't get the information on a specific product, you can get your user to send photos and data, that will then be processed by Open Food Facts AI and contributors to get the computed result you want to show them.
- You can implement the complete flow below so that they get immediately the result with some effort on their side.
- That will ensure user satisfaction

### Display Nutri-Score knowledge panels - All the logic below in 5 lines of code !
- The Knowledge Panels are already implemented in the Dart package
- They are simple to implement from the JSON API
- They allow you to consume present and future knowledge from Open Food Facts

### Using the official visual assets of the Nutri-Score

use the official assets to display de nutriscore. You can get v1 logos here: [NutriScore variants](https://drive.google.com/drive/u/1/folders/13SL2hgqYHSLMhYjMze9nYXV9GOdGMBgc)

### Getting ready for Nutri-Score V2
- Nutri-Score V2 has a new computation method, which now requires the ingredient list, a category, and of course the nutrition table
- It also has a transition period new logo, to indicate you are using the new computation. It is not compulsory to use it, but it will save you from a lot of questions from your users ("Do you have the new formula ?")
- You can get the new assets by contacting [email protected]. We will make them public as soon as possible.

### Manual version: Getting the Nutri-Score v1 value (we don't recommand the manual way anymore, especially with v2 around the corner)

### Data completion flow

Here are the different messages to use according to the state:

#### Add a message if we have a category but no Nutri-Score

<pre>if "en:categories-completed" in states_tags AND nutrition_grade=Null</pre>

<pre>"We could not compute an Nutri-Score for this product. It might be that the category is an exception. If you believe this is an error, you can email [email protected]"</pre>

- List of exceptions: <https://www.santepubliquefrance.fr/content/download/150262/file/QR_scientifique_technique_150421.pdf>
- You can get states with [https://world.openfoodfacts.org/api/v0/product/3414280980209.json?fields=ecoscore_grade,states_tags ](https://world.openfoodfacts.org/api/v0/product/3414280980209.json?fields=ecoscore_grade,states_tags)

#### Add a message if we have a category but no nutrition

<pre>if "en:categories-completed" in states_tags AND "en:nutrition-facts-to-be-completed" in states_tags</pre>pre>

- Prompt: "Add nutrition facts to compute the Nutri-Score"

- Add a one-click option to indicate no nutrition facts on the packaging
- "This product doesn't have nutrition facts"

#### Add a message if we have nutrition but no category

<pre>if "en:categories-to-be-completed" in states_tags AND "en:nutrition-facts-completed" in states_tags</pre>

- Prompt: "Add a category to compute the Nutri-Score"

#### Help the user add the category if it is missing

- You can use our Robotoff API to get your users to validate a prediction

- [Robotoff Questions](https://docs.google.com/document/d/1IoDy0toQrrqtWHvDYp2rEVw84Yq1J0x2pt-0RGTm7h0/edit)

#### Add a message if we have no category and no nutrition

<pre>if "en:categories-to-be-completed" in states_tags AND "en:nutrition-facts-to-be-completed" in states_tags</pre>

- Prompt: "Add nutrition facts and a category to compute the Nutri-Score"

#### Add a one-click option to indicate no nutrition facts on the packaging

- This product doesn't have nutrition facts

#### Add a message if the nutrition image is missing

<pre>if "en:nutrition-photo-to-be-selected" in states_tags OR "en:photos-to-be-uploaded" in states_tags</pre>

#### Add a message if the nutrition image is obsolete using the image refresh API

- <https://github.com/openfoodfacts/api-documentation/issues/15>

#### Add Nutri-Score disclaimers

##### a message if fibers are missing
<pre>
msgctxt "nutrition_grade_fr_fiber_warning"
msgid "Warning: the amount of fiber is not specified, their possible positive contribution to the grade could not be taken into account."
</pre>
##### a message if fruit/nuts are missing
<pre>
msgctxt "nutrition_grade_fr_no_fruits_vegetables_nuts_warning"
msgid "Warning: the amount of fruits, vegetables and nuts is not specified, their possible positive contribution to the grade could not be taken into account."
</pre>
##### a message if fruits/nuts is an estimate from ingredients
<pre>
msgctxt "nutrition_grade_fr_fruits_vegetables_nuts_estimate_warning"
msgid "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the list of ingredients: %d%"
</pre>
##### a message if fruits/nuts is an estimate from category
<pre>
msgctxt "nutrition_grade_fr_fruits_vegetables_nuts_from_category_warning"
msgid "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the category (%s) of the product: %d%"
</pre>
Loading