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

feat: Estimate Ingredient percentages from nutritional data #8025

Merged
merged 20 commits into from
May 15, 2023
Merged

Conversation

john-gom
Copy link
Contributor

What

Store the ciqual_food_code on each ingredient and calculate the number of ingredients that don't have Ciqual codes (ingredients_without_ciqual_codes_n) and list these (ingredients_without_ciqual_codes) to help prioritise updating taxonomies to have the biggest impact

New option --assign-ciqual-codes added to update_all_products.pl

Related issue(s) and discussion

@github-actions github-actions bot added API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) Attributes https://wiki.openfoodfacts.org/Product_Attributes CSS Display 🌱 Eco-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products 🥗 Ingredients 🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis 🧪 integration tests 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org update all products labels Jan 23, 2023
@john-gom john-gom linked an issue Jan 23, 2023 that may be closed by this pull request
@sonarcloud
Copy link

sonarcloud bot commented Jan 23, 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
0.0% 0.0% Duplication

@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Jan 24, 2023
@github-actions github-actions bot removed CSS Display Attributes https://wiki.openfoodfacts.org/Product_Attributes labels Apr 24, 2023
@github-actions github-actions bot removed 🧪 integration tests API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Apr 24, 2023
@github-actions github-actions bot removed Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels 🌱 Eco-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products labels Apr 24, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2023

Codecov Report

Merging #8025 (3b9d8dc) into main (3c945d8) will increase coverage by 48.53%.
The diff coverage is 94.11%.

@@            Coverage Diff            @@
##           main    #8025       +/-   ##
=========================================
+ Coverage      0   48.53%   +48.53%     
=========================================
  Files         0      114      +114     
  Lines         0    21294    +21294     
  Branches      0     4773     +4773     
=========================================
+ Hits          0    10335    +10335     
- Misses        0     9679     +9679     
- Partials      0     1280     +1280     
Impacted Files Coverage Δ
lib/ProductOpener/Ingredients.pm 90.79% <94.11%> (ø)

... and 113 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions github-actions bot removed the 💥 Merge Conflicts 💥 Merge Conflicts label Apr 25, 2023
@john-gom john-gom marked this pull request as ready for review April 26, 2023 08:47
@john-gom john-gom requested a review from a team as a code owner April 26, 2023 08:47
Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!
Just one minor request to remove the ciqual_food_code field when its value is "null"

@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label May 3, 2023
@john-gom
Copy link
Contributor Author

john-gom commented May 9, 2023

I would remove the undef, and just have a non existing field. It's what we do for all other fields, when it is undefined, we delete the field.

I was anticipating a scenario where an ingredient was incorreclty assigned to a CIQAL code in the past, so we would need to remove any existing link. Should I delete instead in this case?

@github-actions github-actions bot removed the 💥 Merge Conflicts 💥 Merge Conflicts label May 15, 2023
@sonarcloud
Copy link

sonarcloud bot commented May 15, 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

@john-gom john-gom merged commit c1ebb27 into main May 15, 2023
@john-gom john-gom deleted the issue/7918 branch May 15, 2023 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis 🥗 Ingredients 🧪 tests update all products
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Estimate Ingredient percentages from nutritional data
3 participants