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: added error facet for sum of -ose nutriments greater than sugars #8120

Conversation

benbenben2
Copy link
Collaborator

Part to #6850 (maybe solve it)

make lint
make checks 
make cover

All make commands were successful.

About unit tests:

  • test 1: nothing given -> 0
  • test 2: sugar given only -> 0
  • test 3: fructose given only -> 0
  • test 4: sugar and fructose given (sugar > fructose) -> 0
  • test 5: sugar and fructose given (sugar < fructose) -> 1
  • test 6: sugar and fructose given (sugar = fructose) -> 0
  • test 7: sugar and all -ose given (sugar > all) -> 0
  • test 8: sugar and all -ose given (sugar < all) -> 1
  • test 9: sugar and all -ose given (sugar = all) -> 0

Remark: code is same logic as for "en:nutrition-sugars-plus-starch-greater-than-carbohydrates" (see lines above changes).

Remark: contrarily to "en:nutrition-saturated-fat-greater-than-fat" (see lines below changes), we did not start with (defined $product_ref->{nutriments}{"sugars_100g"}) ? $product_ref->{nutriments}{"sugars_100g"} : 0 because there are some products where -ose nutriments are given but NOT sugar. Hence, enforcing sugars value to be 0 when it is not defined would generate some false positives.
It seems not to be the case for fat and saturated fat: some_examples_in_mirabelle.
And it is not clear for carbohydrates: see_in_mirabelle
@CharlesNepote may be interested to look at it.

@benbenben2 benbenben2 self-assigned this Feb 18, 2023
@benbenben2 benbenben2 requested a review from a team as a code owner February 18, 2023 13:20
@github-actions github-actions bot added 🧽 Data quality https://wiki.openfoodfacts.org/Quality 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests labels Feb 18, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #8120 (655bc50) into main (dad4a8d) will increase coverage by 0.08%.
The diff coverage is 96.96%.

@@            Coverage Diff             @@
##             main    #8120      +/-   ##
==========================================
+ Coverage   45.42%   45.50%   +0.08%     
==========================================
  Files         102      102              
  Lines       20230    20261      +31     
  Branches     4628     4629       +1     
==========================================
+ Hits         9189     9220      +31     
  Misses       9943     9943              
  Partials     1098     1098              
Impacted Files Coverage Δ
lib/ProductOpener/DataQualityFood.pm 57.50% <75.00%> (+0.23%) ⬆️
tests/unit/dataqualityfood.t 81.52% <100.00%> (+4.18%) ⬆️

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

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.

Perfect, thank you!

benbenben2 and others added 2 commits February 24, 2023 18:50
typo

Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
@sonarcloud
Copy link

sonarcloud bot commented Feb 24, 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

@benbenben2 benbenben2 merged commit 6fabb9d into main Feb 24, 2023
@benbenben2 benbenben2 deleted the feat_add_quality_facet_nutrition_sum_of_nutriment_composing_sugar_greater_than_sugar branch February 24, 2023 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 Data quality https://wiki.openfoodfacts.org/Quality 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants