-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
feat: New Nutri-Score formula (v2) for food (2022) and beverages (2023) - ready for review #8832
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8832 +/- ##
==========================================
- Coverage 45.54% 42.47% -3.07%
==========================================
Files 64 61 -3
Lines 19527 19421 -106
Branches 4740 4738 -2
==========================================
- Hits 8893 8250 -643
- Misses 9458 10035 +577
+ Partials 1176 1136 -40
... and 20 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
if ($is_beverage) { | ||
|
||
if ($is_water) { | ||
$grade = 'a'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a nice place to include an explanatory comment for the knowledge panel in the structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure already has the structured data with the is_water field. The comment will need to be localized, it will be loaded in the knowledge panel template.
taxonomies/categories.txt
Outdated
@@ -97765,6 +97869,8 @@ agribalyse_food_code:en:20901 | |||
ciqual_food_code:en:20901 | |||
ciqual_food_name:en:Soybean, whole grain | |||
ciqual_food_name:fr:Soja, graine entière | |||
wco_hs_heading:en: 12.01 | |||
wco_hs_code:en: 1201.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a spreadsheet somewhere where you track associations if you need help ? @stephanegigandet
taxonomies/ingredients.txt
Outdated
# eurocode_2_group_2:en: 8.25 | ||
# eurocode_2_group_3:en: 8.25.50 | ||
# are from https://web.archive.org/web/20170712020557/http://www.ianunwin.demon.co.uk/eurocode/docmn/ec99/ecmgintr.htm#MGList | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a spreadsheet somewhere where you track associations if you need help ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a spreadsheet, we could create one
@@ -1171,6 +1175,73 @@ | |||
"sodium_100g" : 0.1, | |||
"sugars_100g" : 25 | |||
}, | |||
"nutriscore" : { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does attribute receive such a detailed structure ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the attribute tests, we save the whole product, not just the attributes related fields. It's very useful to debug the attributes.
"fiber_points" : 3, | ||
"fruits_vegetables_legumes" : 100, | ||
"fruits_vegetables_legumes_points" : 5, | ||
"is_beverage" : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same Q here.
Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
…s-server into nutriscore-v2
Kudos, SonarCloud Quality Gate passed! |
What
Implement the new formula for the Nutri-Score.
At this point the new Nutri-Score is not displayed: we still compute and display the old Nutri-Score, but the new Nutri-Score is visible through the API (new "nutriscore" structure) and there are new misc facets values to compare the old and previous Nutri-Score:
Still missing
Testing
This PR has been deployed on the dev server:
you can have a look at those misc fields: https://world.openfoodfacts.dev/misc?filter=nutriscore-2021&no_cache=1
to see the new computations, look at the nutriscore field:
https://world.openfoodfacts.dev/api/v3/product/3334320010928/graines-de-lin?fields=nutriscore
Part of