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

Rounding values leads to data quality errors #10491

Open
CharlesNepote opened this issue Jun 24, 2024 · 2 comments · May be fixed by #11145
Open

Rounding values leads to data quality errors #10491

CharlesNepote opened this issue Jun 24, 2024 · 2 comments · May be fixed by #11145
Assignees
Labels
🧽 Data quality - Nutrition 🧽 Data quality https://wiki.openfoodfacts.org/Quality

Comments

@CharlesNepote
Copy link
Member

CharlesNepote commented Jun 24, 2024

https://world.openfoodfacts.org/product/0076808003901/gluten-free-rotini-barilla
image

leads to a data quality error, while it shouldn't:
image

1 + 1 g (the data entered) = 2
but 1.79 + 1.79 > 3.57 (converted values).

This should be rare, it's not a high priority.

@benbenben2
Copy link
Collaborator

Currently the formula is
Soluble fiber + insoluble fiber > fiber + 0.001

		# sum of nutriments that compose fiber can not be greater than the value of fiber
		if (
			(defined $product_ref->{nutriments}{fiber_100g})
			and (
				(
					(
						(defined $product_ref->{nutriments}{'soluble-fiber_100g'})
						? $product_ref->{nutriments}{'soluble-fiber_100g'}
						: 0
					) + (
						(defined $product_ref->{nutriments}{'insoluble-fiber_100g'})
						? $product_ref->{nutriments}{'insoluble-fiber_100g'}
						: 0
					)
				) > ($product_ref->{nutriments}{fiber_100g}) + 0.001
			)
			)
		{
			push @{$product_ref->{data_quality_errors_tags}},
				"en:nutrition-soluble-fiber-plus-insoluble-fiber-greater-than-fiber";
		}

An option might be to increase the threshold
Soluble fiber + insoluble fiber > fiber + 0.01
In your example that would not raise a dq error because it would then be equal.
What do you think?

@aleene
Copy link
Contributor

aleene commented Dec 7, 2024

Sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 Data quality - Nutrition 🧽 Data quality https://wiki.openfoodfacts.org/Quality
Projects
Status: To discuss and validate
Status: Needs review
4 participants