From 72cf1209d7a0a3e45c51b217622bdb1de01d924f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 23 Nov 2022 15:38:35 +0100 Subject: [PATCH] feat: translations in packagings READ API v3 (#7749) --- .../schemas/packagings/packagings.yaml | 28 ++- lib/ProductOpener/API.pm | 56 +++++ lib/ProductOpener/Packaging.pm | 15 +- po/common/common.pot | 4 + po/common/en.po | 4 + taxonomies/packaging_materials.txt | 2 +- tests/integration/api_v2_product_read.t | 18 ++ tests/integration/api_v3_product_read.t | 16 ++ tests/integration/api_v3_product_write.t | 144 +++++++++--- .../get-existing-product.json | 222 +++++++++++------- .../get-knowledge-panels-fr.json | 141 +++++++++-- .../get-knowledge-panels.json | 141 +++++++++-- .../get-packagings-fr.json | 36 +++ .../api_v2_product_read/get-packagings.json | 36 +++ .../get-existing-product.json | 222 +++++++++++------- .../get-knowledge-panels-fr.json | 141 +++++++++-- .../get-knowledge-panels.json | 141 +++++++++-- .../get-packagings-fr.json | 78 ++++++ .../api_v3_product_read/get-packagings.json | 66 ++++++ ...gs-add-components-to-existing-product.json | 30 ++- .../patch-packagings-add-one-component.json | 9 +- .../patch-packagings-fr-fields.json | 55 ++++- .../patch-packagings-quantity-and-weight.json | 20 +- ...roperties-with-lc-name-fr-and-spanish.json | 25 ++ ...h-lc-name-fr-and-unrecognized-spanish.json | 42 ++++ .../patch-properties-with-lc-name-fr.json | 25 ++ .../patch-properties-with-lc-name.json | 25 ++ .../patch-replace-packagings.json | 20 +- .../patch-request-fields-all.json | 2 +- .../patch-request-fields-ecoscore-data.json | 2 +- .../patch-request-fields-none.json | 2 +- .../patch-request-fields-packagings.json | 2 +- .../patch-request-fields-undef.json | 2 +- .../patch-request-fields-updated.json | 2 +- .../expected_test_results/search_test/q1.json | 100 ++++---- .../expected_test_results/search_test/q2.json | 100 ++++---- .../expected_test_results/search_test/q4.json | 30 +-- .../packaging/packaging_en_citeo_shapes.json | 1 + 38 files changed, 1572 insertions(+), 433 deletions(-) create mode 100644 tests/integration/expected_test_results/api_v2_product_read/get-packagings-fr.json create mode 100644 tests/integration/expected_test_results/api_v2_product_read/get-packagings.json create mode 100644 tests/integration/expected_test_results/api_v3_product_read/get-packagings-fr.json create mode 100644 tests/integration/expected_test_results/api_v3_product_read/get-packagings.json create mode 100644 tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-spanish.json create mode 100644 tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-unrecognized-spanish.json create mode 100644 tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr.json create mode 100644 tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name.json diff --git a/docs/reference/schemas/packagings/packagings.yaml b/docs/reference/schemas/packagings/packagings.yaml index 7f3eae3c263b3..141945ae924f2 100644 --- a/docs/reference/schemas/packagings/packagings.yaml +++ b/docs/reference/schemas/packagings/packagings.yaml @@ -6,7 +6,33 @@ description: |- The packagings object is an array of individual packaging component objects. The Packaging data document explains how packaging data is structured in Open Food Facts: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/docs/explanations/packaging-data.md -examples: [] + + The shape, material and recycling properties of each packaging component are linked to entries in the packaging_shapes, packaging_materials and packaging_recycling taxonomies: + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + If the tags_lc field is set, the properties will include a lc_name field with the translation in the requested language. +examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified items: $ref: ./packaging_component.yaml readOnly: true diff --git a/lib/ProductOpener/API.pm b/lib/ProductOpener/API.pm index cbf0f472aa1e6..2aadb45181695 100644 --- a/lib/ProductOpener/API.pm +++ b/lib/ProductOpener/API.pm @@ -68,6 +68,7 @@ use ProductOpener::Text qw/:all/; use ProductOpener::Attributes qw/:all/; use ProductOpener::KnowledgePanels qw/:all/; use ProductOpener::Ecoscore qw/localize_ecoscore/; +use ProductOpener::Packaging qw/:all/; use ProductOpener::APIProductRead qw/:all/; use ProductOpener::APIProductWrite qw/:all/; @@ -480,6 +481,56 @@ sub get_images_to_update ($product_ref, $target_lc) { return $images_to_update_ref; } +=head2 customize_packagings ($request_ref, $product_ref) + +Packaging components are stored in a compact form: only taxonomy ids for +shape, material and recycling. + +This function returns a richer structure with local names for the taxonomy entries. + +=head3 Parameters + +=head4 $request_ref (input) + +Reference to the request object. + +=head4 $product_ref (input) + +Reference to the product object (retrieved from disk or from a MongoDB query) + +=head3 Return value + +Reference to the customized product object. + +=cut + +sub customize_packagings ($request_ref, $product_ref) { + + if (defined $product_ref->{packagings}) { + + my $tags_lc = request_param($request_ref, 'tags_lc'); + + foreach my $packaging_ref (@{$product_ref->{packagings}}) { + + if ($request_ref->{api_version} >= 3) { + # Shape, material and recycling are localized + foreach my $property ("shape", "material", "recycling") { + if (defined $packaging_ref->{$property}) { + my $property_value_id = $packaging_ref->{$property}; + $packaging_ref->{$property} = {"id" => $property_value_id}; + if (defined $tags_lc) { + $packaging_ref->{$property}{lc_name} + = display_taxonomy_tag($tags_lc, $packaging_taxonomies{$property}, $property_value_id); + } + } + } + } + } + } + + return $product_ref->{packagings}; +} + =head2 customize_response_for_product ( $request_ref, $product_ref, $fields ) Using the fields parameter, API product or search queries can request @@ -642,6 +693,11 @@ sub customize_response_for_product ($request_ref, $product_ref, $fields) { $customized_product_ref->{$field} = get_images_to_update($product_ref, $target_lc); } + # Packagings data + elsif ($field eq "packagings") { + $customized_product_ref->{$field} = customize_packagings($request_ref, $product_ref); + } + # straight fields elsif ((not defined $customized_product_ref->{$field}) and (defined $product_ref->{$field})) { $customized_product_ref->{$field} = $product_ref->{$field}; diff --git a/lib/ProductOpener/Packaging.pm b/lib/ProductOpener/Packaging.pm index b86de499d11c2..3a02336d69465 100644 --- a/lib/ProductOpener/Packaging.pm +++ b/lib/ProductOpener/Packaging.pm @@ -49,6 +49,7 @@ BEGIN { &parse_packaging_component_data_from_text_phrase &guess_language_of_packaging_text + %packaging_taxonomies ); # symbols to export on request %EXPORT_TAGS = (all => [@EXPORT_OK]); } @@ -96,7 +97,7 @@ packaging shapes, materials etc. that we want to recognize in packaging text. =cut -my %packaging_taxonomies = ( +%packaging_taxonomies = ( "shape" => "packaging_shapes", "material" => "packaging_materials", "recycling" => "packaging_recycling" @@ -426,10 +427,20 @@ sub get_checked_and_taxonomized_packaging_component_data ($tags_lc, $input_packa } # Shape, material and recycling - foreach my $property ("recycling", "material", "shape") { + foreach my $property ("shape", "material", "recycling") { my $tagtype = $packaging_taxonomies{$property}; if (defined $input_packaging_ref->{$property}) { + + # the API specifies that the property is a hash with either an id or a lc_name field + # (same structure as when the packagings structure is read) + # both will be treated the same way and be canonicalized + + if (ref($input_packaging_ref->{$property}) eq 'HASH') { + $input_packaging_ref->{$property} + = $input_packaging_ref->{$property}{id} || $input_packaging_ref->{$property}{lc_name}; + } + my $tagid = canonicalize_taxonomy_tag($tags_lc, $tagtype, $input_packaging_ref->{$property}); $log->debug( "canonicalize input value", diff --git a/po/common/common.pot b/po/common/common.pot index fdb4ff2110db6..1680e2b5562b4 100644 --- a/po/common/common.pot +++ b/po/common/common.pot @@ -6383,6 +6383,10 @@ msgctxt "api_message_invalid_json_in_request_body" msgid "Invalid JSON in request body" msgstr "Invalid JSON in request body" +msgctxt "api_message_invalid_type_must_be_object" +msgid "Invalid type: must be an object" +msgstr "Invalid type: must be an object" + msgctxt "api_message_invalid_type_must_be_array" msgid "Invalid type: must be an array" msgstr "Invalid type: must be an array" diff --git a/po/common/en.po b/po/common/en.po index e1e75e3ca2aae..6877611b2412a 100644 --- a/po/common/en.po +++ b/po/common/en.po @@ -6383,6 +6383,10 @@ msgctxt "api_message_invalid_json_in_request_body" msgid "Invalid JSON in request body" msgstr "Invalid JSON in request body" +msgctxt "api_message_invalid_type_must_be_object" +msgid "Invalid type: must be an object" +msgstr "Invalid type: must be an object" + msgctxt "api_message_invalid_type_must_be_array" msgid "Invalid type: must be an array" msgstr "Invalid type: must be an array" diff --git a/taxonomies/packaging_materials.txt b/taxonomies/packaging_materials.txt index 02473664f257a..ff66bbaa7fdfa 100644 --- a/taxonomies/packaging_materials.txt +++ b/taxonomies/packaging_materials.txt @@ -658,7 +658,7 @@ fr:Aluminium léger, aluminium fin nl:Dun aluminium pt:Alumínio leve, alumínio fino, alumínio maleável -en:Wood +en:Wood, wooden bg:Дърво da:Træ de:Holz diff --git a/tests/integration/api_v2_product_read.t b/tests/integration/api_v2_product_read.t index 0737337957519..f88a70ef2b8e9 100644 --- a/tests/integration/api_v2_product_read.t +++ b/tests/integration/api_v2_product_read.t @@ -35,6 +35,8 @@ my @products = ( categories => "cookies", labels => "organic", origin => "france", + packaging_text_en => + "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", ) }, ); @@ -92,6 +94,22 @@ my $tests_ref = [ query_string => '?fields=knowledge_panels&lc=fr', expected_status_code => 200, }, + { + test_case => 'get-packagings', + method => 'GET', + path => '/api/v2/product/200000000034', + query_string => '?fields=packagings', + expected_status_code => 200, + }, + # test that on v2 tags_lc parameter have no effects + # packaging part should be exactly the same as get-packagings + { + test_case => 'get-packagings-fr', + method => 'GET', + path => '/api/v2/product/200000000034', + query_string => '?fields=packagings&tags_lc=fr', + expected_status_code => 200, + }, ]; execute_api_tests(__FILE__, $tests_ref); diff --git a/tests/integration/api_v3_product_read.t b/tests/integration/api_v3_product_read.t index 0cce139b48be2..9e5d9cd613589 100644 --- a/tests/integration/api_v3_product_read.t +++ b/tests/integration/api_v3_product_read.t @@ -35,6 +35,8 @@ my @products = ( categories => "cookies", labels => "organic", origin => "france", + packaging_text_en => + "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", ) }, ); @@ -99,6 +101,20 @@ my $tests_ref = [ query_string => '?fields=knowledge_panels&lc=fr', expected_status_code => 200, }, + { + test_case => 'get-packagings', + method => 'GET', + path => '/api/v3/product/200000000034', + query_string => '?fields=packagings', + expected_status_code => 200, + }, + { + test_case => 'get-packagings-fr', + method => 'GET', + path => '/api/v3/product/200000000034', + query_string => '?fields=packagings&tags_lc=fr', + expected_status_code => 200, + }, ]; execute_api_tests(__FILE__, $tests_ref); diff --git a/tests/integration/api_v3_product_write.t b/tests/integration/api_v3_product_write.t index 5dabf767d90f8..9a04526742dc5 100644 --- a/tests/integration/api_v3_product_write.t +++ b/tests/integration/api_v3_product_write.t @@ -51,32 +51,32 @@ my $tests_ref = [ test_case => 'patch-packagings-add-not-array', method => 'PATCH', path => '/api/v3/product/1234567890006', - body => '{"product": {"packagings_add": {"shape": "bottle"}}}' + body => '{"product": {"packagings_add": {"shape": {"lc_name": "bottle"}}}}' }, { test_case => 'patch-packagings-add-one-component', method => 'PATCH', path => '/api/v3/product/1234567890007', - body => '{"product": {"fields": "updated", "packagings_add": [{"shape": "bottle"}]}}' + body => '{"product": {"fields": "updated", "packagings_add": [{"shape": {"lc_name": "bottle"}}]}}' }, # Only the PATCH method is valid, test other methods { test_case => 'post-packagings', method => 'POST', path => '/api/v3/product/1234567890007', - body => '{"product": {"fields": "updated", "packagings": [{"shape": "bottle"}]}}' + body => '{"product": {"fields": "updated", "packagings": [{"shape": {"lc_name": "bottle"}}]}}' }, { test_case => 'put-packagings', method => 'PUT', path => '/api/v3/product/1234567890007', - body => '{"product": {"fields": "updated", "packagings": [{"shape": "bottle"}]}}' + body => '{"product": {"fields": "updated", "packagings": [{"shape": {"lc_name": "bottle"}}]}}' }, { test_case => 'delete-packagings', method => 'DELETE', path => '/api/v3/product/1234567890007', - body => '{"product": {"fields": "updated", "packagings": [{"shape": "bottle"}]}}' + body => '{"product": {"fields": "updated", "packagings": [{"shape": {"lc_name": "bottle"}}]}}' }, { test_case => 'patch-packagings-add-components-to-existing-product', @@ -88,15 +88,15 @@ my $tests_ref = [ "packagings_add": [ { "number_of_units": 2, - "shape": "en:bottle", - "material": "plastic", - "recycling": "strange value" + "shape": {"id": "en:bottle"}, + "material": {"lc_name": "plastic"}, + "recycling": {"lc_name": "strange value"} }, { "number_of_units": 1, - "shape": "en:box", - "material": "cardboard", - "recycling": "to recycle" + "shape": {"id": "en:box"}, + "material": {"lc_name": "cardboard"}, + "recycling": {"lc_name": "to recycle"} } ] } @@ -113,14 +113,14 @@ my $tests_ref = [ "packagings_add": [ { "number_of_units": 3, - "shape": "bouteille", - "material": "plastique" + "shape": {"lc_name": "bouteille"}, + "material": {"lc_name": "plastique"} }, { "number_of_units": 4, - "shape": "pot", - "material": "verre", - "recycling": "à recycler" + "shape": {"lc_name": "pot"}, + "material": {"lc_name": "verre"}, + "recycling": {"lc_name": "à recycler"} } ] } @@ -137,15 +137,15 @@ my $tests_ref = [ "packagings_add": [ { "number_of_units": 6, - "shape": "bottle", - "material": "PET", + "shape": {"lc_name": "bottle"}, + "material": {"lc_name": "PET"}, "quantity_per_unit": "25cl", "weight_measured": 10 }, { "number_of_units": 1, - "shape": "box", - "material": "wood", + "shape": {"lc_name": "box"}, + "material": {"lc_name": "wood"}, "weight_specified": 25.5 } ] @@ -163,14 +163,14 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, "weight_measured": 10.5 }, { "number_of_units": 1, - "shape": "label", - "material": "paper", + "shape": {"lc_name": "label"}, + "material": {"lc_name": "paper"}, "weight_specified": 0.25 } ] @@ -187,8 +187,8 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, } ] } @@ -205,8 +205,8 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, } ] } @@ -223,8 +223,8 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, } ] } @@ -241,8 +241,8 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, } ] } @@ -259,8 +259,8 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, } ] } @@ -277,8 +277,80 @@ my $tests_ref = [ "packagings": [ { "number_of_units": 1, - "shape": "bag", - "material": "plastic", + "shape": {"lc_name": "bag"}, + "material": {"lc_name": "plastic"}, + } + ] + } + }' + }, + { + test_case => 'patch-properties-with-lc-name', + method => 'PATCH', + path => '/api/v3/product/1234567890010', + body => '{ + "tags_lc": "en", + "product": { + "packagings": [ + { + "number_of_units": 2, + "shape": {"lc_name": "film"}, + "material": {"lc_name": "PET"}, + "recycling": {"lc_name": "discard"} + } + ] + } + }' + }, + { + test_case => 'patch-properties-with-lc-name-fr', + method => 'PATCH', + path => '/api/v3/product/1234567890011', + body => '{ + "tags_lc": "fr", + "product": { + "packagings": [ + { + "number_of_units": 2, + "shape": {"lc_name": "sachet"}, + "material": {"lc_name": "papier"}, + "recycling": {"lc_name": "à recycler"} + } + ] + } + }' + }, + { + test_case => 'patch-properties-with-lc-name-fr-and-spanish', + method => 'PATCH', + path => '/api/v3/product/1234567890012', + body => '{ + "tags_lc": "fr", + "product": { + "packagings": [ + { + "number_of_units": 2, + "shape": {"lc_name": "es:Caja"}, + "material": {"lc_name": "papier"}, + "recycling": {"lc_name": "à recycler"} + } + ] + } + }' + }, + { + test_case => 'patch-properties-with-lc-name-fr-and-unrecognized-spanish', + method => 'PATCH', + path => '/api/v3/product/1234567890012', + body => '{ + "tags_lc": "fr", + "product": { + "packagings": [ + { + "number_of_units": 2, + "shape": {"lc_name": "es:Something in Spanish"}, + "material": {"lc_name": "papier"}, + "recycling": {"lc_name": "à recycler"} } ] } diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json index a6288854d4dba..3b70df5be9425 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json @@ -76,7 +76,7 @@ "data_quality_bugs_tags" : [], "data_quality_errors_tags" : [], "data_quality_info_tags" : [ - "en:no-packaging-data", + "en:packaging-data-incomplete", "en:ingredients-percent-analysis-ok", "en:ecoscore-extended-data-not-computed", "en:food-groups-1-known", @@ -84,19 +84,17 @@ "en:food-groups-3-unknown" ], "data_quality_tags" : [ - "en:no-packaging-data", + "en:packaging-data-incomplete", "en:ingredients-percent-analysis-ok", "en:ecoscore-extended-data-not-computed", "en:food-groups-1-known", "en:food-groups-2-known", "en:food-groups-3-unknown", "en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown", - "en:ecoscore-packaging-packaging-data-missing", "en:ecoscore-production-system-no-label" ], "data_quality_warnings_tags" : [ "en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown", - "en:ecoscore-packaging-packaging-data-missing", "en:ecoscore-production-system-no-label" ], "ecoscore_data" : { @@ -311,9 +309,47 @@ "warning" : "origins_are_100_percent_unknown" }, "packaging" : { - "non_recyclable_and_non_biodegradable_materials" : 1, - "value" : -15, - "warning" : "packaging_data_missing" + "non_recyclable_and_non_biodegradable_materials" : 0, + "packagings" : [ + { + "ecoscore_material_score" : 50, + "ecoscore_shape_ratio" : 1, + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "ecoscore_material_score" : 81, + "ecoscore_shape_ratio" : 1, + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "ecoscore_material_score" : 76, + "ecoscore_shape_ratio" : 0.2, + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "ecoscore_material_score" : 0, + "ecoscore_shape_ratio" : 0.1, + "material" : "en:plastic", + "non_recyclable_and_non_biodegradable" : "maybe", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ], + "score" : 16.2, + "value" : -8 }, "production_system" : { "labels" : [], @@ -416,81 +452,79 @@ }, "missing" : { "labels" : 1, - "origins" : 1, - "packagings" : 1 + "origins" : 1 }, "missing_data_warning" : 1, - "missing_key_data" : 1, - "score" : 28, + "score" : 35, "scores" : { - "ad" : 28, - "al" : 28, - "at" : 28, - "ax" : 28, - "ba" : 28, - "be" : 28, - "bg" : 28, - "ch" : 28, - "cy" : 28, - "cz" : 28, - "de" : 28, - "dk" : 28, - "dz" : 28, - "ee" : 28, - "eg" : 28, - "es" : 28, - "fi" : 28, - "fo" : 28, - "fr" : 28, - "gg" : 28, - "gi" : 28, - "gr" : 28, - "hr" : 28, - "hu" : 28, - "ie" : 28, - "il" : 28, - "im" : 28, - "is" : 28, - "it" : 28, - "je" : 28, - "lb" : 28, - "li" : 28, - "lt" : 28, - "lu" : 28, - "lv" : 28, - "ly" : 28, - "ma" : 28, - "mc" : 28, - "md" : 28, - "me" : 28, - "mk" : 28, - "mt" : 28, - "nl" : 28, - "no" : 28, - "pl" : 28, - "ps" : 28, - "pt" : 28, - "ro" : 28, - "rs" : 28, - "se" : 28, - "si" : 28, - "sj" : 28, - "sk" : 28, - "sm" : 28, - "sy" : 28, - "tn" : 28, - "tr" : 28, - "ua" : 28, - "uk" : 28, - "us" : 28, - "va" : 28, - "world" : 28, - "xk" : 28 + "ad" : 35, + "al" : 35, + "at" : 35, + "ax" : 35, + "ba" : 35, + "be" : 35, + "bg" : 35, + "ch" : 35, + "cy" : 35, + "cz" : 35, + "de" : 35, + "dk" : 35, + "dz" : 35, + "ee" : 35, + "eg" : 35, + "es" : 35, + "fi" : 35, + "fo" : 35, + "fr" : 35, + "gg" : 35, + "gi" : 35, + "gr" : 35, + "hr" : 35, + "hu" : 35, + "ie" : 35, + "il" : 35, + "im" : 35, + "is" : 35, + "it" : 35, + "je" : 35, + "lb" : 35, + "li" : 35, + "lt" : 35, + "lu" : 35, + "lv" : 35, + "ly" : 35, + "ma" : 35, + "mc" : 35, + "md" : 35, + "me" : 35, + "mk" : 35, + "mt" : 35, + "nl" : 35, + "no" : 35, + "pl" : 35, + "ps" : 35, + "pt" : 35, + "ro" : 35, + "rs" : 35, + "se" : 35, + "si" : 35, + "sj" : 35, + "sk" : 35, + "sm" : 35, + "sy" : 35, + "tn" : 35, + "tr" : 35, + "ua" : 35, + "uk" : 35, + "us" : 35, + "va" : 35, + "world" : 35, + "xk" : 35 }, "status" : "known" }, "ecoscore_grade" : "d", - "ecoscore_score" : 28, + "ecoscore_score" : 35, "ecoscore_tags" : [ "d" ], @@ -650,10 +684,10 @@ ], "lang" : "en", "languages" : { - "en:english" : 4 + "en:english" : 5 }, "languages_codes" : { - "en" : 4 + "en" : 5 }, "languages_hierarchy" : [ "en:english" @@ -685,8 +719,6 @@ "en:ecoscore-missing-data-warning", "en:ecoscore-missing-data-labels", "en:ecoscore-missing-data-origins", - "en:ecoscore-missing-data-packagings", - "en:ecoscore-missing-data-no-packagings", "en:ecoscore-computed", "en:forest-footprint-computed", "en:forest-footprint-a", @@ -727,7 +759,37 @@ "origin" : "france", "origin_en" : "france", "other_nutritional_substances_tags" : [], - "packagings" : [], + "packaging_text" : "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", + "packaging_text_en" : "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", + "packagings" : [ + { + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "material" : "en:plastic", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ], "photographers_tags" : [], "pnns_groups_1" : "Sugary snacks", "pnns_groups_1_tags" : [ diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json index 361b5e7c99964..935c2ae4c64a4 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json @@ -330,28 +330,112 @@ "ecoscore_packaging" : { "elements" : [ { - "element_type" : "text", - "text_element" : { - "html" : "\n Les informations sur l'emballage de ce produit ne sont pas renseignées.\n ", - "type" : "warning" - } - }, - { - "element_type" : "text", - "text_element" : { - "html" : "\n Pour un calcul plus précis de l'Eco-Score, vous pouvez modifier la fiche produit et les ajouter.\n

\n Si vous êtes le fabricant de ce produit, vous pouvez nous transmettre les informations avec notre plateforme gratuite pour les producteurs.\n ", - "type" : "warning" + "element_type" : "table", + "table_element" : { + "columns" : [ + { + "text" : "Forme", + "type" : "text" + }, + { + "text" : "Matière", + "type" : "text" + }, + { + "text" : "Recyclage", + "type" : "text" + }, + { + "text" : "Impact", + "type" : "text" + } + ], + "id" : "ecoscore_packaging_components", + "rows" : [ + { + "values" : [ + { + "text" : "1 Boîte" + }, + { + "text" : "Bois" + }, + { + "evaluation" : "good", + "text" : "Recycler" + }, + { + "evaluation" : "neutral", + "text" : "Moyen" + } + ] + }, + { + "values" : [ + { + "text" : "6 Bouteille" + }, + { + "text" : "Verre" + }, + { + "text" : "Réutiliser" + }, + { + "evaluation" : "good", + "text" : "Faible" + } + ] + }, + { + "values" : [ + { + "text" : "3 Couvercle" + }, + { + "text" : "Acier" + }, + { + "evaluation" : "good", + "text" : "Recycler" + }, + { + "evaluation" : "good", + "text" : "Faible" + } + ] + }, + { + "values" : [ + { + "text" : "1 Film" + }, + { + "text" : "Plastique" + }, + { + "evaluation" : "bad", + "text" : "Jeter" + }, + { + "evaluation" : "bad", + "text" : "élevé" + } + ] + } + ], + "title" : "Parties de l'emballage" } } ], - "evaluation" : "unknown", + "evaluation" : "average", "level" : "info", "title_element" : { "icon_color_from_evaluation" : true, "icon_size" : "small", "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "subtitle" : "Malus : -15", - "title" : "Informations d'emballage manquantes pour ce produit" + "subtitle" : "Malus : -8", + "title" : "Emballage à impact moyen" }, "topics" : [ "environment" @@ -398,7 +482,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Score d'analyse du cycle de vie : 58
\n Somme des bonus et malus :\n \n -30\n

\n Score final : 28/100\n \n ", + "html" : "\n Score d'analyse du cycle de vie : 58
\n Somme des bonus et malus :\n \n -23\n

\n Score final : 35/100\n \n ", "type" : "summary" } } @@ -407,7 +491,7 @@ "title_element" : { "grade" : "d", "subtitle" : "Produit : Some product - 100 g", - "title" : "Impact pour ce produit: D (Score: 28/100)", + "title" : "Impact pour ce produit: D (Score: 35/100)", "type" : "grade" }, "topics" : [ @@ -963,18 +1047,33 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Les informations sur l'emballage de ce produit ne sont pas renseignées.\n ", - "type" : "warning" + "evaluation" : "good", + "html" : "\n \n \n Boîte\n \n (Bois)\n \n
\n \n \n \n \n \n Couvercle\n \n (Acier)\n \n
\n \n \n \n \n ", + "icon_alt" : "Recycler", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/recycle-variant.svg", + "type" : "summary" + } + }, + { + "element_type" : "text", + "text_element" : { + "evaluation" : "bad", + "html" : "\n \n \n \n \n \n \n \n \n Film\n \n (Plastique)\n \n
\n \n \n ", + "icon_alt" : "Jeter", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/delete.svg", + "type" : "summary" } } ], - "evaluation" : "unknown", + "evaluation" : "average", + "expanded" : true, "level" : "info", "title_element" : { - "evaluation" : "neutral", "icon_color_from_evaluation" : true, "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "title" : "Informations d'emballage manquantes pour ce produit" + "title" : "Emballage à impact moyen" }, "topics" : [ "environment" diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json index ad0bbb68960f5..688d941f5806c 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json @@ -330,28 +330,112 @@ "ecoscore_packaging" : { "elements" : [ { - "element_type" : "text", - "text_element" : { - "html" : "\n The information about the packaging of this product is not filled in.\n ", - "type" : "warning" - } - }, - { - "element_type" : "text", - "text_element" : { - "html" : "\n For a more precise calculation of the Eco-Score, you can modify the product page and add them.\n

\n If you are the manufacturer of this product, you can send us the information with our free platform for producers.\n ", - "type" : "warning" + "element_type" : "table", + "table_element" : { + "columns" : [ + { + "text" : "Shape", + "type" : "text" + }, + { + "text" : "Material", + "type" : "text" + }, + { + "text" : "Recycling", + "type" : "text" + }, + { + "text" : "Impact", + "type" : "text" + } + ], + "id" : "ecoscore_packaging_components", + "rows" : [ + { + "values" : [ + { + "text" : "1 Box" + }, + { + "text" : "Wood" + }, + { + "evaluation" : "good", + "text" : "Recycle" + }, + { + "evaluation" : "neutral", + "text" : "Medium" + } + ] + }, + { + "values" : [ + { + "text" : "6 Bottle" + }, + { + "text" : "Glass" + }, + { + "text" : "Reuse" + }, + { + "evaluation" : "good", + "text" : "Low" + } + ] + }, + { + "values" : [ + { + "text" : "3 Lid" + }, + { + "text" : "Steel" + }, + { + "evaluation" : "good", + "text" : "Recycle" + }, + { + "evaluation" : "good", + "text" : "Low" + } + ] + }, + { + "values" : [ + { + "text" : "1 Film" + }, + { + "text" : "Plastic" + }, + { + "evaluation" : "bad", + "text" : "Discard" + }, + { + "evaluation" : "bad", + "text" : "High" + } + ] + } + ], + "title" : "Packaging parts" } } ], - "evaluation" : "unknown", + "evaluation" : "average", "level" : "info", "title_element" : { "icon_color_from_evaluation" : true, "icon_size" : "small", "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "subtitle" : "Malus: -15", - "title" : "Missing packaging information for this product" + "subtitle" : "Malus: -8", + "title" : "Packaging with a medium impact" }, "topics" : [ "environment" @@ -398,7 +482,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Life cycle analysis score: 58
\n Sum of bonuses and maluses:\n \n -30\n

\n Final score: 28/100\n \n ", + "html" : "\n Life cycle analysis score: 58
\n Sum of bonuses and maluses:\n \n -23\n

\n Final score: 35/100\n \n ", "type" : "summary" } } @@ -407,7 +491,7 @@ "title_element" : { "grade" : "d", "subtitle" : "Product: Some product - 100 g", - "title" : "Impact for this product: D (Score: 28/100)", + "title" : "Impact for this product: D (Score: 35/100)", "type" : "grade" }, "topics" : [ @@ -963,18 +1047,33 @@ { "element_type" : "text", "text_element" : { - "html" : "\n The information about the packaging of this product is not filled in.\n ", - "type" : "warning" + "evaluation" : "good", + "html" : "\n \n \n Box\n \n (Wood)\n \n
\n \n \n \n \n \n Lid\n \n (Steel)\n \n
\n \n \n \n \n ", + "icon_alt" : "Recycle", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/recycle-variant.svg", + "type" : "summary" + } + }, + { + "element_type" : "text", + "text_element" : { + "evaluation" : "bad", + "html" : "\n \n \n \n \n \n \n \n \n Film\n \n (Plastic)\n \n
\n \n \n ", + "icon_alt" : "Discard", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/delete.svg", + "type" : "summary" } } ], - "evaluation" : "unknown", + "evaluation" : "average", + "expanded" : true, "level" : "info", "title_element" : { - "evaluation" : "neutral", "icon_color_from_evaluation" : true, "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "title" : "Missing packaging information for this product" + "title" : "Packaging with a medium impact" }, "topics" : [ "environment" diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-packagings-fr.json b/tests/integration/expected_test_results/api_v2_product_read/get-packagings-fr.json new file mode 100644 index 0000000000000..709f0ee58e6dc --- /dev/null +++ b/tests/integration/expected_test_results/api_v2_product_read/get-packagings-fr.json @@ -0,0 +1,36 @@ +{ + "code" : "200000000034", + "product" : { + "packagings" : [ + { + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "material" : "en:plastic", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ] + }, + "status" : 1, + "status_verbose" : "product found" +} diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-packagings.json b/tests/integration/expected_test_results/api_v2_product_read/get-packagings.json new file mode 100644 index 0000000000000..709f0ee58e6dc --- /dev/null +++ b/tests/integration/expected_test_results/api_v2_product_read/get-packagings.json @@ -0,0 +1,36 @@ +{ + "code" : "200000000034", + "product" : { + "packagings" : [ + { + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "material" : "en:plastic", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ] + }, + "status" : 1, + "status_verbose" : "product found" +} diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json index 99ce27e1ff616..96e957665a580 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json @@ -77,7 +77,7 @@ "data_quality_bugs_tags" : [], "data_quality_errors_tags" : [], "data_quality_info_tags" : [ - "en:no-packaging-data", + "en:packaging-data-incomplete", "en:ingredients-percent-analysis-ok", "en:ecoscore-extended-data-not-computed", "en:food-groups-1-known", @@ -85,19 +85,17 @@ "en:food-groups-3-unknown" ], "data_quality_tags" : [ - "en:no-packaging-data", + "en:packaging-data-incomplete", "en:ingredients-percent-analysis-ok", "en:ecoscore-extended-data-not-computed", "en:food-groups-1-known", "en:food-groups-2-known", "en:food-groups-3-unknown", "en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown", - "en:ecoscore-packaging-packaging-data-missing", "en:ecoscore-production-system-no-label" ], "data_quality_warnings_tags" : [ "en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown", - "en:ecoscore-packaging-packaging-data-missing", "en:ecoscore-production-system-no-label" ], "ecoscore_data" : { @@ -312,9 +310,47 @@ "warning" : "origins_are_100_percent_unknown" }, "packaging" : { - "non_recyclable_and_non_biodegradable_materials" : 1, - "value" : -15, - "warning" : "packaging_data_missing" + "non_recyclable_and_non_biodegradable_materials" : 0, + "packagings" : [ + { + "ecoscore_material_score" : 50, + "ecoscore_shape_ratio" : 1, + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "ecoscore_material_score" : 81, + "ecoscore_shape_ratio" : 1, + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "ecoscore_material_score" : 76, + "ecoscore_shape_ratio" : 0.2, + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "ecoscore_material_score" : 0, + "ecoscore_shape_ratio" : 0.1, + "material" : "en:plastic", + "non_recyclable_and_non_biodegradable" : "maybe", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ], + "score" : 16.2, + "value" : -8 }, "production_system" : { "labels" : [], @@ -417,81 +453,79 @@ }, "missing" : { "labels" : 1, - "origins" : 1, - "packagings" : 1 + "origins" : 1 }, "missing_data_warning" : 1, - "missing_key_data" : 1, - "score" : 28, + "score" : 35, "scores" : { - "ad" : 28, - "al" : 28, - "at" : 28, - "ax" : 28, - "ba" : 28, - "be" : 28, - "bg" : 28, - "ch" : 28, - "cy" : 28, - "cz" : 28, - "de" : 28, - "dk" : 28, - "dz" : 28, - "ee" : 28, - "eg" : 28, - "es" : 28, - "fi" : 28, - "fo" : 28, - "fr" : 28, - "gg" : 28, - "gi" : 28, - "gr" : 28, - "hr" : 28, - "hu" : 28, - "ie" : 28, - "il" : 28, - "im" : 28, - "is" : 28, - "it" : 28, - "je" : 28, - "lb" : 28, - "li" : 28, - "lt" : 28, - "lu" : 28, - "lv" : 28, - "ly" : 28, - "ma" : 28, - "mc" : 28, - "md" : 28, - "me" : 28, - "mk" : 28, - "mt" : 28, - "nl" : 28, - "no" : 28, - "pl" : 28, - "ps" : 28, - "pt" : 28, - "ro" : 28, - "rs" : 28, - "se" : 28, - "si" : 28, - "sj" : 28, - "sk" : 28, - "sm" : 28, - "sy" : 28, - "tn" : 28, - "tr" : 28, - "ua" : 28, - "uk" : 28, - "us" : 28, - "va" : 28, - "world" : 28, - "xk" : 28 + "ad" : 35, + "al" : 35, + "at" : 35, + "ax" : 35, + "ba" : 35, + "be" : 35, + "bg" : 35, + "ch" : 35, + "cy" : 35, + "cz" : 35, + "de" : 35, + "dk" : 35, + "dz" : 35, + "ee" : 35, + "eg" : 35, + "es" : 35, + "fi" : 35, + "fo" : 35, + "fr" : 35, + "gg" : 35, + "gi" : 35, + "gr" : 35, + "hr" : 35, + "hu" : 35, + "ie" : 35, + "il" : 35, + "im" : 35, + "is" : 35, + "it" : 35, + "je" : 35, + "lb" : 35, + "li" : 35, + "lt" : 35, + "lu" : 35, + "lv" : 35, + "ly" : 35, + "ma" : 35, + "mc" : 35, + "md" : 35, + "me" : 35, + "mk" : 35, + "mt" : 35, + "nl" : 35, + "no" : 35, + "pl" : 35, + "ps" : 35, + "pt" : 35, + "ro" : 35, + "rs" : 35, + "se" : 35, + "si" : 35, + "sj" : 35, + "sk" : 35, + "sm" : 35, + "sy" : 35, + "tn" : 35, + "tr" : 35, + "ua" : 35, + "uk" : 35, + "us" : 35, + "va" : 35, + "world" : 35, + "xk" : 35 }, "status" : "known" }, "ecoscore_grade" : "d", - "ecoscore_score" : 28, + "ecoscore_score" : 35, "ecoscore_tags" : [ "d" ], @@ -651,10 +685,10 @@ ], "lang" : "en", "languages" : { - "en:english" : 4 + "en:english" : 5 }, "languages_codes" : { - "en" : 4 + "en" : 5 }, "languages_hierarchy" : [ "en:english" @@ -686,8 +720,6 @@ "en:ecoscore-missing-data-warning", "en:ecoscore-missing-data-labels", "en:ecoscore-missing-data-origins", - "en:ecoscore-missing-data-packagings", - "en:ecoscore-missing-data-no-packagings", "en:ecoscore-computed", "en:forest-footprint-computed", "en:forest-footprint-a", @@ -728,7 +760,37 @@ "origin" : "france", "origin_en" : "france", "other_nutritional_substances_tags" : [], - "packagings" : [], + "packaging_text" : "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", + "packaging_text_en" : "1 wooden box to recycle, 6 25cl glass bottles to reuse, 3 steel lids to recycle, 1 plastic film to discard", + "packagings" : [ + { + "material" : "en:wood", + "number_of_units" : 1, + "recycling" : "en:recycle", + "shape" : "en:box" + }, + { + "material" : "en:glass", + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : "en:reuse", + "shape" : "en:bottle" + }, + { + "material" : "en:steel", + "number_of_units" : 3, + "recycling" : "en:recycle", + "shape" : "en:lid" + }, + { + "material" : "en:plastic", + "number_of_units" : 1, + "recycling" : "en:discard", + "shape" : "en:film" + } + ], "photographers_tags" : [], "pnns_groups_1" : "Sugary snacks", "pnns_groups_1_tags" : [ diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json index c88bdd57453d2..f0da1a3cee65b 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json @@ -331,28 +331,112 @@ "ecoscore_packaging" : { "elements" : [ { - "element_type" : "text", - "text_element" : { - "html" : "\n Les informations sur l'emballage de ce produit ne sont pas renseignées.\n ", - "type" : "warning" - } - }, - { - "element_type" : "text", - "text_element" : { - "html" : "\n Pour un calcul plus précis de l'Eco-Score, vous pouvez modifier la fiche produit et les ajouter.\n

\n Si vous êtes le fabricant de ce produit, vous pouvez nous transmettre les informations avec notre plateforme gratuite pour les producteurs.\n ", - "type" : "warning" + "element_type" : "table", + "table_element" : { + "columns" : [ + { + "text" : "Forme", + "type" : "text" + }, + { + "text" : "Matière", + "type" : "text" + }, + { + "text" : "Recyclage", + "type" : "text" + }, + { + "text" : "Impact", + "type" : "text" + } + ], + "id" : "ecoscore_packaging_components", + "rows" : [ + { + "values" : [ + { + "text" : "1 Boîte" + }, + { + "text" : "Bois" + }, + { + "evaluation" : "good", + "text" : "Recycler" + }, + { + "evaluation" : "neutral", + "text" : "Moyen" + } + ] + }, + { + "values" : [ + { + "text" : "6 Bouteille" + }, + { + "text" : "Verre" + }, + { + "text" : "Réutiliser" + }, + { + "evaluation" : "good", + "text" : "Faible" + } + ] + }, + { + "values" : [ + { + "text" : "3 Couvercle" + }, + { + "text" : "Acier" + }, + { + "evaluation" : "good", + "text" : "Recycler" + }, + { + "evaluation" : "good", + "text" : "Faible" + } + ] + }, + { + "values" : [ + { + "text" : "1 Film" + }, + { + "text" : "Plastique" + }, + { + "evaluation" : "bad", + "text" : "Jeter" + }, + { + "evaluation" : "bad", + "text" : "élevé" + } + ] + } + ], + "title" : "Parties de l'emballage" } } ], - "evaluation" : "unknown", + "evaluation" : "average", "level" : "info", "title_element" : { "icon_color_from_evaluation" : true, "icon_size" : "small", "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "subtitle" : "Malus : -15", - "title" : "Informations d'emballage manquantes pour ce produit" + "subtitle" : "Malus : -8", + "title" : "Emballage à impact moyen" }, "topics" : [ "environment" @@ -399,7 +483,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Score d'analyse du cycle de vie : 58
\n Somme des bonus et malus :\n \n -30\n

\n Score final : 28/100\n \n ", + "html" : "\n Score d'analyse du cycle de vie : 58
\n Somme des bonus et malus :\n \n -23\n

\n Score final : 35/100\n \n ", "type" : "summary" } } @@ -408,7 +492,7 @@ "title_element" : { "grade" : "d", "subtitle" : "Produit : Some product - 100 g", - "title" : "Impact pour ce produit: D (Score: 28/100)", + "title" : "Impact pour ce produit: D (Score: 35/100)", "type" : "grade" }, "topics" : [ @@ -964,18 +1048,33 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Les informations sur l'emballage de ce produit ne sont pas renseignées.\n ", - "type" : "warning" + "evaluation" : "good", + "html" : "\n \n \n Boîte\n \n (Bois)\n \n
\n \n \n \n \n \n Couvercle\n \n (Acier)\n \n
\n \n \n \n \n ", + "icon_alt" : "Recycler", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/recycle-variant.svg", + "type" : "summary" + } + }, + { + "element_type" : "text", + "text_element" : { + "evaluation" : "bad", + "html" : "\n \n \n \n \n \n \n \n \n Film\n \n (Plastique)\n \n
\n \n \n ", + "icon_alt" : "Jeter", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/delete.svg", + "type" : "summary" } } ], - "evaluation" : "unknown", + "evaluation" : "average", + "expanded" : true, "level" : "info", "title_element" : { - "evaluation" : "neutral", "icon_color_from_evaluation" : true, "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "title" : "Informations d'emballage manquantes pour ce produit" + "title" : "Emballage à impact moyen" }, "topics" : [ "environment" diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json index da7820db7e6f3..0cf39e83ee6bd 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json @@ -331,28 +331,112 @@ "ecoscore_packaging" : { "elements" : [ { - "element_type" : "text", - "text_element" : { - "html" : "\n The information about the packaging of this product is not filled in.\n ", - "type" : "warning" - } - }, - { - "element_type" : "text", - "text_element" : { - "html" : "\n For a more precise calculation of the Eco-Score, you can modify the product page and add them.\n

\n If you are the manufacturer of this product, you can send us the information with our free platform for producers.\n ", - "type" : "warning" + "element_type" : "table", + "table_element" : { + "columns" : [ + { + "text" : "Shape", + "type" : "text" + }, + { + "text" : "Material", + "type" : "text" + }, + { + "text" : "Recycling", + "type" : "text" + }, + { + "text" : "Impact", + "type" : "text" + } + ], + "id" : "ecoscore_packaging_components", + "rows" : [ + { + "values" : [ + { + "text" : "1 Box" + }, + { + "text" : "Wood" + }, + { + "evaluation" : "good", + "text" : "Recycle" + }, + { + "evaluation" : "neutral", + "text" : "Medium" + } + ] + }, + { + "values" : [ + { + "text" : "6 Bottle" + }, + { + "text" : "Glass" + }, + { + "text" : "Reuse" + }, + { + "evaluation" : "good", + "text" : "Low" + } + ] + }, + { + "values" : [ + { + "text" : "3 Lid" + }, + { + "text" : "Steel" + }, + { + "evaluation" : "good", + "text" : "Recycle" + }, + { + "evaluation" : "good", + "text" : "Low" + } + ] + }, + { + "values" : [ + { + "text" : "1 Film" + }, + { + "text" : "Plastic" + }, + { + "evaluation" : "bad", + "text" : "Discard" + }, + { + "evaluation" : "bad", + "text" : "High" + } + ] + } + ], + "title" : "Packaging parts" } } ], - "evaluation" : "unknown", + "evaluation" : "average", "level" : "info", "title_element" : { "icon_color_from_evaluation" : true, "icon_size" : "small", "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "subtitle" : "Malus: -15", - "title" : "Missing packaging information for this product" + "subtitle" : "Malus: -8", + "title" : "Packaging with a medium impact" }, "topics" : [ "environment" @@ -399,7 +483,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n Life cycle analysis score: 58
\n Sum of bonuses and maluses:\n \n -30\n

\n Final score: 28/100\n \n ", + "html" : "\n Life cycle analysis score: 58
\n Sum of bonuses and maluses:\n \n -23\n

\n Final score: 35/100\n \n ", "type" : "summary" } } @@ -408,7 +492,7 @@ "title_element" : { "grade" : "d", "subtitle" : "Product: Some product - 100 g", - "title" : "Impact for this product: D (Score: 28/100)", + "title" : "Impact for this product: D (Score: 35/100)", "type" : "grade" }, "topics" : [ @@ -964,18 +1048,33 @@ { "element_type" : "text", "text_element" : { - "html" : "\n The information about the packaging of this product is not filled in.\n ", - "type" : "warning" + "evaluation" : "good", + "html" : "\n \n \n Box\n \n (Wood)\n \n
\n \n \n \n \n \n Lid\n \n (Steel)\n \n
\n \n \n \n \n ", + "icon_alt" : "Recycle", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/recycle-variant.svg", + "type" : "summary" + } + }, + { + "element_type" : "text", + "text_element" : { + "evaluation" : "bad", + "html" : "\n \n \n \n \n \n \n \n \n Film\n \n (Plastic)\n \n
\n \n \n ", + "icon_alt" : "Discard", + "icon_color_from_evaluation" : true, + "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/delete.svg", + "type" : "summary" } } ], - "evaluation" : "unknown", + "evaluation" : "average", + "expanded" : true, "level" : "info", "title_element" : { - "evaluation" : "neutral", "icon_color_from_evaluation" : true, "icon_url" : "http://static.openfoodfacts.localhost/images/icons/dist/packaging.svg", - "title" : "Missing packaging information for this product" + "title" : "Packaging with a medium impact" }, "topics" : [ "environment" diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-packagings-fr.json b/tests/integration/expected_test_results/api_v3_product_read/get-packagings-fr.json new file mode 100644 index 0000000000000..316bf9faed97d --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_read/get-packagings-fr.json @@ -0,0 +1,78 @@ +{ + "code" : "200000000034", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:wood", + "lc_name" : "Bois" + }, + "number_of_units" : 1, + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:box", + "lc_name" : "Boîte" + } + }, + { + "material" : { + "id" : "en:glass", + "lc_name" : "Verre" + }, + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : { + "id" : "en:reuse", + "lc_name" : "Réutiliser" + }, + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bouteille" + } + }, + { + "material" : { + "id" : "en:steel", + "lc_name" : "Acier" + }, + "number_of_units" : 3, + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:lid", + "lc_name" : "Couvercle" + } + }, + { + "material" : { + "id" : "en:plastic", + "lc_name" : "Plastique" + }, + "number_of_units" : 1, + "recycling" : { + "id" : "en:discard", + "lc_name" : "Jeter" + }, + "shape" : { + "id" : "en:film", + "lc_name" : "Film" + } + } + ] + }, + "result" : { + "id" : "product_found", + "lc_name" : "Product found", + "name" : "Product found" + }, + "status" : "success", + "warnings" : [] +} diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-packagings.json b/tests/integration/expected_test_results/api_v3_product_read/get-packagings.json new file mode 100644 index 0000000000000..527151e72f788 --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_read/get-packagings.json @@ -0,0 +1,66 @@ +{ + "code" : "200000000034", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:wood" + }, + "number_of_units" : 1, + "recycling" : { + "id" : "en:recycle" + }, + "shape" : { + "id" : "en:box" + } + }, + { + "material" : { + "id" : "en:glass" + }, + "number_of_units" : 6, + "quantity_per_unit" : "25cl", + "quantity_per_unit_unit" : "cl", + "quantity_per_unit_value" : 25, + "recycling" : { + "id" : "en:reuse" + }, + "shape" : { + "id" : "en:bottle" + } + }, + { + "material" : { + "id" : "en:steel" + }, + "number_of_units" : 3, + "recycling" : { + "id" : "en:recycle" + }, + "shape" : { + "id" : "en:lid" + } + }, + { + "material" : { + "id" : "en:plastic" + }, + "number_of_units" : 1, + "recycling" : { + "id" : "en:discard" + }, + "shape" : { + "id" : "en:film" + } + } + ] + }, + "result" : { + "id" : "product_found", + "lc_name" : "Product found", + "name" : "Product found" + }, + "status" : "success", + "warnings" : [] +} diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-components-to-existing-product.json b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-components-to-existing-product.json index 5070ba37a7964..aca76c7013a1b 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-components-to-existing-product.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-components-to-existing-product.json @@ -4,16 +4,34 @@ "product" : { "packagings" : [ { - "material" : "en:plastic", + "material" : { + "id" : "en:plastic", + "lc_name" : "Plastic" + }, "number_of_units" : 2, - "recycling" : "en:strange value", - "shape" : "en:bottle" + "recycling" : { + "id" : "en:strange value", + "lc_name" : "Strange value" + }, + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bottle" + } }, { - "material" : "en:cardboard", + "material" : { + "id" : "en:cardboard", + "lc_name" : "Cardboard" + }, "number_of_units" : 1, - "recycling" : "en:recycle", - "shape" : "en:box" + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycle" + }, + "shape" : { + "id" : "en:box", + "lc_name" : "Box" + } } ] }, diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-one-component.json b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-one-component.json index 1a957e93eb2f2..5ea1686363faa 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-one-component.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-add-one-component.json @@ -4,7 +4,10 @@ "product" : { "packagings" : [ { - "shape" : "en:bottle" + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bottle" + } } ] }, @@ -43,7 +46,7 @@ }, { "field" : { - "id" : "recycling", + "id" : "material", "value" : null }, "impact" : { @@ -59,7 +62,7 @@ }, { "field" : { - "id" : "material", + "id" : "recycling", "value" : null }, "impact" : { diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-fr-fields.json b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-fr-fields.json index 81d1c419d9ad3..639fb31cd561e 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-fr-fields.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-fr-fields.json @@ -4,27 +4,60 @@ "product" : { "packagings" : [ { - "material" : "en:plastic", + "material" : { + "id" : "en:plastic", + "lc_name" : "Plastique" + }, "number_of_units" : 2, - "recycling" : "en:strange value", - "shape" : "en:bottle" + "recycling" : { + "id" : "en:strange value", + "lc_name" : "en:strange value" + }, + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bouteille" + } }, { - "material" : "en:cardboard", + "material" : { + "id" : "en:cardboard", + "lc_name" : "Carton" + }, "number_of_units" : 1, - "recycling" : "en:recycle", - "shape" : "en:box" + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:box", + "lc_name" : "Boîte" + } }, { - "material" : "en:plastic", + "material" : { + "id" : "en:plastic", + "lc_name" : "Plastique" + }, "number_of_units" : 3, - "shape" : "en:bottle" + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bouteille" + } }, { - "material" : "en:glass", + "material" : { + "id" : "en:glass", + "lc_name" : "Verre" + }, "number_of_units" : 4, - "recycling" : "en:recycle", - "shape" : "en:pot" + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:pot", + "lc_name" : "Pot" + } } ] }, diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-quantity-and-weight.json b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-quantity-and-weight.json index 254e07c86796b..12298d91075ef 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-quantity-and-weight.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-packagings-quantity-and-weight.json @@ -4,18 +4,30 @@ "product" : { "packagings" : [ { - "material" : "en:pet-polyethylene-terephthalate", + "material" : { + "id" : "en:pet-polyethylene-terephthalate", + "lc_name" : "PET - Polyethylene terephthalate" + }, "number_of_units" : 6, "quantity_per_unit" : "25cl", "quantity_per_unit_unit" : "cl", "quantity_per_unit_value" : 25, - "shape" : "en:bottle", + "shape" : { + "id" : "en:bottle", + "lc_name" : "Bottle" + }, "weight_measured" : 10 }, { - "material" : "en:wood", + "material" : { + "id" : "en:wood", + "lc_name" : "Wood" + }, "number_of_units" : 1, - "shape" : "en:box", + "shape" : { + "id" : "en:box", + "lc_name" : "Box" + }, "weight_specified" : 25.5 } ] diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-spanish.json b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-spanish.json new file mode 100644 index 0000000000000..7a52c8b713d75 --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-spanish.json @@ -0,0 +1,25 @@ +{ + "code" : "1234567890012", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:paper", + "lc_name" : "Papier" + }, + "number_of_units" : 2, + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:box", + "lc_name" : "Boîte" + } + } + ] + }, + "status" : "success", + "warnings" : [] +} diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-unrecognized-spanish.json b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-unrecognized-spanish.json new file mode 100644 index 0000000000000..674d77f28917f --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr-and-unrecognized-spanish.json @@ -0,0 +1,42 @@ +{ + "code" : "1234567890012", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:paper", + "lc_name" : "Papier" + }, + "number_of_units" : 2, + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "es:Something in Spanish", + "lc_name" : "es:Something in Spanish" + } + } + ] + }, + "status" : "success_with_warnings", + "warnings" : [ + { + "field" : { + "id" : "shape", + "value" : "es:Something in Spanish" + }, + "impact" : { + "id" : "none", + "lc_name" : "None", + "name" : "None" + }, + "message" : { + "id" : "unrecognized_value", + "lc_name" : "Unrecognized value", + "name" : "Unrecognized value" + } + } + ] +} diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr.json b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr.json new file mode 100644 index 0000000000000..2375da7f4b56a --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name-fr.json @@ -0,0 +1,25 @@ +{ + "code" : "1234567890011", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:paper", + "lc_name" : "Papier" + }, + "number_of_units" : 2, + "recycling" : { + "id" : "en:recycle", + "lc_name" : "Recycler" + }, + "shape" : { + "id" : "en:bag", + "lc_name" : "Sachet" + } + } + ] + }, + "status" : "success", + "warnings" : [] +} diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name.json b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name.json new file mode 100644 index 0000000000000..c6d26f97363c5 --- /dev/null +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-properties-with-lc-name.json @@ -0,0 +1,25 @@ +{ + "code" : "1234567890010", + "errors" : [], + "product" : { + "packagings" : [ + { + "material" : { + "id" : "en:pet-polyethylene-terephthalate", + "lc_name" : "PET - Polyethylene terephthalate" + }, + "number_of_units" : 2, + "recycling" : { + "id" : "en:discard", + "lc_name" : "Discard" + }, + "shape" : { + "id" : "en:film", + "lc_name" : "Film" + } + } + ] + }, + "status" : "success", + "warnings" : [] +} diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-replace-packagings.json b/tests/integration/expected_test_results/api_v3_product_write/patch-replace-packagings.json index 9d0783c77dd91..a440fc9ca39e3 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-replace-packagings.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-replace-packagings.json @@ -4,15 +4,27 @@ "product" : { "packagings" : [ { - "material" : "en:plastic", + "material" : { + "id" : "en:plastic", + "lc_name" : "Plastic" + }, "number_of_units" : 1, - "shape" : "en:bag", + "shape" : { + "id" : "en:bag", + "lc_name" : "Bag" + }, "weight_measured" : 10.5 }, { - "material" : "en:paper", + "material" : { + "id" : "en:paper", + "lc_name" : "Paper" + }, "number_of_units" : 1, - "shape" : "en:label", + "shape" : { + "id" : "en:label", + "lc_name" : "Label" + }, "weight_specified" : 0.25 } ] diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json index 493718258a0b0..980be26fbc191 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"fields\": \"updated\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"fields\": \"updated\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-ecoscore-data.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-ecoscore-data.json index eef36c11d4794..7f79de22e43b0 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-ecoscore-data.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-ecoscore-data.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"fields\": \"ecoscore_data\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"fields\": \"ecoscore_data\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-none.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-none.json index 5afe287e32897..126b9a32ddce3 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-none.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-none.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"fields\": \"none\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"fields\": \"none\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-packagings.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-packagings.json index f357a9c3a8e25..4b2de370b9a6e 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-packagings.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-packagings.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"fields\": \"packagings\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"fields\": \"packagings\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-undef.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-undef.json index 3126b42419180..eb243aa519607 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-undef.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-undef.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated.json index 493718258a0b0..980be26fbc191 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated.json @@ -3,7 +3,7 @@ { "field" : { "id" : "body", - "value" : "{\n\t\t\t\"fields\": \"updated\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": \"bag\",\n\t\t\t\t\t\t\"material\": \"plastic\",\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" + "value" : "{\n\t\t\t\"fields\": \"updated\",\n\t\t\t\"tags_lc\": \"en\",\n\t\t\t\"product\": {\n\t\t\t\t\"packagings\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"number_of_units\": 1,\n\t\t\t\t\t\t\"shape\": {\"lc_name\": \"bag\"},\n\t\t\t\t\t\t\"material\": {\"lc_name\": \"plastic\"},\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}" }, "impact" : { "id" : "failure", diff --git a/tests/integration/expected_test_results/search_test/q1.json b/tests/integration/expected_test_results/search_test/q1.json index cb3ab333480b0..65014cefc6579 100644 --- a/tests/integration/expected_test_results/search_test/q1.json +++ b/tests/integration/expected_test_results/search_test/q1.json @@ -1,8 +1,8 @@ { "count" : 5, - "page" : 1, + "page" : "1", "page_count" : 5, - "page_size" : 24, + "page_size" : "24", "products" : [ { "_id" : "200000000034", @@ -61,7 +61,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -340,23 +340,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" } } ] @@ -370,7 +370,7 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : 62.5, + "percent_estimate" : "62.5", "percent_max" : 100, "percent_min" : 25, "rank" : 1, @@ -380,7 +380,7 @@ }, { "id" : "en:milk", - "percent_estimate" : 18.75, + "percent_estimate" : "18.75", "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -390,8 +390,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", @@ -401,7 +401,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, @@ -657,7 +657,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1202,7 +1202,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1478,23 +1478,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" } } ] @@ -1508,9 +1508,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", @@ -1518,7 +1518,7 @@ }, { "id" : "en:milk", - "percent_estimate" : 16.6666666666667, + "percent_estimate" : "16.6666666666667", "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -1528,8 +1528,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", @@ -1639,8 +1639,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 @@ -1770,7 +1770,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2058,15 +2058,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, @@ -2074,8 +2074,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" @@ -2331,7 +2331,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2599,22 +2599,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : 2.495352, + "co2_agriculture" : "2.495352", "co2_consumption" : 0, - "co2_distribution" : 0.029120657, - "co2_packaging" : 0.28587039, - "co2_processing" : 0.39369607, - "co2_total" : 3.4585877, - "co2_transportation" : 0.25433483, + "co2_distribution" : "0.029120657", + "co2_packaging" : "0.28587039", + "co2_processing" : "0.39369607", + "co2_total" : "3.4585877", + "co2_transportation" : "0.25433483", "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : 0.31523913, + "ef_agriculture" : "0.31523913", "ef_consumption" : 0, - "ef_distribution" : 0.0098990521, - "ef_packaging" : 0.021563312, - "ef_processing" : 0.055783332, - "ef_total" : 0.42581268, - "ef_transportation" : 0.023314705, + "ef_distribution" : "0.0098990521", + "ef_packaging" : "0.021563312", + "ef_processing" : "0.055783332", + "ef_total" : "0.42581268", + "ef_transportation" : "0.023314705", "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_test/q2.json b/tests/integration/expected_test_results/search_test/q2.json index cb3ab333480b0..65014cefc6579 100644 --- a/tests/integration/expected_test_results/search_test/q2.json +++ b/tests/integration/expected_test_results/search_test/q2.json @@ -1,8 +1,8 @@ { "count" : 5, - "page" : 1, + "page" : "1", "page_count" : 5, - "page_size" : 24, + "page_size" : "24", "products" : [ { "_id" : "200000000034", @@ -61,7 +61,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -340,23 +340,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" } } ] @@ -370,7 +370,7 @@ "ingredients" : [ { "id" : "en:apple", - "percent_estimate" : 62.5, + "percent_estimate" : "62.5", "percent_max" : 100, "percent_min" : 25, "rank" : 1, @@ -380,7 +380,7 @@ }, { "id" : "en:milk", - "percent_estimate" : 18.75, + "percent_estimate" : "18.75", "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -390,8 +390,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", @@ -401,7 +401,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, @@ -657,7 +657,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1202,7 +1202,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -1478,23 +1478,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" } } ] @@ -1508,9 +1508,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", @@ -1518,7 +1518,7 @@ }, { "id" : "en:milk", - "percent_estimate" : 16.6666666666667, + "percent_estimate" : "16.6666666666667", "percent_max" : 50, "percent_min" : 0, "rank" : 2, @@ -1528,8 +1528,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", @@ -1639,8 +1639,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 @@ -1770,7 +1770,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2058,15 +2058,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, @@ -2074,8 +2074,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" @@ -2331,7 +2331,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -2599,22 +2599,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : 2.495352, + "co2_agriculture" : "2.495352", "co2_consumption" : 0, - "co2_distribution" : 0.029120657, - "co2_packaging" : 0.28587039, - "co2_processing" : 0.39369607, - "co2_total" : 3.4585877, - "co2_transportation" : 0.25433483, + "co2_distribution" : "0.029120657", + "co2_packaging" : "0.28587039", + "co2_processing" : "0.39369607", + "co2_total" : "3.4585877", + "co2_transportation" : "0.25433483", "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : 0.31523913, + "ef_agriculture" : "0.31523913", "ef_consumption" : 0, - "ef_distribution" : 0.0098990521, - "ef_packaging" : 0.021563312, - "ef_processing" : 0.055783332, - "ef_total" : 0.42581268, - "ef_transportation" : 0.023314705, + "ef_distribution" : "0.0098990521", + "ef_packaging" : "0.021563312", + "ef_processing" : "0.055783332", + "ef_total" : "0.42581268", + "ef_transportation" : "0.023314705", "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_test/q4.json b/tests/integration/expected_test_results/search_test/q4.json index 0512b068b2aa9..6c625fbb97b83 100644 --- a/tests/integration/expected_test_results/search_test/q4.json +++ b/tests/integration/expected_test_results/search_test/q4.json @@ -1,8 +1,8 @@ { "count" : 1, - "page" : 1, + "page" : "1", "page_count" : 1, - "page_size" : 24, + "page_size" : "24", "products" : [ { "_id" : "200000000045", @@ -74,7 +74,7 @@ "2xxxxxxxxxxx" ], "complete" : 0, - "completeness" : 0.5, + "completeness" : "0.5", "correctors_tags" : [], "created_t" : "--ignore--", "creator" : "tests", @@ -342,22 +342,22 @@ }, "agribalyse" : { "agribalyse_proxy_food_code" : "32135", - "co2_agriculture" : 2.495352, + "co2_agriculture" : "2.495352", "co2_consumption" : 0, - "co2_distribution" : 0.029120657, - "co2_packaging" : 0.28587039, - "co2_processing" : 0.39369607, - "co2_total" : 3.4585877, - "co2_transportation" : 0.25433483, + "co2_distribution" : "0.029120657", + "co2_packaging" : "0.28587039", + "co2_processing" : "0.39369607", + "co2_total" : "3.4585877", + "co2_transportation" : "0.25433483", "code" : "32135", "dqr" : "4.03", - "ef_agriculture" : 0.31523913, + "ef_agriculture" : "0.31523913", "ef_consumption" : 0, - "ef_distribution" : 0.0098990521, - "ef_packaging" : 0.021563312, - "ef_processing" : 0.055783332, - "ef_total" : 0.42581268, - "ef_transportation" : 0.023314705, + "ef_distribution" : "0.0098990521", + "ef_packaging" : "0.021563312", + "ef_processing" : "0.055783332", + "ef_total" : "0.42581268", + "ef_transportation" : "0.023314705", "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/unit/expected_test_results/packaging/packaging_en_citeo_shapes.json b/tests/unit/expected_test_results/packaging/packaging_en_citeo_shapes.json index 7acd2036505a8..970d546933e77 100644 --- a/tests/unit/expected_test_results/packaging/packaging_en_citeo_shapes.json +++ b/tests/unit/expected_test_results/packaging/packaging_en_citeo_shapes.json @@ -18,6 +18,7 @@ "shape" : "en:case" }, { + "material" : "en:wood", "shape" : "en:crate" }, {