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: add erythritol as a nutrient #7941

Merged
merged 1 commit into from
Jan 4, 2023
Merged

feat: add erythritol as a nutrient #7941

merged 1 commit into from
Jan 4, 2023

Conversation

stephanegigandet
Copy link
Contributor

This PR adds erythritol as a nutrient, and adds tests for the nutrients to energy coherency test.

Fixes #7837

@stephanegigandet stephanegigandet requested a review from a team as a code owner January 4, 2023 14:59
@github-actions github-actions bot added 🧽 Data quality https://wiki.openfoodfacts.org/Quality Food.pm 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests labels Jan 4, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 4, 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

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.

Perfect !

@alexgarel alexgarel merged commit 57e51f7 into main Jan 4, 2023
@alexgarel alexgarel deleted the erythritol branch January 4, 2023 16:15
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.

Great!

You modified the test but not the algorithm to compute energy: don't you have to subtract erythritol from polyols? Do you intend to do it after?

@@ -726,37 +726,38 @@ sub mmoll_to_unit ($value, $unit) {
'sodium', '!carbohydrates',
'-fiber', '--soluble-fiber-',
'--insoluble-fiber-', '-sugars',
'-added-sugars', '--sucrose-',
'--added-sugars', '--sucrose-',
Copy link
Member

Choose a reason for hiding this comment

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

--added-sugars: as I understand it will be displayed as a sub-category of sugars, isn't it? (Which is good I think.)

Does it have an impact on its name in the CSV export?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that makes added sugars a sub category of sugars (as displayed in USDA labels)

@stephanegigandet
Copy link
Contributor Author

You modified the test but not the algorithm to compute energy: don't you have to subtract erythritol from polyols? Do you intend to do it after?

I had done it before in fact, but it didn't work because erythritol was not in the nutrients taxonomy:

https://github.com/openfoodfacts/openfoodfacts-server/blob/main/lib/ProductOpener/DataQualityFood.pm#L527

my %energy_from_nutrients = (
	europe => {
		carbohydrates_minus_polyols => {kj => 17, kcal => 4},
		polyols_minus_erythritol => {kj => 10, kcal => 2.4},
		proteins => {kj => 17, kcal => 4},
		fat => {kj => 37, kcal => 9},
		salatrim => {kj => 25, kcal => 6},    # no corresponding nutrients in nutrient tables?
		alcohol => {kj => 29, kcal => 7},
		organic_acids => {kj => 13, kcal => 3},    # no corresponding nutrients in nutrient tables?
		fiber => {kj => 8, kcal => 2},
		erythritol => {kj => 0, kcal => 0},    # no corresponding nutrients in nutrient tables?
	},
);

I'll remove the comment about no corresponding nutrients

@CharlesNepote
Copy link
Member

I had done it before in fact, but it didn't work because erythritol was not in the nutrients taxonomy:

Yes I remember now, thanks a lot!

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 Food.pm 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Erythritol (and others?) in nutrition facts features
3 participants