From eb31bc6fbe23e0280ab6b047a59b5c191344837a Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 5 Jan 2023 03:55:31 +0530 Subject: [PATCH 1/6] feat: make all glass bottles recyclable by default --- lib/ProductOpener/Packaging.pm | 9 +++++++++ .../packaging/packaging_text_en_glass_bottle.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ProductOpener/Packaging.pm b/lib/ProductOpener/Packaging.pm index c040cce4a8abc..3fc344db38c09 100644 --- a/lib/ProductOpener/Packaging.pm +++ b/lib/ProductOpener/Packaging.pm @@ -505,6 +505,15 @@ sub apply_rules_to_augment_packaging_component_data ($product_ref, $packaging_re $packaging_ref->{"shape"} = "en:coffee-capsule"; } + # If the shape is bottle and the material is glass, mark recycling as recycle + if ( (defined $packaging_ref->{"shape"}) + and ($packaging_ref->{"shape"} eq "en:bottle") + and (defined $packaging_ref->{"material"}) + and ($packaging_ref->{"material"} eq "en:glass")) + { + $packaging_ref->{"recycling"} = "en:recycle"; + } + # If we have a shape without a material, check if there is a default material for the shape # e.g. "en:Bubble wrap" has the property packaging_materials:en: en:plastic if ((defined $packaging_ref->{"shape"}) and (not defined $packaging_ref->{"material"})) { diff --git a/tests/unit/expected_test_results/packaging/packaging_text_en_glass_bottle.json b/tests/unit/expected_test_results/packaging/packaging_text_en_glass_bottle.json index c633bcbff10df..0092b4838e74d 100644 --- a/tests/unit/expected_test_results/packaging/packaging_text_en_glass_bottle.json +++ b/tests/unit/expected_test_results/packaging/packaging_text_en_glass_bottle.json @@ -9,7 +9,8 @@ "packagings" : [ { "material" : "en:glass", - "shape" : "en:bottle" + "shape" : "en:bottle", + "recycling" : "en:recycle" } ] } From 9324a382e7745b42e8ea12dfa50a9679f762a188 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 5 Jan 2023 22:28:48 +0530 Subject: [PATCH 2/6] check if material is a type of glass --- lib/ProductOpener/Packaging.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ProductOpener/Packaging.pm b/lib/ProductOpener/Packaging.pm index 3fc344db38c09..78870f4ceef77 100644 --- a/lib/ProductOpener/Packaging.pm +++ b/lib/ProductOpener/Packaging.pm @@ -505,13 +505,19 @@ sub apply_rules_to_augment_packaging_component_data ($product_ref, $packaging_re $packaging_ref->{"shape"} = "en:coffee-capsule"; } - # If the shape is bottle and the material is glass, mark recycling as recycle + # If the shape is bottle and the material is glass, mark recycling as recycle if recycling is not already set if ( (defined $packaging_ref->{"shape"}) and ($packaging_ref->{"shape"} eq "en:bottle") and (defined $packaging_ref->{"material"}) - and ($packaging_ref->{"material"} eq "en:glass")) + and ( + ($packaging_ref->{"material"} eq "en:glass") + or (is_a("packaging_materials", $packaging_ref->{"material"}, "en:glass")) + ) + ) { - $packaging_ref->{"recycling"} = "en:recycle"; + if (not defined $packaging_ref->{"recycling"}) { + $packaging_ref->{"recycling"} = "en:recycle"; + } } # If we have a shape without a material, check if there is a default material for the shape From b81f7a354e83070be9db2c3d53f71076a2bc8bc3 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 5 Jan 2023 23:47:10 +0530 Subject: [PATCH 3/6] formatting --- lib/ProductOpener/Packaging.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ProductOpener/Packaging.pm b/lib/ProductOpener/Packaging.pm index 78870f4ceef77..eb819d328ae46 100644 --- a/lib/ProductOpener/Packaging.pm +++ b/lib/ProductOpener/Packaging.pm @@ -506,13 +506,12 @@ sub apply_rules_to_augment_packaging_component_data ($product_ref, $packaging_re } # If the shape is bottle and the material is glass, mark recycling as recycle if recycling is not already set - if ( (defined $packaging_ref->{"shape"}) + if ( + (defined $packaging_ref->{"shape"}) and ($packaging_ref->{"shape"} eq "en:bottle") and (defined $packaging_ref->{"material"}) - and ( - ($packaging_ref->{"material"} eq "en:glass") - or (is_a("packaging_materials", $packaging_ref->{"material"}, "en:glass")) - ) + and ( ($packaging_ref->{"material"} eq "en:glass") + or (is_a("packaging_materials", $packaging_ref->{"material"}, "en:glass"))) ) { if (not defined $packaging_ref->{"recycling"}) { From 58a94b06de3b2f4aa9e653305f53e7bd9174ab56 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Fri, 6 Jan 2023 00:37:07 +0530 Subject: [PATCH 4/6] update tests --- .../expected_test_results/ecoscore/fr-verseur-en-plastique.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/expected_test_results/ecoscore/fr-verseur-en-plastique.json b/tests/unit/expected_test_results/ecoscore/fr-verseur-en-plastique.json index 316204206179f..3509e0bd1b61b 100644 --- a/tests/unit/expected_test_results/ecoscore/fr-verseur-en-plastique.json +++ b/tests/unit/expected_test_results/ecoscore/fr-verseur-en-plastique.json @@ -224,6 +224,7 @@ "quantity_per_unit" : "6g", "quantity_per_unit_unit" : "g", "quantity_per_unit_value" : 6, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { @@ -501,6 +502,7 @@ "quantity_per_unit" : "6g", "quantity_per_unit_unit" : "g", "quantity_per_unit_value" : 6, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { From b12f2daa3440358f2f00ba1f9ee90407a4609a63 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Fri, 6 Jan 2023 05:12:24 +0530 Subject: [PATCH 5/6] update integration tests --- ...ch-fields-packagings-in-api-v3-format.json | 3 + .../search_v1/search-fields-packagings.json | 1 + .../search_v1/search-no-filter.json | 121 +++++++++--------- ...ies-without-ingredients-from-palm-oil.json | 29 +++-- ...rch-without-ingredients-from-palm-oil.json | 111 ++++++++-------- 5 files changed, 142 insertions(+), 123 deletions(-) diff --git a/tests/integration/expected_test_results/search_v1/search-fields-packagings-in-api-v3-format.json b/tests/integration/expected_test_results/search_v1/search-fields-packagings-in-api-v3-format.json index 5fbf148fa22de..236ab89f50f91 100644 --- a/tests/integration/expected_test_results/search_v1/search-fields-packagings-in-api-v3-format.json +++ b/tests/integration/expected_test_results/search_v1/search-fields-packagings-in-api-v3-format.json @@ -16,6 +16,9 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : { + "id" : "en:recycle" + }, "shape" : { "id" : "en:bottle" } diff --git a/tests/integration/expected_test_results/search_v1/search-fields-packagings.json b/tests/integration/expected_test_results/search_v1/search-fields-packagings.json index f8e55e0bbf43a..64f5fd154584f 100644 --- a/tests/integration/expected_test_results/search_v1/search-fields-packagings.json +++ b/tests/integration/expected_test_results/search_v1/search-fields-packagings.json @@ -14,6 +14,7 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { 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 8c21f9db00838..1c1c931de5e75 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 @@ -1,6 +1,6 @@ { "count" : 5, - "page" : "1", + "page" : 1, "page_count" : 5, "page_size" : 24, "products" : [ @@ -60,8 +60,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -94,7 +95,7 @@ "origins_of_ingredients" : { "aggregated_origins" : [ { - "epi_score" : 0, + "epi_score" : "0", "origin" : "en:unknown", "percent" : 100, "transportation_score" : null @@ -316,25 +317,26 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { "ecoscore_material_score" : 76, - "ecoscore_shape_ratio" : "0.2", + "ecoscore_shape_ratio" : 0.2, "material" : "en:steel", "number_of_units" : 1, "shape" : "en:lid" }, { "ecoscore_material_score" : 0, - "ecoscore_shape_ratio" : "0.1", + "ecoscore_shape_ratio" : 0.1, "material" : "en:plastic", "non_recyclable_and_non_biodegradable" : "maybe", "number_of_units" : 1, "shape" : "en:film" } ], - "score" : "66.2", + "score" : 66.2, "value" : -3 }, "production_system" : { @@ -369,23 +371,23 @@ "entry_dates_tags" : "--ignore--", "food_groups_tags" : [], "forest_footprint_data" : { - "footprint_per_kg" : "0.0074375", + "footprint_per_kg" : 0.0074375, "grade" : "a", "ingredients" : [ { "conditions_tags" : [], - "footprint_per_kg" : "0.0074375", + "footprint_per_kg" : 0.0074375, "matching_tag_id" : "en:egg", - "percent" : "9.375", - "percent_estimate" : "9.375", + "percent" : 9.375, + "percent_estimate" : 9.375, "processing_factor" : 1, "tag_id" : "en:egg", "tag_type" : "ingredients", "type" : { - "deforestation_risk" : "0.68", + "deforestation_risk" : 0.68, "name" : "Oeufs Importés", - "soy_feed_factor" : "0.035", - "soy_yield" : "0.3" + "soy_feed_factor" : 0.035, + "soy_yield" : 0.3 } } ] @@ -399,7 +401,7 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : "62.5", + "percent_estimate" : 62.5, "percent_max" : 100, "percent_min" : 25, "rank" : 1, @@ -409,7 +411,7 @@ }, { "id" : "en:milk", - "percent_estimate" : "18.75", + "percent_estimate" : 18.75, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -419,8 +421,8 @@ }, { "id" : "en:egg", - "percent_estimate" : "9.375", - "percent_max" : "33.3333333333333", + "percent_estimate" : 9.375, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "eggs", @@ -430,7 +432,7 @@ { "from_palm_oil" : "yes", "id" : "en:palm-oil", - "percent_estimate" : "9.375", + "percent_estimate" : 9.375, "percent_max" : 25, "percent_min" : 0, "rank" : 4, @@ -582,6 +584,7 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { @@ -709,8 +712,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -745,7 +749,7 @@ "origins_of_ingredients" : { "aggregated_origins" : [ { - "epi_score" : 0, + "epi_score" : "0", "origin" : "en:unknown", "percent" : 100, "transportation_score" : null @@ -1250,8 +1254,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1286,7 +1291,7 @@ "origins_of_ingredients" : { "aggregated_origins" : [ { - "epi_score" : 0, + "epi_score" : "0", "origin" : "en:unknown", "percent" : 100, "transportation_score" : null @@ -1533,23 +1538,23 @@ "entry_dates_tags" : "--ignore--", "food_groups_tags" : [], "forest_footprint_data" : { - "footprint_per_kg" : "0.0132222222222222", + "footprint_per_kg" : 0.0132222222222222, "grade" : "a", "ingredients" : [ { "conditions_tags" : [], - "footprint_per_kg" : "0.0132222222222222", + "footprint_per_kg" : 0.0132222222222222, "matching_tag_id" : "en:egg", - "percent" : "16.6666666666667", - "percent_estimate" : "16.6666666666667", + "percent" : 16.6666666666667, + "percent_estimate" : 16.6666666666667, "processing_factor" : 1, "tag_id" : "en:egg", "tag_type" : "ingredients", "type" : { - "deforestation_risk" : "0.68", + "deforestation_risk" : 0.68, "name" : "Oeufs Importés", - "soy_feed_factor" : "0.035", - "soy_yield" : "0.3" + "soy_feed_factor" : 0.035, + "soy_yield" : 0.3 } } ] @@ -1563,9 +1568,9 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : "66.6666666666667", + "percent_estimate" : 66.6666666666667, "percent_max" : 100, - "percent_min" : "33.3333333333333", + "percent_min" : 33.3333333333333, "rank" : 1, "text" : "apple", "vegan" : "yes", @@ -1573,7 +1578,7 @@ }, { "id" : "en:milk", - "percent_estimate" : "16.6666666666667", + "percent_estimate" : 16.6666666666667, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -1583,8 +1588,8 @@ }, { "id" : "en:egg", - "percent_estimate" : "16.6666666666667", - "percent_max" : "33.3333333333333", + "percent_estimate" : 16.6666666666667, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "eggs", @@ -1696,8 +1701,8 @@ "nutrient_levels" : {}, "nutrient_levels_tags" : [], "nutriments" : { - "fruits-vegetables-nuts-estimate-from-ingredients_100g" : "33.3333333333333", - "fruits-vegetables-nuts-estimate-from-ingredients_serving" : "33.3333333333333", + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 33.3333333333333, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 33.3333333333333, "nova-group" : 1, "nova-group_100g" : 1, "nova-group_serving" : 1 @@ -1826,8 +1831,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1866,7 +1872,7 @@ "origins_of_ingredients" : { "aggregated_origins" : [ { - "epi_score" : 0, + "epi_score" : "0", "origin" : "en:unknown", "percent" : 100, "transportation_score" : null @@ -2121,15 +2127,15 @@ "ingredients" : [ { "id" : "es:apple", - "percent_estimate" : "66.6666666666667", + "percent_estimate" : 66.6666666666667, "percent_max" : 100, - "percent_min" : "33.3333333333333", + "percent_min" : 33.3333333333333, "rank" : 1, "text" : "apple" }, { "id" : "es:water", - "percent_estimate" : "16.6666666666667", + "percent_estimate" : 16.6666666666667, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -2137,8 +2143,8 @@ }, { "id" : "es:palm-oil", - "percent_estimate" : "16.6666666666667", - "percent_max" : "33.3333333333333", + "percent_estimate" : 16.6666666666667, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "palm oil" @@ -2395,8 +2401,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2435,7 +2442,7 @@ "origins_of_ingredients" : { "aggregated_origins" : [ { - "epi_score" : 0, + "epi_score" : "0", "origin" : "en:unknown", "percent" : 100, "transportation_score" : null @@ -2660,22 +2667,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : "2.2396004", + "co2_agriculture" : 2.2396004, "co2_consumption" : 0, - "co2_distribution" : "0.019530673", - "co2_packaging" : "0.28159592", - "co2_processing" : "0.77051126", - "co2_total" : "3.564111983", - "co2_transportation" : "0.25287373", + "co2_distribution" : 0.019530673, + "co2_packaging" : 0.28159592, + "co2_processing" : 0.77051126, + "co2_total" : 3.564111983, + "co2_transportation" : 0.25287373, "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : "0.50064279", + "ef_agriculture" : 0.50064279, "ef_consumption" : 0, - "ef_distribution" : "0.0048315303", - "ef_packaging" : "0.023715692", - "ef_processing" : "0.078716079", - "ef_total" : "0.6323498093", - "ef_transportation" : "0.024443718", + "ef_distribution" : 0.0048315303, + "ef_packaging" : 0.023715692, + "ef_processing" : 0.078716079, + "ef_total" : 0.6323498093, + "ef_transportation" : 0.024443718, "is_beverage" : 0, "name_en" : "Breakfast cereals, mix of puffed or extruded cereals, fortified with vitamins and chemical elements", "name_fr" : "Multi-céréales soufflées ou extrudées, enrichies en vitamines et minéraux", 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 48f7e51b9509f..75c4a8d880f3b 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 @@ -1,6 +1,6 @@ { "count" : 1, - "page" : "1", + "page" : 1, "page_count" : 1, "page_size" : 24, "products" : [ @@ -73,8 +73,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -338,22 +339,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : "2.2396004", + "co2_agriculture" : 2.2396004, "co2_consumption" : 0, - "co2_distribution" : "0.019530673", - "co2_packaging" : "0.28159592", - "co2_processing" : "0.77051126", - "co2_total" : "3.564111983", - "co2_transportation" : "0.25287373", + "co2_distribution" : 0.019530673, + "co2_packaging" : 0.28159592, + "co2_processing" : 0.77051126, + "co2_total" : 3.564111983, + "co2_transportation" : 0.25287373, "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : "0.50064279", + "ef_agriculture" : 0.50064279, "ef_consumption" : 0, - "ef_distribution" : "0.0048315303", - "ef_packaging" : "0.023715692", - "ef_processing" : "0.078716079", - "ef_total" : "0.6323498093", - "ef_transportation" : "0.024443718", + "ef_distribution" : 0.0048315303, + "ef_packaging" : 0.023715692, + "ef_processing" : 0.078716079, + "ef_total" : 0.6323498093, + "ef_transportation" : 0.024443718, "is_beverage" : 0, "name_en" : "Breakfast cereals, mix of puffed or extruded cereals, fortified with vitamins and chemical elements", "name_fr" : "Multi-céréales soufflées ou extrudées, enrichies en vitamines et minéraux", 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 8c21f9db00838..8eefa1829e4a1 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 @@ -1,6 +1,6 @@ { "count" : 5, - "page" : "1", + "page" : 1, "page_count" : 5, "page_size" : 24, "products" : [ @@ -60,8 +60,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -316,25 +317,26 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { "ecoscore_material_score" : 76, - "ecoscore_shape_ratio" : "0.2", + "ecoscore_shape_ratio" : 0.2, "material" : "en:steel", "number_of_units" : 1, "shape" : "en:lid" }, { "ecoscore_material_score" : 0, - "ecoscore_shape_ratio" : "0.1", + "ecoscore_shape_ratio" : 0.1, "material" : "en:plastic", "non_recyclable_and_non_biodegradable" : "maybe", "number_of_units" : 1, "shape" : "en:film" } ], - "score" : "66.2", + "score" : 66.2, "value" : -3 }, "production_system" : { @@ -369,23 +371,23 @@ "entry_dates_tags" : "--ignore--", "food_groups_tags" : [], "forest_footprint_data" : { - "footprint_per_kg" : "0.0074375", + "footprint_per_kg" : 0.0074375, "grade" : "a", "ingredients" : [ { "conditions_tags" : [], - "footprint_per_kg" : "0.0074375", + "footprint_per_kg" : 0.0074375, "matching_tag_id" : "en:egg", - "percent" : "9.375", - "percent_estimate" : "9.375", + "percent" : 9.375, + "percent_estimate" : 9.375, "processing_factor" : 1, "tag_id" : "en:egg", "tag_type" : "ingredients", "type" : { - "deforestation_risk" : "0.68", + "deforestation_risk" : 0.68, "name" : "Oeufs Importés", - "soy_feed_factor" : "0.035", - "soy_yield" : "0.3" + "soy_feed_factor" : 0.035, + "soy_yield" : 0.3 } } ] @@ -399,7 +401,7 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : "62.5", + "percent_estimate" : 62.5, "percent_max" : 100, "percent_min" : 25, "rank" : 1, @@ -409,7 +411,7 @@ }, { "id" : "en:milk", - "percent_estimate" : "18.75", + "percent_estimate" : 18.75, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -419,8 +421,8 @@ }, { "id" : "en:egg", - "percent_estimate" : "9.375", - "percent_max" : "33.3333333333333", + "percent_estimate" : 9.375, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "eggs", @@ -430,7 +432,7 @@ { "from_palm_oil" : "yes", "id" : "en:palm-oil", - "percent_estimate" : "9.375", + "percent_estimate" : 9.375, "percent_max" : 25, "percent_min" : 0, "rank" : 4, @@ -582,6 +584,7 @@ "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, + "recycling" : "en:recycle", "shape" : "en:bottle" }, { @@ -709,8 +712,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1250,8 +1254,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1533,23 +1538,23 @@ "entry_dates_tags" : "--ignore--", "food_groups_tags" : [], "forest_footprint_data" : { - "footprint_per_kg" : "0.0132222222222222", + "footprint_per_kg" : 0.0132222222222222, "grade" : "a", "ingredients" : [ { "conditions_tags" : [], - "footprint_per_kg" : "0.0132222222222222", + "footprint_per_kg" : 0.0132222222222222, "matching_tag_id" : "en:egg", - "percent" : "16.6666666666667", - "percent_estimate" : "16.6666666666667", + "percent" : 16.6666666666667, + "percent_estimate" : 16.6666666666667, "processing_factor" : 1, "tag_id" : "en:egg", "tag_type" : "ingredients", "type" : { - "deforestation_risk" : "0.68", + "deforestation_risk" : 0.68, "name" : "Oeufs Importés", - "soy_feed_factor" : "0.035", - "soy_yield" : "0.3" + "soy_feed_factor" : 0.035, + "soy_yield" : 0.3 } } ] @@ -1563,9 +1568,9 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : "66.6666666666667", + "percent_estimate" : 66.6666666666667, "percent_max" : 100, - "percent_min" : "33.3333333333333", + "percent_min" : 33.3333333333333, "rank" : 1, "text" : "apple", "vegan" : "yes", @@ -1573,7 +1578,7 @@ }, { "id" : "en:milk", - "percent_estimate" : "16.6666666666667", + "percent_estimate" : 16.6666666666667, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -1583,8 +1588,8 @@ }, { "id" : "en:egg", - "percent_estimate" : "16.6666666666667", - "percent_max" : "33.3333333333333", + "percent_estimate" : 16.6666666666667, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "eggs", @@ -1696,8 +1701,8 @@ "nutrient_levels" : {}, "nutrient_levels_tags" : [], "nutriments" : { - "fruits-vegetables-nuts-estimate-from-ingredients_100g" : "33.3333333333333", - "fruits-vegetables-nuts-estimate-from-ingredients_serving" : "33.3333333333333", + "fruits-vegetables-nuts-estimate-from-ingredients_100g" : 33.3333333333333, + "fruits-vegetables-nuts-estimate-from-ingredients_serving" : 33.3333333333333, "nova-group" : 1, "nova-group_100g" : 1, "nova-group_serving" : 1 @@ -1826,8 +1831,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:snacks", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2121,15 +2127,15 @@ "ingredients" : [ { "id" : "es:apple", - "percent_estimate" : "66.6666666666667", + "percent_estimate" : 66.6666666666667, "percent_max" : 100, - "percent_min" : "33.3333333333333", + "percent_min" : 33.3333333333333, "rank" : 1, "text" : "apple" }, { "id" : "es:water", - "percent_estimate" : "16.6666666666667", + "percent_estimate" : 16.6666666666667, "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -2137,8 +2143,8 @@ }, { "id" : "es:palm-oil", - "percent_estimate" : "16.6666666666667", - "percent_max" : "33.3333333333333", + "percent_estimate" : 16.6666666666667, + "percent_max" : 33.3333333333333, "percent_min" : 0, "rank" : 3, "text" : "palm oil" @@ -2395,8 +2401,9 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], + "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, - "completeness" : "0.5", + "completeness" : 0.5, "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2660,22 +2667,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : "2.2396004", + "co2_agriculture" : 2.2396004, "co2_consumption" : 0, - "co2_distribution" : "0.019530673", - "co2_packaging" : "0.28159592", - "co2_processing" : "0.77051126", - "co2_total" : "3.564111983", - "co2_transportation" : "0.25287373", + "co2_distribution" : 0.019530673, + "co2_packaging" : 0.28159592, + "co2_processing" : 0.77051126, + "co2_total" : 3.564111983, + "co2_transportation" : 0.25287373, "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : "0.50064279", + "ef_agriculture" : 0.50064279, "ef_consumption" : 0, - "ef_distribution" : "0.0048315303", - "ef_packaging" : "0.023715692", - "ef_processing" : "0.078716079", - "ef_total" : "0.6323498093", - "ef_transportation" : "0.024443718", + "ef_distribution" : 0.0048315303, + "ef_packaging" : 0.023715692, + "ef_processing" : 0.078716079, + "ef_total" : 0.6323498093, + "ef_transportation" : 0.024443718, "is_beverage" : 0, "name_en" : "Breakfast cereals, mix of puffed or extruded cereals, fortified with vitamins and chemical elements", "name_fr" : "Multi-céréales soufflées ou extrudées, enrichies en vitamines et minéraux", From 1eb48b306d4d378ce02db00a5af6c22b6179382b Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Fri, 6 Jan 2023 05:33:10 +0530 Subject: [PATCH 6/6] fix: remove compared_to_category from tests --- .../expected_test_results/search_v1/search-no-filter.json | 5 ----- ...ch-tags-categories-without-ingredients-from-palm-oil.json | 1 - .../search_v1/search-without-ingredients-from-palm-oil.json | 5 ----- 3 files changed, 11 deletions(-) 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 1c1c931de5e75..9dc321ea97a2b 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 @@ -60,7 +60,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -712,7 +711,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -1254,7 +1252,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -1831,7 +1828,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -2401,7 +2397,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], 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 75c4a8d880f3b..bc1e89e3e5c2e 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 @@ -73,7 +73,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], 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 8eefa1829e4a1..20bda64c7f313 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 @@ -60,7 +60,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -712,7 +711,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -1254,7 +1252,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -1831,7 +1828,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:snacks", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [], @@ -2401,7 +2397,6 @@ "20xxxxxxxxxx", "2xxxxxxxxxxx" ], - "compared_to_category" : "en:cereals-and-potatoes", "complete" : 0, "completeness" : 0.5, "correctors_tags" : [],