From 4f04c1985575957d9e5767dce3fd32efa0f34aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 25 Oct 2023 16:29:51 +0200 Subject: [PATCH] fix: Nutri-Score A to B threshold and olive oils (#9190) * fix A/B threshold for non fat food * fixes for olive oil and avocado oil * assume olive oil category has for ingredient olive oil --- lib/ProductOpener/Food.pm | 7 +- lib/ProductOpener/Ingredients.pm | 36 +- lib/ProductOpener/Nutriscore.pm | 31 +- .../search_v1/search-no-filter.json | 18 +- ...ies-without-ingredients-from-palm-oil.json | 18 +- ...rch-without-ingredients-from-palm-oil.json | 18 +- .../nutriscore/colza-oil.json | 2 +- .../en-apple-estimated-nutrients.json | 9 +- .../nutriscore/en-avocado-oil.json | 291 +++++++++++++ .../nutriscore/en-cherry-tomatoes.json | 332 ++++++++++++++ .../en-olive-oil-no-ingredients.json | 227 ++++++++++ .../nutriscore/en-olive-oil.json | 341 +++++++++++++++ .../nutriscore/fr-coconut-milk.json | 9 +- .../nutriscore/fr-gaspacho.json | 9 +- .../fr-mixed-oils-with-olive-oil.json | 406 ++++++++++++++++++ .../fr-plant-beverages-soy-milk.json | 153 ++++++- .../nutriscore/fr-rapeseed-oil.json | 339 +++++++++++++++ .../nutriscore/mushrooms.json | 9 +- .../nutriscore/olive-oil.json | 22 +- .../sunflower-oil-no-sugar-no-sat-fat.json | 2 +- .../nutriscore/sunflower-oil-no-sugar.json | 2 +- .../nutriscore/sunflower-oil.json | 2 +- .../nutriscore/walnut-oil.json | 2 +- tests/unit/nutriscore.t | 111 ++++- 24 files changed, 2311 insertions(+), 85 deletions(-) create mode 100644 tests/unit/expected_test_results/nutriscore/en-avocado-oil.json create mode 100644 tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json create mode 100644 tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json create mode 100644 tests/unit/expected_test_results/nutriscore/en-olive-oil.json create mode 100644 tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json create mode 100644 tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json diff --git a/lib/ProductOpener/Food.pm b/lib/ProductOpener/Food.pm index 5237f28dc06d4..658bd1a41e4f8 100644 --- a/lib/ProductOpener/Food.pm +++ b/lib/ProductOpener/Food.pm @@ -61,6 +61,7 @@ BEGIN { &is_beverage_for_nutrition_score_2021 &is_beverage_for_nutrition_score_2023 + &is_fat_oil_nuts_seeds_for_nutrition_score &is_water_for_nutrition_score &is_cheese_for_nutrition_score &is_fat_for_nutrition_score @@ -1288,6 +1289,10 @@ my @fruits_vegetables_legumes_by_category_sorted = ( ["en:canned-fruits", 90], ["en:frozen-fruits", 90], ["en:jams", 50], + # for products in the fat/oil/nuts/seeds category + ["en:avocado-oils", 100], + ["en:olive-oils", 100], + ); =head2 compute_nutriscore_2023_fruits_vegetables_legumes($product_ref, $prepared) @@ -1516,7 +1521,7 @@ sub compute_nutriscore_data ($product_ref, $prepared, $nutriments_field, $versio if ($is_fat_oil_nuts_seeds) { # Add the fat and saturated fat / fat ratio - $nutriscore_data_ref->{fat} = $nutriments_ref->{"fat" . $prepared}; + $nutriscore_data_ref->{fat} = $nutriments_ref->{"fat" . $prepared . "_100g"}; $nutriscore_data_ref->{saturated_fat_ratio} = saturated_fat_ratio($nutriments_ref, $prepared); # Compute the energy from saturates if (defined $nutriscore_data_ref->{saturated_fat}) { diff --git a/lib/ProductOpener/Ingredients.pm b/lib/ProductOpener/Ingredients.pm index c371c164085f2..d4eea679ff179 100644 --- a/lib/ProductOpener/Ingredients.pm +++ b/lib/ProductOpener/Ingredients.pm @@ -119,6 +119,7 @@ use ProductOpener::URL qw/:all/; use ProductOpener::Images qw/:all/; use ProductOpener::Lang qw/:all/; use ProductOpener::Units qw/:all/; +use ProductOpener::Food qw/is_fat_oil_nuts_seeds_for_nutrition_score/; use Encode; use Clone qw(clone); @@ -6860,7 +6861,7 @@ sub estimate_nutriscore_2021_fruits_vegetables_nuts_percent_from_ingredients ($p } -=head2 is_fruits_vegetables_legumes ( $ingredient_id, $processing = undef ) +=head2 is_fruits_vegetables_legumes ( $ingredient_id, $processing = undef) Determine if an ingredient should be counted as "fruits, vegetables, legumes" in Nutriscore 2023 algorithm. @@ -6898,6 +6899,9 @@ o 9.60 (Fruit mixtures). Pulses groups o 7.10 (Pulses). +Additionally, in the fats and oils category specifically, oils derived from ingredients in the list qualify +for the component (e.g. olive and avocado). + -- NUTRI-SCORE FREQUENTLY ASKED QUESTIONS - UPDATED 27/09/2022: @@ -6960,6 +6964,21 @@ sub is_fruits_vegetables_legumes ($ingredient_id, $processing = undef) { ); } +sub is_fruits_vegetables_legumes_for_fat_oil_nuts_seed ($ingredient_id, $processing = undef) { + + # for fat/oil/nuts/seeds products, oils of fruits and vegetables count for fruits and vegetables + return ( + is_fruits_vegetables_legumes($ingredient_id, $processing) + or ( + ( + ($ingredient_id eq "en:olive-oil") + or ($ingredient_id eq "en:avocado-oil") + ) + ) + or 0 + ); +} + =head2 estimate_nutriscore_2023_fruits_vegetables_legumes_percent_from_ingredients ( product_ref ) This function analyzes the ingredients to estimate the minimum percentage of @@ -6971,10 +6990,17 @@ Results are stored in $product_ref->{nutriments}{"fruits-vegetables-legumes-esti sub estimate_nutriscore_2023_fruits_vegetables_legumes_percent_from_ingredients ($product_ref) { - return estimate_ingredients_matching_function( - $product_ref, - \&is_fruits_vegetables_legumes, - "fruits-vegetables-legumes-estimate-from-ingredients" + # For fat/oil/nuts/seeds products, oils of fruits and vegetables count for fruits and vegetables + my $matching_function_ref; + if (is_fat_oil_nuts_seeds_for_nutrition_score($product_ref)) { + $matching_function_ref = \&is_fruits_vegetables_legumes_for_fat_oil_nuts_seed; + } + else { + $matching_function_ref = \&is_fruits_vegetables_legumes; + } + + return estimate_ingredients_matching_function($product_ref, $matching_function_ref, + "fruits-vegetables-legumes-estimate-from-ingredients", ); } diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index 7fdf13c64e5b7..b394204345a41 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -45,7 +45,7 @@ of a food product. is_water => 0, is_cheese => 0, is_fat => 1, # for 2021 version - is_fat_nuts_seed => 1, # for 2023 version + is_fat_oil_nuts_seed => 1, # for 2023 version } my ($nutriscore_score, $nutriscore_grade) = compute_nutriscore_score_and_grade( @@ -351,7 +351,7 @@ sub compute_nutriscore_score_2021 ($nutriscore_data_ref) { } } - # Special case for sugar: we need to round to 2 digits if we are closed to a threshold defined with 1 digit (e.g. 4.5) + # Special case for sugar: we need to round to 2 digits if we are close to a threshold defined with 1 digit (e.g. 4.5) # but if the threshold is defined with 0 digit (e.g. 9) we need to round with 1 digit. if ( (($nutriscore_data_ref->{"sugars_value"} - int($nutriscore_data_ref->{"sugars_value"})) > 0.9) or (($nutriscore_data_ref->{"sugars_value"} - int($nutriscore_data_ref->{"sugars_value"})) < 0.1)) @@ -547,7 +547,8 @@ sub compute_nutriscore_score_and_grade_2023 ($nutriscore_data_ref) { my $nutrition_grade = compute_nutriscore_grade_2023( $nutrition_score, $nutriscore_data_ref->{is_beverage}, - $nutriscore_data_ref->{is_water} + $nutriscore_data_ref->{is_water}, + $nutriscore_data_ref->{is_fat_oil_nuts_seeds}, ); return ($nutrition_score, $nutrition_grade); @@ -791,7 +792,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { return $score; } -sub compute_nutriscore_grade_2023 ($nutrition_score, $is_beverage, $is_water) { +sub compute_nutriscore_grade_2023 ($nutrition_score, $is_beverage, $is_water, $is_fat_oil_nuts_seeds) { my $grade = ""; @@ -799,6 +800,7 @@ sub compute_nutriscore_grade_2023 ($nutrition_score, $is_beverage, $is_water) { return ''; } + # Beverages if ($is_beverage) { if ($is_water) { @@ -817,9 +819,28 @@ sub compute_nutriscore_grade_2023 ($nutrition_score, $is_beverage, $is_water) { $grade = 'e'; } } + # Fats, oils, nuts and seeds + elsif ($is_fat_oil_nuts_seeds) { + if ($nutrition_score <= -6) { + $grade = 'a'; + } + elsif ($nutrition_score <= 2) { + $grade = 'b'; + } + elsif ($nutrition_score <= 10) { + $grade = 'c'; + } + elsif ($nutrition_score <= 18) { + $grade = 'd'; + } + else { + $grade = 'e'; + } + } + # Other foods else { - if ($nutrition_score <= -6) { + if ($nutrition_score <= -0) { $grade = 'a'; } elsif ($nutrition_score <= 2) { diff --git a/tests/integration/expected_test_results/search_v1/search-no-filter.json b/tests/integration/expected_test_results/search_v1/search-no-filter.json index f10e45401cbe3..70ed007fcc4d3 100644 --- a/tests/integration/expected_test_results/search_v1/search-no-filter.json +++ b/tests/integration/expected_test_results/search_v1/search-no-filter.json @@ -3404,9 +3404,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -3566,7 +3565,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -3577,7 +3576,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, @@ -4333,9 +4332,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -4495,7 +4493,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -4506,7 +4504,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, diff --git a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json index 2d6799897fd60..022466826515e 100644 --- a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json @@ -620,9 +620,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -782,7 +781,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -793,7 +792,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, @@ -1549,9 +1548,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -1711,7 +1709,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -1722,7 +1720,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, diff --git a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json index f10e45401cbe3..70ed007fcc4d3 100644 --- a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json @@ -3404,9 +3404,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -3566,7 +3565,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -3577,7 +3576,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, @@ -4333,9 +4332,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a", "en:packagings-number-of-components-0", "en:packagings-not-complete", "en:packagings-empty", @@ -4495,7 +4493,7 @@ "sugars" : 7.575, "sugars_points" : 2 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -4506,7 +4504,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 155.25, diff --git a/tests/unit/expected_test_results/nutriscore/colza-oil.json b/tests/unit/expected_test_results/nutriscore/colza-oil.json index 2165c10a06696..9b5cb598ebbc8 100644 --- a/tests/unit/expected_test_results/nutriscore/colza-oil.json +++ b/tests/unit/expected_test_results/nutriscore/colza-oil.json @@ -111,7 +111,7 @@ "energy" : 3760, "energy_from_saturated_fat" : 259, "energy_from_saturated_fat_points" : 2, - "fat" : null, + "fat" : 100, "fiber" : 0, "fiber_points" : 0, "fruits_vegetables_legumes" : null, diff --git a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json index 4769dbf5ad9ef..f9f9dee217e11 100644 --- a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json @@ -108,9 +108,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b" + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a" ], "nucleotides_tags" : [], "nutriments" : { @@ -245,7 +244,7 @@ "sugars" : 10.1, "sugars_points" : 3 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -256,7 +255,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 207, diff --git a/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json new file mode 100644 index 0000000000000..b4ba1fe13a4b7 --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json @@ -0,0 +1,291 @@ +{ + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], + "categories" : "avocado oil", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils", + "en:fruit-and-fruit-seed-oils", + "en:avocado-oils" + ], + "categories_lc" : "en", + "categories_properties" : { + "agribalyse_food_code:en" : "17100", + "ciqual_food_code:en" : "17100" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-17100", + "agribalyse-food-code-known", + "agribalyse-proxy-food-code-unknown", + "ciqual-food-code-17100", + "ciqual-food-code-known", + "agribalyse-known", + "agribalyse-17100" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils", + "en:fruit-and-fruit-seed-oils", + "en:avocado-oils" + ], + "food_groups" : "en:fats", + "food_groups_tags" : [ + "en:fats-and-sauces", + "en:fats" + ], + "ingredients" : [ + { + "id" : "en:avocado", + "percent_estimate" : 100, + "percent_max" : 100, + "percent_min" : 100, + "text" : "avocado", + "vegan" : "yes", + "vegetarian" : "yes" + } + ], + "ingredients_analysis" : {}, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan", + "en:vegetarian" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:avocado", + "en:vegetable", + "en:fruit-vegetable" + ], + "ingredients_n" : 1, + "ingredients_n_tags" : [ + "1", + "1-10" + ], + "ingredients_original_tags" : [ + "en:avocado" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:avocado", + "en:vegetable", + "en:fruit-vegetable" + ], + "ingredients_text" : "avocado", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 0, + "ingredients_with_specified_percent_sum" : 0, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 100, + "ingredients_without_ciqual_codes" : [ + "en:avocado" + ], + "ingredients_without_ciqual_codes_n" : 1, + "known_ingredients_n" : 3, + "lc" : "en", + "minerals_tags" : [], + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", + "en:nutriscore-2021-different-from-2023", + "en:nutriscore-2021-worse-than-2023", + "en:nutriscore-2021-c-2023-b" + ], + "nucleotides_tags" : [], + "nutriments" : { + "energy_100g" : 3448, + "fat_100g" : 91.6, + "fiber_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 100, + "nutrition-score-fr" : 7, + "nutrition-score-fr_100g" : 7, + "proteins_100g" : 0, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 16.4, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 0 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 3448, + "energy_points" : 10, + "energy_value" : 3448, + "fat" : 91.6, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 16.4, + "saturated_fat_ratio" : 17.9039301310044, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 17.9, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 7 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_more_than_7", + "energy" : 3448, + "energy_from_saturated_fat" : 606.8, + "energy_from_saturated_fat_points" : 5, + "fat" : 91.6, + "fiber" : 0, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 100, + "fruits_vegetables_legumes_points" : 5, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 1, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy_from_saturated_fat", + "sugars", + "saturated_fat_ratio", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 7, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber" + ], + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 16.4, + "saturated_fat_ratio" : 17.9039301310044, + "saturated_fat_ratio_points" : 2, + "sugars" : 0, + "sugars_points" : 0 + }, + "grade" : "b", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 2 + } + }, + "nutriscore_2021_tags" : [ + "c" + ], + "nutriscore_2023_tags" : [ + "b" + ], + "nutriscore_data" : { + "energy" : 3448, + "energy_points" : 10, + "energy_value" : 3448, + "fat" : 91.6, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "grade" : "c", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 16.4, + "saturated_fat_ratio" : 17.9039301310044, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 17.9, + "score" : 7, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "nutriscore_grade" : "c", + "nutriscore_score" : 7, + "nutriscore_score_opposite" : -7, + "nutriscore_tags" : [ + "c" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "c", + "nutrition_grades" : "c", + "nutrition_grades_tags" : [ + "c" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 100, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 100, + "other_nutritional_substances_tags" : [], + "pnns_groups_1" : "Fat and sauces", + "pnns_groups_1_tags" : [ + "fat-and-sauces", + "known" + ], + "pnns_groups_2" : "Fats", + "pnns_groups_2_tags" : [ + "fats", + "known" + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [] +} diff --git a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json new file mode 100644 index 0000000000000..8f261bef34832 --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json @@ -0,0 +1,332 @@ +{ + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], + "categories" : "cherry tomatoes", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fruits-and-vegetables-based-foods", + "en:vegetables-based-foods", + "en:tomatoes-and-their-products", + "en:tomatoes", + "en:cherry-tomatoes" + ], + "categories_lc" : "en", + "categories_properties" : { + "agribalyse_food_code:en" : "20172", + "ciqual_food_code:en" : "20172" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-20172", + "agribalyse-food-code-known", + "agribalyse-proxy-food-code-unknown", + "ciqual-food-code-20172", + "ciqual-food-code-known", + "agribalyse-known", + "agribalyse-20172" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fruits-and-vegetables-based-foods", + "en:vegetables-based-foods", + "en:tomatoes-and-their-products", + "en:tomatoes", + "en:cherry-tomatoes" + ], + "food_groups" : "en:vegetables", + "food_groups_tags" : [ + "en:fruits-and-vegetables", + "en:vegetables" + ], + "ingredients" : [ + { + "ciqual_food_code" : "20172", + "id" : "en:cherry-tomato", + "percent_estimate" : 100, + "percent_max" : 100, + "percent_min" : 100, + "text" : "cherry tomatoes", + "vegan" : "yes", + "vegetarian" : "yes" + } + ], + "ingredients_analysis" : {}, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan", + "en:vegetarian" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:cherry-tomato", + "en:vegetable", + "en:fruit-vegetable", + "en:tomato" + ], + "ingredients_n" : 1, + "ingredients_n_tags" : [ + "1", + "1-10" + ], + "ingredients_original_tags" : [ + "en:cherry-tomato" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:cherry-tomato", + "en:vegetable", + "en:fruit-vegetable", + "en:tomato" + ], + "ingredients_text" : "cherry tomatoes", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 0, + "ingredients_with_specified_percent_sum" : 0, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 100, + "ingredients_without_ciqual_codes" : [], + "ingredients_without_ciqual_codes_n" : 0, + "known_ingredients_n" : 4, + "lc" : "en", + "minerals_tags" : [], + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a" + ], + "nucleotides_tags" : [], + "nutriments" : { + "energy_100g" : 81, + "fat_100g" : 0.26, + "fiber_100g" : 1.2, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 100, + "nutrition-score-fr" : -6, + "nutrition-score-fr_100g" : -6, + "proteins_100g" : 0.86, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 0.056, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 2.48 + }, + "nutriments_estimated" : { + "alcohol_100g" : 0, + "beta-carotene_100g" : 0.00136, + "calcium_100g" : 0.0066, + "carbohydrates_100g" : 5.62, + "cholesterol_100g" : 0, + "copper_100g" : 5e-05, + "energy-kcal_100g" : 33.7, + "energy-kj_100g" : 142, + "energy_100g" : 142, + "fat_100g" : 0.25, + "fiber_100g" : 1.2, + "fructose_100g" : 2.5, + "galactose_100g" : 0, + "glucose_100g" : 2.3, + "iodine_100g" : 1e-05, + "iron_100g" : 0.00037, + "lactose_100g" : 0.1, + "magnesium_100g" : 0.011, + "maltose_100g" : 0.1, + "manganese_100g" : 0.00016, + "pantothenic-acid_100g" : 7.9e-05, + "phosphorus_100g" : 0.031, + "phylloquinone_100g" : 2.83e-06, + "polyols_100g" : 0.25, + "potassium_100g" : 0.33, + "proteins_100g" : 1.31, + "salt_100g" : 0.0063, + "saturated-fat_100g" : 0.005, + "selenium_100g" : 1e-05, + "sodium_100g" : 0.0025, + "starch_100g" : 0.18, + "sucrose_100g" : 0.1, + "sugars_100g" : 4.8, + "vitamin-a_100g" : 0, + "vitamin-b12_100g" : 0, + "vitamin-b1_100g" : 4.8e-05, + "vitamin-b2_100g" : 1.8e-05, + "vitamin-b6_100g" : 9.6e-05, + "vitamin-b9_100g" : 1.76e-05, + "vitamin-c_100g" : 0.0218, + "vitamin-d_100g" : 0, + "vitamin-e_100g" : 0.0004, + "vitamin-pp_100g" : 0.00092, + "water_100g" : 90.1, + "zinc_100g" : 0.00018 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 81, + "energy_points" : 0, + "energy_value" : 81, + "fiber" : 1.2, + "fiber_points" : 1, + "fiber_value" : 1.2, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 0, + "is_water" : 0, + "negative_points" : 0, + "positive_points" : 6, + "proteins" : 0.86, + "proteins_points" : 0, + "proteins_value" : 0.86, + "saturated_fat" : 0.056, + "saturated_fat_points" : 0, + "saturated_fat_value" : 0.1, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 2.48, + "sugars_points" : 0, + "sugars_value" : 2.48 + }, + "grade" : "a", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : -6 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_11", + "energy" : 81, + "energy_points" : 0, + "fiber" : 1.2, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 100, + "fruits_vegetables_legumes_points" : 5, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 0, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy", + "sugars", + "saturated_fat", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 0, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber", + "proteins" + ], + "positive_points" : 5, + "proteins" : 0.86, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 0.056, + "saturated_fat_points" : 0, + "sugars" : 2.48, + "sugars_points" : 0 + }, + "grade" : "a", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : -5 + } + }, + "nutriscore_2021_tags" : [ + "a" + ], + "nutriscore_2023_tags" : [ + "a" + ], + "nutriscore_data" : { + "energy" : 81, + "energy_points" : 0, + "energy_value" : 81, + "fiber" : 1.2, + "fiber_points" : 1, + "fiber_value" : 1.2, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "grade" : "a", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 0, + "is_water" : 0, + "negative_points" : 0, + "positive_points" : 6, + "proteins" : 0.86, + "proteins_points" : 0, + "proteins_value" : 0.86, + "saturated_fat" : 0.056, + "saturated_fat_points" : 0, + "saturated_fat_value" : 0.1, + "score" : -6, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 2.48, + "sugars_points" : 0, + "sugars_value" : 2.48 + }, + "nutriscore_grade" : "a", + "nutriscore_score" : -6, + "nutriscore_score_opposite" : 6, + "nutriscore_tags" : [ + "a" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "a", + "nutrition_grades" : "a", + "nutrition_grades_tags" : [ + "a" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 100, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 100, + "other_nutritional_substances_tags" : [], + "pnns_groups_1" : "Fruits and vegetables", + "pnns_groups_1_tags" : [ + "fruits-and-vegetables", + "known" + ], + "pnns_groups_2" : "Vegetables", + "pnns_groups_2_tags" : [ + "vegetables", + "known" + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [] +} diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json new file mode 100644 index 0000000000000..cdb087abb2c2c --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json @@ -0,0 +1,227 @@ +{ + "categories" : "olive oil", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:olive-tree-products", + "en:vegetable-oils", + "en:olive-oils" + ], + "categories_lc" : "en", + "categories_properties" : { + "agribalyse_proxy_food_code:en" : "17270", + "ciqual_food_code:en" : "17001" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-unknown", + "agribalyse-proxy-food-code-17270", + "agribalyse-proxy-food-code-known", + "ciqual-food-code-17001", + "ciqual-food-code-known", + "agribalyse-known", + "agribalyse-17270" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:olive-tree-products", + "en:vegetable-oils", + "en:olive-oils" + ], + "food_groups" : "en:fats", + "food_groups_tags" : [ + "en:fats-and-sauces", + "en:fats" + ], + "lc" : "en", + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-from-category", + "en:nutrition-fruits-vegetables-nuts-from-category-en-olive-oils", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-from-category", + "en:nutrition-fruits-vegetables-legumes-from-category-en-olive-oils", + "en:nutriscore-2021-different-from-2023", + "en:nutriscore-2021-worse-than-2023", + "en:nutriscore-2021-c-2023-b" + ], + "nutriments" : { + "energy_100g" : 3367, + "fat_100g" : 91, + "fiber_100g" : 0, + "nutrition-score-fr" : 7, + "nutrition-score-fr_100g" : 7, + "proteins_100g" : 0, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 17, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 0 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 3367, + "energy_points" : 10, + "energy_value" : 3367, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 18.7, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 7 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_more_than_7", + "energy" : 3367, + "energy_from_saturated_fat" : 629, + "energy_from_saturated_fat_points" : 5, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 100, + "fruits_vegetables_legumes_points" : 5, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 1, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy_from_saturated_fat", + "sugars", + "saturated_fat_ratio", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 7, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber" + ], + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "sugars" : 0, + "sugars_points" : 0 + }, + "grade" : "b", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 2 + } + }, + "nutriscore_2021_tags" : [ + "c" + ], + "nutriscore_2023_tags" : [ + "b" + ], + "nutriscore_data" : { + "energy" : 3367, + "energy_points" : 10, + "energy_value" : 3367, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "grade" : "c", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 18.7, + "score" : 7, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "nutriscore_grade" : "c", + "nutriscore_score" : 7, + "nutriscore_score_opposite" : -7, + "nutriscore_tags" : [ + "c" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "c", + "nutrition_grades" : "c", + "nutrition_grades_tags" : [ + "c" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_from_category" : "en:olive-oils", + "nutrition_score_warning_fruits_vegetables_legumes_from_category_value" : 100, + "nutrition_score_warning_fruits_vegetables_nuts_from_category" : "en:olive-oils", + "nutrition_score_warning_fruits_vegetables_nuts_from_category_value" : 100, + "pnns_groups_1" : "Fat and sauces", + "pnns_groups_1_tags" : [ + "fat-and-sauces", + "known" + ], + "pnns_groups_2" : "Fats", + "pnns_groups_2_tags" : [ + "fats", + "known" + ] +} diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json new file mode 100644 index 0000000000000..5f89e9dd8b8b1 --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json @@ -0,0 +1,341 @@ +{ + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], + "categories" : "olive oil", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:olive-tree-products", + "en:vegetable-oils", + "en:olive-oils" + ], + "categories_lc" : "en", + "categories_properties" : { + "agribalyse_proxy_food_code:en" : "17270", + "ciqual_food_code:en" : "17001" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-unknown", + "agribalyse-proxy-food-code-17270", + "agribalyse-proxy-food-code-known", + "ciqual-food-code-17001", + "ciqual-food-code-known", + "agribalyse-known", + "agribalyse-17270" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:olive-tree-products", + "en:vegetable-oils", + "en:olive-oils" + ], + "food_groups" : "en:fats", + "food_groups_tags" : [ + "en:fats-and-sauces", + "en:fats" + ], + "ingredients" : [ + { + "from_palm_oil" : "no", + "id" : "en:olive-oil", + "percent_estimate" : 100, + "percent_max" : 100, + "percent_min" : 100, + "text" : "olive oil", + "vegan" : "yes", + "vegetarian" : "yes" + } + ], + "ingredients_analysis" : {}, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan", + "en:vegetarian" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:olive-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:vegetable-oil" + ], + "ingredients_n" : 1, + "ingredients_n_tags" : [ + "1", + "1-10" + ], + "ingredients_original_tags" : [ + "en:olive-oil" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:olive-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:vegetable-oil" + ], + "ingredients_text" : "olive oil", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 0, + "ingredients_with_specified_percent_sum" : 0, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 100, + "ingredients_without_ciqual_codes" : [ + "en:olive-oil" + ], + "ingredients_without_ciqual_codes_n" : 1, + "known_ingredients_n" : 4, + "lc" : "en", + "minerals_tags" : [], + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", + "en:nutriscore-2021-different-from-2023", + "en:nutriscore-2021-worse-than-2023", + "en:nutriscore-2021-c-2023-b" + ], + "nucleotides_tags" : [], + "nutriments" : { + "energy_100g" : 3367, + "fat_100g" : 91, + "fiber_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 100, + "nutrition-score-fr" : 7, + "nutrition-score-fr_100g" : 7, + "proteins_100g" : 0, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 17, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 0 + }, + "nutriments_estimated" : { + "alcohol_100g" : 0, + "beta-carotene_100g" : 0.00021, + "calcium_100g" : 0.0001, + "carbohydrates_100g" : 0, + "cholesterol_100g" : 0, + "copper_100g" : 5e-06, + "energy-kcal_100g" : 900, + "energy-kj_100g" : 3700, + "energy_100g" : 3700, + "fat_100g" : 99.9, + "fiber_100g" : 0, + "fructose_100g" : 0, + "galactose_100g" : 0, + "glucose_100g" : 0, + "iodine_100g" : 1e-05, + "iron_100g" : 2.5e-05, + "lactose_100g" : 0, + "magnesium_100g" : 2.5e-05, + "maltose_100g" : 0, + "manganese_100g" : 5e-06, + "pantothenic-acid_100g" : 0, + "phosphorus_100g" : 0.00015, + "phylloquinone_100g" : 5.81e-05, + "polyols_100g" : 0, + "potassium_100g" : 0.00015, + "proteins_100g" : 0.25, + "salt_100g" : 0.0063, + "saturated-fat_100g" : 15.2, + "selenium_100g" : 1e-05, + "sodium_100g" : 0.0025, + "starch_100g" : 0, + "sucrose_100g" : 0, + "sugars_100g" : 0, + "vitamin-a_100g" : 0, + "vitamin-b12_100g" : 0, + "vitamin-b1_100g" : 0, + "vitamin-b2_100g" : 0, + "vitamin-b6_100g" : 0, + "vitamin-b9_100g" : 0, + "vitamin-c_100g" : 0, + "vitamin-d_100g" : 1.3e-07, + "vitamin-e_100g" : 0.0223, + "vitamin-pp_100g" : 0, + "water_100g" : 0.1, + "zinc_100g" : 2.5e-05 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 3367, + "energy_points" : 10, + "energy_value" : 3367, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 18.7, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 7 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_more_than_7", + "energy" : 3367, + "energy_from_saturated_fat" : 629, + "energy_from_saturated_fat_points" : 5, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 100, + "fruits_vegetables_legumes_points" : 5, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 1, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy_from_saturated_fat", + "sugars", + "saturated_fat_ratio", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 7, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber" + ], + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "sugars" : 0, + "sugars_points" : 0 + }, + "grade" : "b", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 2 + } + }, + "nutriscore_2021_tags" : [ + "c" + ], + "nutriscore_2023_tags" : [ + "b" + ], + "nutriscore_data" : { + "energy" : 3367, + "energy_points" : 10, + "energy_value" : 3367, + "fat" : 91, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "grade" : "c", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 12, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 17, + "saturated_fat_ratio" : 18.6813186813187, + "saturated_fat_ratio_points" : 2, + "saturated_fat_ratio_value" : 18.7, + "score" : 7, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "nutriscore_grade" : "c", + "nutriscore_score" : 7, + "nutriscore_score_opposite" : -7, + "nutriscore_tags" : [ + "c" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "c", + "nutrition_grades" : "c", + "nutrition_grades_tags" : [ + "c" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 100, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 100, + "other_nutritional_substances_tags" : [], + "pnns_groups_1" : "Fat and sauces", + "pnns_groups_1_tags" : [ + "fat-and-sauces", + "known" + ], + "pnns_groups_2" : "Fats", + "pnns_groups_2_tags" : [ + "fats", + "known" + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [] +} diff --git a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json index 851593127b587..c9af92ed1e4a3 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json @@ -36,9 +36,8 @@ "en:nutriscore-computed", "en:nutrition-no-fruits-vegetables-nuts", "en:nutrition-no-fiber-or-fruits-vegetables-nuts", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b" + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a" ], "nutriments" : { "energy_100g" : 178, @@ -132,7 +131,7 @@ "sugars" : 0.5, "sugars_points" : 0 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -143,7 +142,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 178, diff --git a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json index 0f49067ea6c45..7bb90158f042d 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json +++ b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json @@ -269,9 +269,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b" + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a" ], "nucleotides_tags" : [], "nutriments" : { @@ -371,7 +370,7 @@ "sugars" : 3, "sugars_points" : 0 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -382,7 +381,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 148, diff --git a/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json new file mode 100644 index 0000000000000..6914cbf258434 --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json @@ -0,0 +1,406 @@ +{ + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], + "categories" : "huile végétale", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils" + ], + "categories_lc" : "fr", + "categories_properties" : { + "ciqual_food_code:en" : "17001" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-unknown", + "agribalyse-proxy-food-code-unknown", + "ciqual-food-code-17001", + "ciqual-food-code-known", + "agribalyse-unknown" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils" + ], + "food_groups" : "en:fats", + "food_groups_tags" : [ + "en:fats-and-sauces", + "en:fats" + ], + "ingredients" : [ + { + "ciqual_food_code" : "17130", + "from_palm_oil" : "no", + "id" : "en:colza-oil", + "percent" : 45, + "percent_estimate" : 45, + "percent_max" : 45, + "percent_min" : 45, + "text" : "Huile de colza", + "vegan" : "yes", + "vegetarian" : "yes" + }, + { + "ciqual_food_code" : "17440", + "from_palm_oil" : "no", + "id" : "en:sunflower-oil", + "percent" : 30, + "percent_estimate" : 30, + "percent_max" : 30, + "percent_min" : 30, + "text" : "huile de tournesol", + "vegan" : "yes", + "vegetarian" : "yes" + }, + { + "ciqual_food_code" : "17270", + "from_palm_oil" : "no", + "id" : "en:extra-virgin-olive-oil", + "percent" : 20, + "percent_estimate" : 20, + "percent_max" : 20, + "percent_min" : 20, + "text" : "huile d'olive vierge extra", + "vegan" : "yes", + "vegetarian" : "yes" + }, + { + "ciqual_food_code" : "17180", + "from_palm_oil" : "no", + "id" : "en:linseed-oil", + "percent" : 5, + "percent_estimate" : 5, + "percent_max" : 5, + "percent_min" : 5, + "text" : "huile de lin", + "vegan" : "yes", + "vegetarian" : "yes" + }, + { + "id" : "en:vitamin-d", + "percent_estimate" : 0, + "percent_max" : 0, + "percent_min" : 0, + "text" : "vitamine D" + } + ], + "ingredients_analysis" : { + "en:vegan-status-unknown" : [ + "en:vitamin-d" + ], + "en:vegetarian-status-unknown" : [ + "en:vitamin-d" + ] + }, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan-status-unknown", + "en:vegetarian-status-unknown" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:colza-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:rapeseed-oil", + "en:sunflower-oil", + "en:vegetable-oil", + "en:extra-virgin-olive-oil", + "en:olive-oil", + "en:virgin-olive-oil", + "en:linseed-oil", + "en:vitamin-d" + ], + "ingredients_n" : 5, + "ingredients_n_tags" : [ + "5", + "1-10" + ], + "ingredients_original_tags" : [ + "en:colza-oil", + "en:sunflower-oil", + "en:extra-virgin-olive-oil", + "en:linseed-oil", + "en:vitamin-d" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:colza-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:rapeseed-oil", + "en:sunflower-oil", + "en:vegetable-oil", + "en:extra-virgin-olive-oil", + "en:olive-oil", + "en:virgin-olive-oil", + "en:linseed-oil", + "en:vitamin-d" + ], + "ingredients_text" : "Huile de colza 45%, huile de tournesol 30%, huile d'olive vierge extra 20%, huile de lin 5%, vitamine D", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 4, + "ingredients_with_specified_percent_sum" : 100, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 0, + "ingredients_without_ciqual_codes" : [ + "en:vitamin-d" + ], + "ingredients_without_ciqual_codes_n" : 1, + "known_ingredients_n" : 11, + "lc" : "fr", + "minerals_tags" : [], + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-c-2023-c" + ], + "nucleotides_tags" : [], + "nutriments" : { + "energy_100g" : 3700, + "fat_100g" : 100, + "fiber_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 0, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 65, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 65, + "nutrition-score-fr" : 8, + "nutrition-score-fr_100g" : 8, + "proteins_100g" : 0, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 9.8, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 0 + }, + "nutriments_estimated" : { + "alcohol_100g" : 0, + "beta-carotene_100g" : 4.275e-05, + "calcium_100g" : 0.0006805, + "carbohydrates_100g" : 0, + "cholesterol_100g" : 0, + "copper_100g" : 4.84e-06, + "energy-kcal_100g" : 900.3, + "energy-kj_100g" : 3700, + "energy_100g" : 3700, + "fat_100g" : 99.98, + "fiber_100g" : 0, + "fructose_100g" : 0, + "galactose_100g" : 0, + "glucose_100g" : 0, + "iodine_100g" : 5.27e-06, + "iron_100g" : 2.285e-05, + "lactose_100g" : 0, + "magnesium_100g" : 0.000143, + "maltose_100g" : 0, + "manganese_100g" : 2.8375e-06, + "pantothenic-acid_100g" : 0, + "phosphorus_100g" : 0.000125, + "phylloquinone_100g" : 4.429e-05, + "polyols_100g" : 0, + "potassium_100g" : 0.0002595, + "proteins_100g" : 0.125, + "salt_100g" : 0.00876, + "saturated-fat_100g" : 10.0965, + "selenium_100g" : 7.625e-06, + "sodium_100g" : 0.003752, + "starch_100g" : 0, + "sucrose_100g" : 0, + "sugars_100g" : 0, + "vitamin-a_100g" : 0, + "vitamin-b12_100g" : 0, + "vitamin-b1_100g" : 0, + "vitamin-b2_100g" : 0, + "vitamin-b6_100g" : 0, + "vitamin-b9_100g" : 0, + "vitamin-c_100g" : 0, + "vitamin-d_100g" : 6.5e-08, + "vitamin-e_100g" : 0.0345645, + "vitamin-pp_100g" : 0, + "water_100g" : 0.0245, + "zinc_100g" : 2.77e-05 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 3700, + "energy_points" : 10, + "energy_value" : 3700, + "fat" : 100, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 65, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 2, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 65, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 10, + "positive_points" : 2, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 9.8, + "saturated_fat_ratio" : 9.8, + "saturated_fat_ratio_points" : 0, + "saturated_fat_ratio_value" : 9.8, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 8 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", + "energy" : 3700, + "energy_from_saturated_fat" : 362.6, + "energy_from_saturated_fat_points" : 3, + "fat" : 100, + "fiber" : 0, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 0, + "fruits_vegetables_legumes_points" : 0, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 1, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy_from_saturated_fat", + "sugars", + "saturated_fat_ratio", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 3, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber", + "proteins" + ], + "positive_points" : 0, + "proteins" : 0, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 9.8, + "saturated_fat_ratio" : 9.8, + "saturated_fat_ratio_points" : 0, + "sugars" : 0, + "sugars_points" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 3 + } + }, + "nutriscore_2021_tags" : [ + "c" + ], + "nutriscore_2023_tags" : [ + "c" + ], + "nutriscore_data" : { + "energy" : 3700, + "energy_points" : 10, + "energy_value" : 3700, + "fat" : 100, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 65, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 2, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 65, + "grade" : "c", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 10, + "positive_points" : 2, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 9.8, + "saturated_fat_ratio" : 9.8, + "saturated_fat_ratio_points" : 0, + "saturated_fat_ratio_value" : 9.8, + "score" : 8, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "nutriscore_grade" : "c", + "nutriscore_score" : 8, + "nutriscore_score_opposite" : -8, + "nutriscore_tags" : [ + "c" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "c", + "nutrition_grades" : "c", + "nutrition_grades_tags" : [ + "c" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 0, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 65, + "other_nutritional_substances_tags" : [], + "pnns_groups_1" : "Fat and sauces", + "pnns_groups_1_tags" : [ + "fat-and-sauces", + "known" + ], + "pnns_groups_2" : "Fats", + "pnns_groups_2_tags" : [ + "fats", + "known" + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [ + "en:vitamin-d" + ] +} diff --git a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json index b8b75f8ee2968..5b385238f2e0c 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json @@ -1,4 +1,10 @@ { + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], "categories" : "boissons végétales de soja", "categories_hierarchy" : [ "en:plant-based-foods-and-beverages", @@ -45,19 +51,94 @@ "en:beverages", "en:plant-based-milk-substitutes" ], + "ingredients" : [ + { + "ciqual_food_code" : "18066", + "id" : "en:water", + "percent_estimate" : 92, + "percent_max" : 92, + "percent_min" : 92, + "text" : "Eau", + "vegan" : "yes", + "vegetarian" : "yes" + }, + { + "ciqual_food_code" : "20901", + "id" : "en:soya-bean", + "percent" : 8, + "percent_estimate" : 8, + "percent_max" : 8, + "percent_min" : 8, + "text" : "fèves de soja", + "vegan" : "yes", + "vegetarian" : "yes" + } + ], + "ingredients_analysis" : {}, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan", + "en:vegetarian" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:water", + "en:soya-bean", + "en:vegetable", + "en:legume", + "en:pulse", + "en:soya" + ], + "ingredients_n" : 2, + "ingredients_n_tags" : [ + "2", + "1-10" + ], + "ingredients_original_tags" : [ + "en:water", + "en:soya-bean" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:water", + "en:soya-bean", + "en:vegetable", + "en:legume", + "en:pulse", + "en:soya" + ], + "ingredients_text" : "Eau, fèves de soja 8%", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 1, + "ingredients_with_specified_percent_sum" : 8, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 92, + "ingredients_without_ciqual_codes" : [], + "ingredients_without_ciqual_codes_n" : 0, + "known_ingredients_n" : 6, "lc" : "fr", + "minerals_tags" : [], "misc_tags" : [ "en:nutriscore-computed", - "en:nutrition-no-fruits-vegetables-nuts", - "en:nutrition-no-fiber-or-fruits-vegetables-nuts", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", "en:nutriscore-2021-different-from-2023", "en:nutriscore-2021-better-than-2023", "en:nutriscore-2021-a-2023-b" ], + "nucleotides_tags" : [], "nutriments" : { "energy_100g" : 178, "fat_100g" : 2.6, "fiber_100g" : 0.5, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 8, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 8, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 8, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 8, "nutrition-score-fr" : -2, "nutrition-score-fr_100g" : -2, "proteins_100g" : 3.9, @@ -70,6 +151,53 @@ "sodium_value" : 0.012, "sugars_100g" : 0.5 }, + "nutriments_estimated" : { + "alcohol_100g" : 0, + "beta-carotene_100g" : 0, + "calcium_100g" : 0.0241596, + "carbohydrates_100g" : 1.664, + "cholesterol_100g" : 0, + "copper_100g" : 8.604e-05, + "energy-kcal_100g" : 0, + "energy-kj_100g" : 0, + "energy_100g" : 0, + "fat_100g" : 1.536, + "fiber_100g" : 1.04, + "fructose_100g" : 0, + "galactose_100g" : 0, + "glucose_100g" : 0, + "iodine_100g" : 0, + "iron_100g" : 0.0012836, + "lactose_100g" : 0, + "magnesium_100g" : 0.0211508, + "maltose_100g" : 0, + "manganese_100g" : 0.0001815544, + "pantothenic-acid_100g" : 0, + "phosphorus_100g" : 0.04688, + "phylloquinone_100g" : 0, + "polyols_100g" : 0.04, + "potassium_100g" : 0.1398716, + "proteins_100g" : 2.76, + "salt_100g" : 0.007592, + "saturated-fat_100g" : 0, + "selenium_100g" : 4.6e-07, + "sodium_100g" : 0.002448, + "starch_100g" : 0.984, + "sucrose_100g" : 0.488, + "sugars_100g" : 0.5864, + "vitamin-a_100g" : 0, + "vitamin-b12_100g" : 0, + "vitamin-b1_100g" : 0, + "vitamin-b2_100g" : 0, + "vitamin-b6_100g" : 3.2e-05, + "vitamin-b9_100g" : 0, + "vitamin-c_100g" : 0.00048, + "vitamin-d_100g" : 0, + "vitamin-e_100g" : 6.8e-05, + "vitamin-pp_100g" : 0, + "water_100g" : 92.6216, + "zinc_100g" : 0.00024612 + }, "nutriscore" : { "2021" : { "category_available" : 1, @@ -80,9 +208,9 @@ "fiber" : 0.5, "fiber_points" : 0, "fiber_value" : 0.5, - "fruits_vegetables_nuts_colza_walnut_olive_oils" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 8, "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 0, - "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 8, "is_beverage" : 0, "is_cheese" : 0, "is_fat" : 0, @@ -117,7 +245,8 @@ "energy_points" : 3, "fiber" : 0.5, "fiber_points" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 8, + "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, @@ -167,9 +296,9 @@ "fiber" : 0.5, "fiber_points" : 0, "fiber_value" : 0.5, - "fruits_vegetables_nuts_colza_walnut_olive_oils" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 8, "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 0, - "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 8, "grade" : "a", "is_beverage" : 0, "is_cheese" : 0, @@ -207,7 +336,11 @@ ], "nutrition_score_beverage" : 0, "nutrition_score_debug" : "", - "nutrition_score_warning_no_fruits_vegetables_nuts" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 8, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 8, + "other_nutritional_substances_tags" : [], "pnns_groups_1" : "Beverages", "pnns_groups_1_tags" : [ "beverages", @@ -217,5 +350,7 @@ "pnns_groups_2_tags" : [ "plant-based-milk-substitutes", "known" - ] + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [] } diff --git a/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json new file mode 100644 index 0000000000000..e9f13a93122da --- /dev/null +++ b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json @@ -0,0 +1,339 @@ +{ + "additives_n" : 0, + "additives_old_n" : 0, + "additives_old_tags" : [], + "additives_original_tags" : [], + "additives_tags" : [], + "amino_acids_tags" : [], + "categories" : "huile de colza", + "categories_hierarchy" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils", + "en:rapeseed-oils" + ], + "categories_lc" : "fr", + "categories_properties" : { + "agribalyse_food_code:en" : "17130", + "ciqual_food_code:en" : "17130" + }, + "categories_properties_tags" : [ + "all-products", + "categories-known", + "agribalyse-food-code-17130", + "agribalyse-food-code-known", + "agribalyse-proxy-food-code-unknown", + "ciqual-food-code-17130", + "ciqual-food-code-known", + "agribalyse-known", + "agribalyse-17130" + ], + "categories_tags" : [ + "en:plant-based-foods-and-beverages", + "en:plant-based-foods", + "en:fats", + "en:vegetable-fats", + "en:vegetable-oils", + "en:rapeseed-oils" + ], + "food_groups" : "en:fats", + "food_groups_tags" : [ + "en:fats-and-sauces", + "en:fats" + ], + "ingredients" : [ + { + "ciqual_food_code" : "17130", + "from_palm_oil" : "no", + "id" : "en:colza-oil", + "percent_estimate" : 100, + "percent_max" : 100, + "percent_min" : 100, + "text" : "Huile de colza", + "vegan" : "yes", + "vegetarian" : "yes" + } + ], + "ingredients_analysis" : {}, + "ingredients_analysis_tags" : [ + "en:palm-oil-free", + "en:vegan", + "en:vegetarian" + ], + "ingredients_from_or_that_may_be_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_n" : 0, + "ingredients_from_palm_oil_tags" : [], + "ingredients_hierarchy" : [ + "en:colza-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:rapeseed-oil" + ], + "ingredients_n" : 1, + "ingredients_n_tags" : [ + "1", + "1-10" + ], + "ingredients_original_tags" : [ + "en:colza-oil" + ], + "ingredients_percent_analysis" : 1, + "ingredients_tags" : [ + "en:colza-oil", + "en:oil-and-fat", + "en:vegetable-oil-and-fat", + "en:rapeseed-oil" + ], + "ingredients_text" : "Huile de colza", + "ingredients_that_may_be_from_palm_oil_n" : 0, + "ingredients_that_may_be_from_palm_oil_tags" : [], + "ingredients_with_specified_percent_n" : 0, + "ingredients_with_specified_percent_sum" : 0, + "ingredients_with_unspecified_percent_n" : 1, + "ingredients_with_unspecified_percent_sum" : 100, + "ingredients_without_ciqual_codes" : [], + "ingredients_without_ciqual_codes_n" : 0, + "known_ingredients_n" : 4, + "lc" : "fr", + "minerals_tags" : [], + "misc_tags" : [ + "en:nutriscore-computed", + "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", + "en:nutrition-all-nutriscore-values-known", + "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", + "en:nutriscore-2021-different-from-2023", + "en:nutriscore-2021-worse-than-2023", + "en:nutriscore-2021-c-2023-b" + ], + "nucleotides_tags" : [], + "nutriments" : { + "energy_100g" : 3400, + "fat_100g" : 92, + "fiber_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_100g" : 0, + "fruits-vegetables-legumes-estimate-from-ingredients_serving" : 0, + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 100, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 100, + "nutrition-score-fr" : 5, + "nutrition-score-fr_100g" : 5, + "proteins_100g" : 0, + "salt_100g" : 0, + "salt_value" : "0", + "saturated-fat_100g" : 7.3, + "sodium" : 0, + "sodium_100g" : 0, + "sodium_unit" : "g", + "sodium_value" : 0, + "sugars_100g" : 0 + }, + "nutriments_estimated" : { + "alcohol_100g" : 0, + "beta-carotene_100g" : 0, + "calcium_100g" : 0.00129, + "carbohydrates_100g" : 0, + "cholesterol_100g" : 0, + "copper_100g" : 5.2e-06, + "energy-kcal_100g" : 900, + "energy-kj_100g" : 3700, + "energy_100g" : 3700, + "fat_100g" : 100, + "fiber_100g" : 0, + "fructose_100g" : 0, + "galactose_100g" : 0, + "glucose_100g" : 0, + "iodine_100g" : 0, + "iron_100g" : 2.3e-05, + "lactose_100g" : 0, + "magnesium_100g" : 0.00029, + "maltose_100g" : 0, + "manganese_100g" : 7.5e-07, + "pantothenic-acid_100g" : 0, + "phosphorus_100g" : 0, + "phylloquinone_100g" : 7.13e-05, + "polyols_100g" : 0, + "potassium_100g" : 0.00041, + "proteins_100g" : 0, + "salt_100g" : 0, + "saturated-fat_100g" : 7.26, + "selenium_100g" : 5e-06, + "sodium_100g" : 0.00056, + "starch_100g" : 0, + "sucrose_100g" : 0, + "sugars_100g" : 0, + "vitamin-a_100g" : 0, + "vitamin-b12_100g" : 0, + "vitamin-b1_100g" : 0, + "vitamin-b2_100g" : 0, + "vitamin-b6_100g" : 0, + "vitamin-b9_100g" : 0, + "vitamin-c_100g" : 0, + "vitamin-d_100g" : 0, + "vitamin-e_100g" : 0.0277, + "vitamin-pp_100g" : 0, + "water_100g" : 0, + "zinc_100g" : 2.6e-05 + }, + "nutriscore" : { + "2021" : { + "category_available" : 1, + "data" : { + "energy" : 3400, + "energy_points" : 10, + "energy_value" : 3400, + "fat" : 92, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 10, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 7.3, + "saturated_fat_ratio" : 7.93478260869565, + "saturated_fat_ratio_points" : 0, + "saturated_fat_ratio_value" : 7.9, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "grade" : "c", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 5 + }, + "2023" : { + "category_available" : 1, + "data" : { + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", + "energy" : 3400, + "energy_from_saturated_fat" : 270.1, + "energy_from_saturated_fat_points" : 2, + "fat" : 92, + "fiber" : 0, + "fiber_points" : 0, + "fruits_vegetables_legumes" : 0, + "fruits_vegetables_legumes_points" : 0, + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat_oil_nuts_seeds" : 1, + "is_red_meat_product" : 0, + "is_water" : 0, + "negative_nutrients" : [ + "energy_from_saturated_fat", + "sugars", + "saturated_fat_ratio", + "salt", + "non_nutritive_sweeteners" + ], + "negative_points" : 2, + "positive_nutrients" : [ + "fruits_vegetables_legumes", + "fiber", + "proteins" + ], + "positive_points" : 0, + "proteins" : 0, + "proteins_points" : 0, + "salt" : 0, + "salt_points" : 0, + "saturated_fat" : 7.3, + "saturated_fat_ratio" : 7.93478260869565, + "saturated_fat_ratio_points" : 0, + "sugars" : 0, + "sugars_points" : 0 + }, + "grade" : "b", + "nutrients_available" : 1, + "nutriscore_applicable" : 1, + "nutriscore_computed" : 1, + "score" : 2 + } + }, + "nutriscore_2021_tags" : [ + "c" + ], + "nutriscore_2023_tags" : [ + "b" + ], + "nutriscore_data" : { + "energy" : 3400, + "energy_points" : 10, + "energy_value" : 3400, + "fat" : 92, + "fiber" : 0, + "fiber_points" : 0, + "fiber_value" : 0, + "fruits_vegetables_nuts_colza_walnut_olive_oils" : 100, + "fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 5, + "fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 100, + "grade" : "c", + "is_beverage" : 0, + "is_cheese" : 0, + "is_fat" : 1, + "is_water" : 0, + "negative_points" : 10, + "positive_points" : 5, + "proteins" : 0, + "proteins_points" : 0, + "proteins_value" : 0, + "saturated_fat" : 7.3, + "saturated_fat_ratio" : 7.93478260869565, + "saturated_fat_ratio_points" : 0, + "saturated_fat_ratio_value" : 7.9, + "score" : 5, + "sodium" : 0, + "sodium_points" : 0, + "sodium_value" : 0, + "sugars" : 0, + "sugars_points" : 0, + "sugars_value" : 0 + }, + "nutriscore_grade" : "c", + "nutriscore_score" : 5, + "nutriscore_score_opposite" : -5, + "nutriscore_tags" : [ + "c" + ], + "nutriscore_version" : "2021", + "nutrition_data_per" : "100g", + "nutrition_data_prepared_per" : "100g", + "nutrition_grade_fr" : "c", + "nutrition_grades" : "c", + "nutrition_grades_tags" : [ + "c" + ], + "nutrition_score_beverage" : 0, + "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_legumes_estimate_from_ingredients_value" : 0, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients" : 1, + "nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value" : 100, + "other_nutritional_substances_tags" : [], + "pnns_groups_1" : "Fat and sauces", + "pnns_groups_1_tags" : [ + "fat-and-sauces", + "known" + ], + "pnns_groups_2" : "Fats", + "pnns_groups_2_tags" : [ + "fats", + "known" + ], + "unknown_ingredients_n" : 0, + "vitamins_tags" : [] +} diff --git a/tests/unit/expected_test_results/nutriscore/mushrooms.json b/tests/unit/expected_test_results/nutriscore/mushrooms.json index c42805efccd2c..6e13c1e198cca 100644 --- a/tests/unit/expected_test_results/nutriscore/mushrooms.json +++ b/tests/unit/expected_test_results/nutriscore/mushrooms.json @@ -108,9 +108,8 @@ "en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients", "en:nutrition-all-nutriscore-values-known", "en:nutrition-fruits-vegetables-legumes-estimate-from-ingredients", - "en:nutriscore-2021-different-from-2023", - "en:nutriscore-2021-better-than-2023", - "en:nutriscore-2021-a-2023-b" + "en:nutriscore-2021-same-as-2023", + "en:nutriscore-2021-a-2023-a" ], "nucleotides_tags" : [], "nutriments" : { @@ -210,7 +209,7 @@ "sugars" : 1.1, "sugars_points" : 0 }, - "grade" : "b", + "grade" : "a", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, @@ -221,7 +220,7 @@ "a" ], "nutriscore_2023_tags" : [ - "b" + "a" ], "nutriscore_data" : { "energy" : 667, diff --git a/tests/unit/expected_test_results/nutriscore/olive-oil.json b/tests/unit/expected_test_results/nutriscore/olive-oil.json index bc8a80cbdaffe..e0bf0218a8ca9 100644 --- a/tests/unit/expected_test_results/nutriscore/olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/olive-oil.json @@ -45,8 +45,11 @@ "en:nutrition-fruits-vegetables-nuts-from-category", "en:nutrition-fruits-vegetables-nuts-from-category-en-olive-oils", "en:nutrition-all-nutriscore-values-known", - "en:nutriscore-2021-same-as-2023", - "en:nutriscore-2021-c-2023-c" + "en:nutrition-fruits-vegetables-legumes-from-category", + "en:nutrition-fruits-vegetables-legumes-from-category-en-olive-oils", + "en:nutriscore-2021-different-from-2023", + "en:nutriscore-2021-worse-than-2023", + "en:nutriscore-2021-c-2023-b" ], "nutriments" : { "energy_100g" : 3460, @@ -112,10 +115,11 @@ "energy" : 3460, "energy_from_saturated_fat" : 518, "energy_from_saturated_fat_points" : 4, - "fat" : null, + "fat" : 92, "fiber" : 0, "fiber_points" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 100, + "fruits_vegetables_legumes_points" : 5, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, @@ -134,7 +138,7 @@ "fiber", "proteins" ], - "positive_points" : 0, + "positive_points" : 5, "proteins" : 0, "proteins_points" : 0, "salt" : 0, @@ -145,18 +149,18 @@ "sugars" : 0, "sugars_points" : 0 }, - "grade" : "c", + "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 5 + "score" : 0 } }, "nutriscore_2021_tags" : [ "c" ], "nutriscore_2023_tags" : [ - "c" + "b" ], "nutriscore_data" : { "energy" : 3460, @@ -207,6 +211,8 @@ ], "nutrition_score_beverage" : 0, "nutrition_score_debug" : "", + "nutrition_score_warning_fruits_vegetables_legumes_from_category" : "en:olive-oils", + "nutrition_score_warning_fruits_vegetables_legumes_from_category_value" : 100, "nutrition_score_warning_fruits_vegetables_nuts_from_category" : "en:olive-oils", "nutrition_score_warning_fruits_vegetables_nuts_from_category_value" : 100, "pnns_groups_1" : "Fat and sauces", diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json index 141e4865e1bd2..38d90bb4f681c 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json @@ -88,7 +88,7 @@ "category_available" : 1, "data" : { "energy" : 3378, - "fat" : null, + "fat" : 100, "fiber" : 0, "fruits_vegetables_legumes" : null, "is_beverage" : 0, diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json index a1ee81712c8e6..3b1eab1326cf8 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json @@ -112,7 +112,7 @@ "energy" : 3378, "energy_from_saturated_fat" : 370, "energy_from_saturated_fat_points" : 3, - "fat" : null, + "fat" : 100, "fiber" : 0, "fiber_points" : 0, "fruits_vegetables_legumes" : null, diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json index a92acc825c7a2..f9cb1da68f198 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json @@ -112,7 +112,7 @@ "energy" : 3378, "energy_from_saturated_fat" : 370, "energy_from_saturated_fat_points" : 3, - "fat" : null, + "fat" : 100, "fiber" : 0, "fiber_points" : 0, "fruits_vegetables_legumes" : null, diff --git a/tests/unit/expected_test_results/nutriscore/walnut-oil.json b/tests/unit/expected_test_results/nutriscore/walnut-oil.json index a8865cd6f51fb..d90752b1264c7 100644 --- a/tests/unit/expected_test_results/nutriscore/walnut-oil.json +++ b/tests/unit/expected_test_results/nutriscore/walnut-oil.json @@ -114,7 +114,7 @@ "energy" : 3378, "energy_from_saturated_fat" : 370, "energy_from_saturated_fat_points" : 3, - "fat" : null, + "fat" : 100, "fiber" : 0, "fiber_points" : 0, "fruits_vegetables_legumes" : null, diff --git a/tests/unit/nutriscore.t b/tests/unit/nutriscore.t index 18b385157a9a8..baec08120d516 100644 --- a/tests/unit/nutriscore.t +++ b/tests/unit/nutriscore.t @@ -649,7 +649,7 @@ my @tests = ( { lc => "fr", categories => "boissons végétales de soja", - ingredients => "Eau, fèves de soja 8%", + ingredients_text => "Eau, fèves de soja 8%", nutriments => { energy_100g => 178, fat_100g => 2.6, @@ -661,6 +661,114 @@ my @tests = ( }, } ], + # Cherry tomatoes + [ + "en-cherry-tomatoes", + { + lc => "en", + categories => "cherry tomatoes", + ingredients_text => "cherry tomatoes", + nutriments => { + energy_100g => 81, + fat_100g => 0.26, + "saturated-fat_100g" => 0.056, + sugars_100g => 2.48, + fiber_100g => 1.2, + salt_100g => 0, + proteins_100g => 0.86, + } + } + ], + # olive oil + [ + "en-olive-oil", + { + lc => "en", + categories => "olive oil", + ingredients_text => "olive oil", + nutriments => { + energy_100g => 3367, + fat_100g => 91, + "saturated-fat_100g" => 17, + sugars_100g => 0, + fiber_100g => 0, + salt_100g => 0, + proteins_100g => 0, + } + } + ], + # olive oil, no ingredients specified + [ + "en-olive-oil-no-ingredients", + { + lc => "en", + categories => "olive oil", + nutriments => { + energy_100g => 3367, + fat_100g => 91, + "saturated-fat_100g" => 17, + sugars_100g => 0, + fiber_100g => 0, + salt_100g => 0, + proteins_100g => 0, + } + } + ], + # avocado oil + [ + "en-avocado-oil", + { + lc => "en", + categories => "avocado oil", + ingredients_text => "avocado", + nutriments => { + energy_100g => 3448, + fat_100g => 91.6, + "saturated-fat_100g" => 16.4, + sugars_100g => 0, + fiber_100g => 0, + salt_100g => 0, + proteins_100g => 0, + } + } + ], + # mixed oil (isio 4 olive) + [ + "fr-mixed-oils-with-olive-oil", + { + lc => "fr", + categories => "huile végétale", + ingredients_text => + "Huile de colza 45%, huile de tournesol 30%, huile d'olive vierge extra 20%, huile de lin 5%, vitamine D", + nutriments => { + energy_100g => 3700, + fat_100g => 100, + "saturated-fat_100g" => 9.8, + sugars_100g => 0, + fiber_100g => 0, + salt_100g => 0, + proteins_100g => 0, + } + } + ], + # rapeseed oil + [ + "fr-rapeseed-oil", + { + lc => "fr", + categories => "huile de colza", + ingredients_text => "Huile de colza", + nutriments => { + energy_100g => 3400, + fat_100g => 92, + "saturated-fat_100g" => 7.3, + sugars_100g => 0, + fiber_100g => 0, + salt_100g => 0, + proteins_100g => 0, + } + } + ], # Coconut milk -> for cooking, not considered a beverage in 2023 Nutri-Score [ "fr-coconut-milk", @@ -679,7 +787,6 @@ my @tests = ( }, } ], - ); my $json = JSON->new->allow_nonref->canonical;