-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
energy-value-in-kcal-does-not-match-value-in-kj: false positive for low values #7811
Comments
As of 2022-12-20, there are 203 products with less than 2 Kcal and less than 6.5 KJ which provide the error. There are also many products with a serving size under 2g which are probably concerned but not detected yet because the energy in Kcal is not yet filed. I made a spreadsheet to understand the impact of rounding low values. We can see that the issue occurs when Kcal is equal to 2 or below. The place to change our threshold is there: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/lib/ProductOpener/DataQualityFood.pm#L689 # check energy in kcal is ~ 4.2 energy in kj
if (
(
$product_ref->{nutriments}{"energy-kj_value"}
- < 3.7 * $product_ref->{nutriments}{"energy-kcal_value"} - 1
+ < 3.7 * $product_ref->{nutriments}{"energy-kcal_value"} - 2
)
or ($product_ref->{nutriments}{"energy-kj_value"}
- > 4.7 * $product_ref->{nutriments}{"energy-kcal_value"} + 1)
+ > 4.7 * $product_ref->{nutriments}{"energy-kcal_value"} + 2)
)
{
push @{$product_ref->{data_quality_errors_tags}}, "en:energy-value-in-kcal-does-not-match-value-in-kj";
} |
Describe the bug
https://wiki.openfoodfacts.org/Data_quality_issues_which_can%27t_be_fixed#When_energy_values_are_low_.281-10_Kcal.29
When energy values are low (1-10 Kcal?), there are often matching issues between the energy in Kcal and KJ. This often because producers are rounding the values.
Eg. https://world.openfoodfacts.org/product/3502110008459: In this example, 1 Kcal (rounded) => 6 KJ. Because 6 / 4.2 = 1.428, the producer is probably rounding 1.42 to 1.
see also:
Expected behavior
This should be a warning and not an error.
The text was updated successfully, but these errors were encountered: