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

fix: Nutri-Score for olive oils with unrecognized ingredients #9247

Merged
merged 4 commits into from
Nov 7, 2023

Conversation

stephanegigandet
Copy link
Contributor

This PR:

  • fixes an issue in Tags.pm for some functions that return a property value. When the property value was 0, it was not returned.
  • simplifies and makes it more clear that for some categories we force the % of fruits/vegetables while for some other we provide default values in case we do not have ingredients
  • this fixes products like olive oils that have unrecognized ingredients (e.g. an expected way to write that it contains 100% olive oil): we force them to have 100% fruits/vegetables

@stephanegigandet stephanegigandet requested a review from a team as a code owner November 6, 2023 14:52
@github-actions github-actions bot added 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies categories 🧽 Data quality https://wiki.openfoodfacts.org/Quality 🧪 tests Food.pm Tags 🧪 unit tests Nutri-Score labels Nov 6, 2023
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@@ -35242,7 +35242,7 @@ wikidata:en:Q1163138
ciqual_food_code:en:31027
ciqual_food_name:en:Candied fruits
ciqual_food_name:fr:Fruit confit
nutriscore_without_unprocessed_fruits_vegetables_legumes:en:yes
nutriscore_category_override_for_fruits_vegetables_legumes:en: 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we any documentation on how this property works ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexgarel I'm adding a comment for it at the top of the taxonomy, where there is some doc for some properties already.

Copy link

sonarqubecloud bot commented Nov 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@aleene
Copy link
Contributor

aleene commented Nov 6, 2023

so the category defines the nutriscore. You can also let it define the ingredient (so you get the right nutriscore?).
This can be extended to all single ingredient categories. Could help as a category quality check as well: if there are more than one ingredient detected, then either the category is wrong or the ingredient.

@stephanegigandet
Copy link
Contributor Author

so the category defines the nutriscore. You can also let it define the ingredient (so you get the right nutriscore?). This can be extended to all single ingredient categories. Could help as a category quality check as well: if there are more than one ingredient detected, then either the category is wrong or the ingredient.

@aleene We already have a mechanism for that in fact (added by @benbenben2 ),
e.g. for the extra-virgin olive oils category:

<en:Olive oils
en:Extra-virgin olive oils, Extra virgin olive oil
[..]
expected_nutriscore_grade:en:c
expected_ingredients:en: en:olive-oil

@aleene
Copy link
Contributor

aleene commented Nov 7, 2023

Can't you the expected_ingredient field to calculate the nutriscore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
categories 🧽 Data quality https://wiki.openfoodfacts.org/Quality Food.pm Tags 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests 🧪 unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants