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: check the specified energy matches energy computed from nutrients #7683

Merged
merged 7 commits into from
Nov 10, 2022

Conversation

stephanegigandet
Copy link
Contributor

Fixes #2429

This adds new data quality errors when the energy in kcal or in kj does not match the energy that can be computed from other nutrients.

@stephanegigandet stephanegigandet requested a review from a team as a code owner November 10, 2022 12:28
@github-actions github-actions bot added 🧽 Data quality https://wiki.openfoodfacts.org/Quality 🧪 tests labels Nov 10, 2022
@github-actions github-actions bot added 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies labels Nov 10, 2022
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


# See https://esha.com/blog/calorie-calculation-country/
# and https://eur-lex.europa.eu/legal-content/FR/TXT/HTML/?uri=CELEX:32011R1169&from=FR Appendix XIV

Copy link
Member

Choose a reason for hiding this comment

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

Adding a

	my %nutriments = $product_ref->{nutriments};

would make the code below more readable !

lib/ProductOpener/DataQualityFood.pm Show resolved Hide resolved
lib/ProductOpener/DataQualityFood.pm Show resolved Hide resolved
Copy link
Member

@CharlesNepote CharlesNepote 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.

@sonarcloud
Copy link

sonarcloud bot commented Nov 10, 2022

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

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 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests
Projects
None yet
3 participants