From 16a95f9220d65447ae610e1adc777082575bf08d Mon Sep 17 00:00:00 2001 From: monsieurtanuki Date: Fri, 29 Apr 2022 17:02:53 +0200 Subject: [PATCH] fix: moved to product onboarding references about knowledge panels Deleted file: * `sample_knowledge_panels.json`: now part of `sample_product_data.json` Impacted files: * `knowledge_panel_page_template.dart`: now using full product instead of just knowledge panels * `onboarding_data_product.dart`: removed knowledge panels references as they're part of product now * `onboarding_loader.dart`removed knowledge panels references * `sample_product_data.json`: refreshed data including knowledge panels --- .../onboarding/sample_knowledge_panels.json | 770 -------------- .../onboarding/sample_product_data.json | 963 +++++++++++++++++- .../data_models/onboarding_data_product.dart | 12 +- .../lib/data_models/onboarding_loader.dart | 13 +- .../knowledge_panel_page_template.dart | 2 +- 5 files changed, 950 insertions(+), 810 deletions(-) delete mode 100644 packages/smooth_app/assets/onboarding/sample_knowledge_panels.json diff --git a/packages/smooth_app/assets/onboarding/sample_knowledge_panels.json b/packages/smooth_app/assets/onboarding/sample_knowledge_panels.json deleted file mode 100644 index ec5a0bff494..00000000000 --- a/packages/smooth_app/assets/onboarding/sample_knowledge_panels.json +++ /dev/null @@ -1,770 +0,0 @@ -{ - "code": "093270067481501", - "product": { - "knowledge_panels": { - "carbon_footprint": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "\n

The carbon emission figure comes from ADEME's Agribalyse database, for the category: \n Soup, mixed vegetables, prepacked, to be reheated\n (Source: ADEME Agribalyse Database\n

\n ", - "text_type": "summary" - } - }, { - "element_type": "table", - "table_element": { - "columns": [{ - "text": "Stage", - "type": "text" - }, { - "text": "Impact", - "type": "percent" - }], - "id": "ecoscore_carbon_impact_by_stages_table", - "rows": [{ - "id": "agriculture", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", - "text": "Agriculture" - }, { - "percent": 19.9102452652909, - "text": "19.9 %" - }] - }, { - "id": "processing", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/processing.svg", - "text": "Processing" - }, { - "percent": 27.1491161600647, - "text": "27.1 %" - }] - }, { - "id": "packaging", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", - "text": "Packaging" - }, { - "percent": 19.8346135618205, - "text": "19.8 %" - }] - }, { - "id": "transportation", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", - "text": "Transportation" - }, { - "percent": 26.4266128826942, - "text": "26.4 %" - }] - }, { - "id": "distribution", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/distribution.svg", - "text": "Distribution" - }, { - "percent": 5.08785774296693, - "text": "5.1 %" - }] - }, { - "id": "consumption", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/consumption.svg", - "text": "Consumption" - }, { - "percent": 1.59155663592528, - "text": "1.6 %" - }] - }], - "table_type": "percents", - "title": "Details of the impacts by stages of the life cycle" - } - }], - "evaluation": "good", - "expanded": false, - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/car.svg", - "subtitle": "50 g CO² per 100g of product", - "title": "Equal to driving 0.3 km in a petrol car" - }, - "topics": ["environment"] - }, - "ecoscore": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "The Eco-Score is an experimental score that summarizes the environmental impacts of food products." - } - }, { - "element_type": "text", - "text_element": { - "html": "\n \n The Eco-Score was initially developped for France and it is being extended to other European countries. The Eco-Score formula is subject to change as it is regularly improved to make it more precise and better suited to each country.\n \n ", - "type": "note" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["ecoscore_agribalyse"], - "title": "Life cycle analysis" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["ecoscore_production_system", "ecoscore_origins_of_ingredients", "ecoscore_threatened_species", "ecoscore_packaging"], - "title": "Bonuses and maluses" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["ecoscore_total"], - "title": "Eco-Score for this product" - } - }], - "level": "info", - "title_element": { - "grade": "a", - "icon_url": "https://static.openfoodfacts.org/images/attributes/ecoscore-a.svg", - "title": "Eco-Score A - Very low environmental impact", - "type": "grade" - }, - "topics": ["environment"] - }, - "ecoscore_agribalyse": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "\n

Category: \n Soup, mixed vegetables, prepacked, to be reheated\n

\n \n ", - "text_type": "summary" - } - }, { - "element_type": "table", - "table_element": { - "columns": [{ - "text": "Stage", - "type": "text" - }, { - "text": "Impact", - "type": "percent" - }], - "id": "ecoscore_lca_impacts_by_stages_table", - "rows": [{ - "id": "agriculture", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", - "text": "Agriculture" - }, { - "percent": 25.5002680709173, - "text": "25.5 %" - }] - }, { - "id": "processing", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/processing.svg", - "text": "Processing" - }, { - "percent": 33.0290288957563, - "text": "33.0 %" - }] - }, { - "id": "packaging", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", - "text": "Packaging" - }, { - "percent": 16.0209089644945, - "text": "16.0 %" - }] - }, { - "id": "transportation", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", - "text": "Transportation" - }, { - "percent": 10.9532564584838, - "text": "11.0 %" - }] - }, { - "id": "distribution", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/distribution.svg", - "text": "Distribution" - }, { - "percent": 10.2036132114395, - "text": "10.2 %" - }] - }, { - "id": "consumption", - "values": [{ - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/consumption.svg", - "text": "Consumption" - }, { - "percent": 4.29292536182619, - "text": "4.3 %" - }] - }], - "table_type": "percents", - "title": "Details of the impacts by stages of the life cycle" - } - }], - "level": "info", - "title_element": { - "grade": "a", - "subtitle": "Category: Soup, mixed vegetables, prepacked, to be reheated", - "title": "Average impact of products of the same category: A (Score: 97/100)", - "type": "grade" - }, - "topics": ["environment"] - }, - "ecoscore_origins_of_ingredients": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "\n Environmental policy: +4
\n Transportation: 0
\n ", - "type": "default" - } - }, { - "element_type": "table", - "table_element": { - "columns": [{ - "text": "Origin of the product and/or its ingredients", - "type": "text" - }, { - "text": "% of ingredients", - "type": "percent" - }, { - "text": "Impact", - "type": "text" - }], - "id": "ecoscore_origins_of_ingredients_table", - "rows": [{ - "values": [{ - "text": "France" - }, { - "evaluation": "neutral", - "percent": 100, - "text": "100 %" - }, { - "evaluation": "neutral", - "text": "Medium" - }] - }], - "title": "Origins of ingredients" - } - }], - "evaluation": "average", - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_size": "small", - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/public.svg", - "subtitle": "Bonus: +4", - "title": "Origins of ingredients with a medium impact" - }, - "topics": ["environment"] - }, - "ecoscore_packaging": { - "elements": [{ - "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": "Bottle" - }, { - "text": "Glass" - }, { - "evaluation": "good", - "text": "Recycle" - }, { - "evaluation": "good", - "text": "Low" - }] - }, { - "values": [{ - "text": "Bottle cap" - }, { - "text": "Steel" - }, { - "evaluation": "good", - "text": "Recycle" - }, { - "evaluation": "good", - "text": "Low" - }] - }], - "title": "Packaging parts" - } - }], - "evaluation": "good", - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_size": "small", - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", - "subtitle": "Malus: -2", - "title": "Packaging with a low impact" - }, - "topics": ["environment"] - }, - "ecoscore_production_system": { - "elements": [{ - "element_type": "panel", - "panel_element": { - "panel_id": "environment_label_en:eu-organic" - } - }], - "evaluation": "good", - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_size": "small", - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", - "subtitle": "Bonus: +15", - "title": "Labels with high environmental benefits" - }, - "topics": ["environment"] - }, - "ecoscore_threatened_species": { - "evaluation": "good", - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_size": "small", - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/monkey_happy.svg", - "title": "No ingredients that threaten species" - }, - "topics": ["environment"] - }, - "ecoscore_total": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "\n Life cycle analysis score: 97
\n Sum of bonuses and maluses:\n \n +17\n

\n Final score: 114/100\n \n ", - "type": "summary" - } - }], - "level": "info", - "title_element": { - "grade": "a", - "subtitle": "Product: A good product for you - Open Food Facts - 200 g", - "title": "Impact for this product: A (Score: 114/100)", - "type": "grade" - }, - "topics": ["environment"] - }, - "environment_card": { - "elements": [{ - "element_type": "panel", - "panel_element": { - "panel_id": "ecoscore" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["carbon_footprint"], - "title": "Carbon footprint" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["packaging_recycling"], - "title": "Packaging" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["manufacturing_place", "origins_of_ingredients"], - "title": "Transportation" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["environment_label_en:eu-organic"], - "title": "Labels" - } - }], - "expanded": true, - "title_element": { - "title": "" - }, - "topics": ["environment"], - "type": "card" - }, - "environment_label_en:eu-organic": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "\n Organic food is food produced by methods complying with the standards of organic farming and features practices that cycle resources, promote ecological balance, and conserve biodiversity.\n ", - "type": "default" - } - }], - "evaluation": "good", - "level": "info", - "title_element": { - "icon_url": "https://static.openfoodfacts.org/images/lang/en/labels/eu-organic.135x90.svg", - "subtitle": "Organic agriculture contributes to preserve biodiversity, climate, water quality and soil fertility.", - "title": "EU Organic" - }, - "topics": ["environment"] - }, - "health_card": { - "elements": [{ - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["nutriscore", "physical_activities", "nutrition_facts_table"], - "title": "" - } - }, { - "element_type": "panel_group", - "panel_group_element": { - "panel_ids": ["ingredients"], - "title": "Ingredients" - } - }], - "expanded": true, - "title_element": { - "title": "Health" - }, - "topics": ["health"], - "type": "card" - }, - "ingredients": { - "elements": [{ - "element_type": "text", - "text_element": { - "edit_field_id": "ingredients_text_en", - "edit_field_type": "ingredients_text", - "edit_field_value": "Butternut squash 50%, water, carrots 10%, sweet potato, leeks, potatoes, salt.", - "html": "Butternut squash 50%, water, carrots 10%, sweet potato, leeks, potatoes, salt.", - "language": "English", - "lc": "en" - } - }], - "expanded": true, - "level": "info", - "topics": ["health"], - "type": "inline" - }, - "manufacturing_place": { - "elements": [{ - "element_type": "map", - "map_element": { - "pointers": [{ - "geo": { - "lat": 48.7951886, - "lng": 2.4871653 - } - }] - } - }], - "evaluation": "neutral", - "expanded": true, - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", - "subtitle": "SAINT-MAUR-DES-FOSSES - France", - "title": "Manufacturing or processing place" - }, - "topics": ["environment"] - }, - "nutriscore": { - "elements": [{ - "element_type": "text", - "text_element": { - "html": "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the list of ingredients: 60%\n ", - "type": "warning" - } - }, { - "element_type": "text", - "text_element": { - "html": "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 4 \n

\n\n \n\n\n\n

\n Negative points: 1 \n

\n\n \n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Score nutritionnel: -3\n (1 - 4)\n

\n

Nutri-Score: A

\n\n" - } - }], - "level": "info", - "title_element": { - "grade": "a", - "icon_url": "https://static.openfoodfacts.org/images/attributes/nutriscore-a.svg", - "title": "Very good nutritional quality", - "type": "grade" - }, - "topics": ["health"] - }, - "nutrition_facts_table": { - "elements": [{ - "element_type": "table", - "table_element": { - "columns": [{ - "style": "max-width:15rem", - "text": "Nutrition facts", - "type": "text" - }, { - "column_group_id": "product", - "shown_by_default": true, - "text": "As sold
for 100 g / 100 ml", - "text_for_small_screens": "100g", - "type": "text" - }, { - "column_group_id": "comparisons", - "shown_by_default": true, - "text": "Compared to: Vegetable soups", - "type": "text" - }], - "id": "nutrition_facts_table", - "rows": [{ - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Energy" - }, { - "text": "120 kj
(29 kcal)" - }, { - "evaluation": "good", - "text": "-55%" - }] - }, { - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Fat" - }, { - "text": "0.5 g" - }, { - "evaluation": "good", - "text": "-70%" - }] - }, { - "values": [{ - "level": 1, - "style": "max-width:15rem", - "text": "Saturated fat" - }, { - "text": "0.2 g" - }, { - "evaluation": "good", - "text": "-42%" - }] - }, { - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Salt" - }, { - "text": "0.4 g" - }, { - "evaluation": "good", - "text": "-33%" - }] - }, { - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Carbohydrates" - }, { - "text": "4 g" - }, { - "text": "-60%" - }] - }, { - "values": [{ - "level": 1, - "style": "max-width:15rem", - "text": "Fiber" - }, { - "text": "3 g" - }, { - "evaluation": "good", - "text": "+122%" - }] - }, { - "values": [{ - "level": 1, - "style": "max-width:15rem", - "text": "Sugars" - }, { - "text": "0.5 g" - }, { - "evaluation": "good", - "text": "-85%" - }] - }, { - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Proteins" - }, { - "text": "1 g" - }, { - "evaluation": "bad", - "text": "-47%" - }] - }, { - "values": [{ - "level": 0, - "style": "max-width:15rem", - "text": "Fruits‚ vegetables‚ nuts and rapeseed‚ walnut and olive oils (estimate from ingredients list analysis)" - }, { - "text": "60 %" - }, { - "text": "" - }] - }], - "title": "Nutrition facts" - } - }], - "expanded": true, - "level": "info", - "topics": ["health"], - "type": "inline" - }, - "origins_of_ingredients": { - "elements": [{ - "element_type": "table", - "table_element": { - "columns": [{ - "text": "Origin of the product and/or its ingredients", - "type": "text" - }, { - "text": "% of ingredients", - "type": "percent" - }, { - "text": "Impact", - "type": "text" - }], - "id": "ecoscore_origins_of_ingredients_table", - "rows": [{ - "values": [{ - "text": "France" - }, { - "evaluation": "neutral", - "percent": 100, - "text": "100 %" - }, { - "evaluation": "neutral", - "text": "Medium" - }] - }], - "table_type": "percents", - "title": "Origins of ingredients" - } - }], - "evaluation": "average", - "expanded": false, - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/public.svg", - "subtitle": "Origins of ingredients with a medium impact", - "title": "Origins of ingredients" - }, - "topics": ["environment"] - }, - "packaging_recycling": { - "elements": [{ - "element_type": "text", - "text_element": { - "evaluation": "good", - "html": "\n \n \n Bottle\n \n (Glass)\n \n
\n \n \n \n Bottle cap\n \n (Steel)\n \n
\n \n \n ", - "icon_alt": "Recycle", - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/recycle-variant.svg", - "type": "summary" - } - }], - "evaluation": "good", - "expanded": true, - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", - "title": "Packaging with a low impact" - }, - "topics": ["environment"] - }, - "physical_activities": { - "elements": [{ - "element_type": "text", - "text_element": { - "evaluation": "good", - "html": "\n Swimming: 4 min \n ", - "icon_alt": "Swimming", - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-swimming.svg", - "type": "summary", - "valign": "middle" - } - }, { - "element_type": "text", - "text_element": { - "evaluation": "good", - "html": "\n Bicycling: 3 min \n ", - "icon_alt": "Bicycling", - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-bicycling.svg", - "type": "summary", - "valign": "middle" - } - }, { - "element_type": "text", - "text_element": { - "evaluation": "good", - "html": "\n Running: 2 min \n ", - "icon_alt": "Running", - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-running.svg", - "type": "summary", - "valign": "middle" - } - }, { - "element_type": "text", - "text_element": { - "html": "\n

Energy expenditure for a person weighting 70 kg / 154 lb

\n ", - "icon_color_from_evaluation": true, - "type": "summary" - } - }], - "evaluation": "good", - "expanded": false, - "level": "info", - "title_element": { - "icon_color_from_evaluation": true, - "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-walking.svg", - "subtitle": "Equal to walking 7 minutes or 700 steps", - "title": "120 kJ per 100g" - }, - "topics": ["health"] - }, - "root": { - "elements": [{ - "element_type": "panel", - "panel_element": { - "panel_id": "health_card" - } - }, { - "element_type": "panel", - "panel_element": { - "panel_id": "environment_card" - } - }], - "expanded": true, - "type": "root" - } - } - }, - "status": 1, - "status_verbose": "product found" -} \ No newline at end of file diff --git a/packages/smooth_app/assets/onboarding/sample_product_data.json b/packages/smooth_app/assets/onboarding/sample_product_data.json index 74347ab9b04..ded9443ace3 100644 --- a/packages/smooth_app/assets/onboarding/sample_product_data.json +++ b/packages/smooth_app/assets/onboarding/sample_product_data.json @@ -11,6 +11,7 @@ "id": "nutriscore", "match": 83.7142857142857, "name": "Nutri-Score", + "panel_id": "nutriscore", "status": "known", "title": "Nutri-Score A" }, { @@ -190,6 +191,7 @@ "id": "vegan", "match": 100, "name": "Vegan", + "panel_id": "ingredients_analysis_en-vegan", "status": "known", "title": "Vegan" }, { @@ -198,6 +200,7 @@ "id": "vegetarian", "match": 100, "name": "Vegetarian", + "panel_id": "ingredients_analysis_en-vegetarian", "status": "known", "title": "Vegetarian" }, { @@ -206,6 +209,7 @@ "id": "palm_oil_free", "match": 100, "name": "Palm oil free", + "panel_id": "ingredients_analysis_en-palm-oil-free", "status": "known", "title": "Palm oil free" }], @@ -220,6 +224,7 @@ "id": "nova", "match": 50, "name": "NOVA group", + "panel_id": "nova", "status": "known", "title": "NOVA 3" }, { @@ -228,6 +233,7 @@ "id": "additives", "match": 100, "name": "Additives", + "panel_id": "additives", "status": "known", "title": "Without additives" }], @@ -242,6 +248,7 @@ "id": "ecoscore", "match": 100, "name": "Eco-Score", + "panel_id": "ecoscore", "status": "known", "title": "Eco-Score A" }, { @@ -289,7 +296,7 @@ "adjustments": { "origins_of_ingredients": { "aggregated_origins": [{ - "epi_score": "93", + "epi_score": 93, "origin": "en:france", "percent": 100, "transportation_score": "" @@ -499,14 +506,14 @@ "packaging": { "non_recyclable_and_non_biodegradable_materials": 0, "packagings": [{ - "ecoscore_material_score": "81", - "ecoscore_shape_ratio": "1", + "ecoscore_material_score": 81, + "ecoscore_shape_ratio": 1, "material": "en:glass", "recycling": "en:recycle", "shape": "en:bottle" }, { - "ecoscore_material_score": "76", - "ecoscore_shape_ratio": "0.1", + "ecoscore_material_score": 76, + "ecoscore_shape_ratio": 0.1, "material": "en:steel", "recycling": "en:recycle", "shape": "en:bottle-cap" @@ -521,23 +528,24 @@ "threatened_species": {} }, "agribalyse": { + "agribalyse_food_code": "25903", "agribalyse_proxy_food_code": "25903", - "co2_agriculture": "0.099163319", - "co2_consumption": "0.0079267752", - "co2_distribution": "0.025340163", - "co2_packaging": "0.098786634", - "co2_processing": "0.13521664", - "co2_total": "0.49805172", - "co2_transportation": "0.1316182", + "co2_agriculture": 0.099163319, + "co2_consumption": 0.0079267752, + "co2_distribution": 0.025340163, + "co2_packaging": 0.098786634, + "co2_processing": 0.13521664, + "co2_total": 0.49805172, + "co2_transportation": 0.1316182, "code": "25903", "dqr": "2.42", - "ef_agriculture": "0.023834065", - "ef_consumption": "0.004012423", - "ef_distribution": "0.0095369029", - "ef_packaging": "0.014974093", - "ef_processing": "0.030870892", - "ef_total": "0.093465939", - "ef_transportation": "0.010237564", + "ef_agriculture": 0.023834065, + "ef_consumption": 0.004012423, + "ef_distribution": 0.0095369029, + "ef_packaging": 0.014974093, + "ef_processing": 0.030870892, + "ef_total": 0.093465939, + "ef_transportation": 0.010237564, "is_beverage": 0, "name_en": "Soup, mixed vegetables, prepacked, to be reheated", "name_fr": "Soupe aux légumes variés, préemballée à réchauffer", @@ -681,6 +689,923 @@ "ecoscore_score": 114, "environment_impact_level_tags": ["en:low"], "ingredients_analysis_tags": ["en:palm-oil-free", "en:vegan", "en:vegetarian"], + "knowledge_panels": { + "carbon_footprint": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n

The carbon emission figure comes from ADEME's Agribalyse database, for the category: \n Soup, mixed vegetables, prepacked, to be reheated\n (Source: ADEME Agribalyse Database\n

\n ", + "text_type": "summary" + } + }, { + "element_type": "table", + "table_element": { + "columns": [{ + "text": "Stage", + "type": "text" + }, { + "text": "Impact", + "type": "percent" + }], + "id": "ecoscore_carbon_impact_by_stages_table", + "rows": [{ + "id": "agriculture", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", + "text": "Agriculture" + }, { + "percent": 19.9102452652909, + "text": "19.9 %" + }] + }, { + "id": "processing", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/processing.svg", + "text": "Processing" + }, { + "percent": 27.1491161600647, + "text": "27.1 %" + }] + }, { + "id": "packaging", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", + "text": "Packaging" + }, { + "percent": 19.8346135618205, + "text": "19.8 %" + }] + }, { + "id": "transportation", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", + "text": "Transportation" + }, { + "percent": 26.4266128826942, + "text": "26.4 %" + }] + }, { + "id": "distribution", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/distribution.svg", + "text": "Distribution" + }, { + "percent": 5.08785774296693, + "text": "5.1 %" + }] + }, { + "id": "consumption", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/consumption.svg", + "text": "Consumption" + }, { + "percent": 1.59155663592528, + "text": "1.6 %" + }] + }], + "table_type": "percents", + "title": "Details of the impacts by stages of the life cycle" + } + }], + "evaluation": "good", + "expanded": false, + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/car.svg", + "subtitle": "50 g CO² per 100g of product", + "title": "Equal to driving 0.3 km in a petrol car" + }, + "topics": ["environment"] + }, + "ecoscore": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "The Eco-Score is an experimental score that summarizes the environmental impacts of food products." + } + }, { + "element_type": "text", + "text_element": { + "html": "\n \n The Eco-Score was initially developped for France and it is being extended to other European countries. The Eco-Score formula is subject to change as it is regularly improved to make it more precise and better suited to each country.\n \n ", + "type": "note" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["ecoscore_agribalyse"], + "title": "Life cycle analysis" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["ecoscore_production_system", "ecoscore_origins_of_ingredients", "ecoscore_threatened_species", "ecoscore_packaging"], + "title": "Bonuses and maluses" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["ecoscore_total"], + "title": "Eco-Score for this product" + } + }], + "level": "info", + "title_element": { + "grade": "a", + "icon_url": "https://static.openfoodfacts.org/images/attributes/ecoscore-a.svg", + "title": "Eco-Score A - Very low environmental impact", + "type": "grade" + }, + "topics": ["environment"] + }, + "ecoscore_agribalyse": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n

Category: \n Soup, mixed vegetables, prepacked, to be reheated\n

\n \n ", + "text_type": "summary" + } + }, { + "element_type": "table", + "table_element": { + "columns": [{ + "text": "Stage", + "type": "text" + }, { + "text": "Impact", + "type": "percent" + }], + "id": "ecoscore_lca_impacts_by_stages_table", + "rows": [{ + "id": "agriculture", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", + "text": "Agriculture" + }, { + "percent": 25.5002680709173, + "text": "25.5 %" + }] + }, { + "id": "processing", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/processing.svg", + "text": "Processing" + }, { + "percent": 33.0290288957563, + "text": "33.0 %" + }] + }, { + "id": "packaging", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", + "text": "Packaging" + }, { + "percent": 16.0209089644945, + "text": "16.0 %" + }] + }, { + "id": "transportation", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", + "text": "Transportation" + }, { + "percent": 10.9532564584838, + "text": "11.0 %" + }] + }, { + "id": "distribution", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/distribution.svg", + "text": "Distribution" + }, { + "percent": 10.2036132114395, + "text": "10.2 %" + }] + }, { + "id": "consumption", + "values": [{ + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/consumption.svg", + "text": "Consumption" + }, { + "percent": 4.29292536182619, + "text": "4.3 %" + }] + }], + "table_type": "percents", + "title": "Details of the impacts by stages of the life cycle" + } + }], + "level": "info", + "title_element": { + "grade": "a", + "subtitle": "Category: Soup, mixed vegetables, prepacked, to be reheated", + "title": "Average impact of products of the same category: A (Score: 97/100)", + "type": "grade" + }, + "topics": ["environment"] + }, + "ecoscore_extended": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "

Warning: this feature is experimental and under development.

\n\n

Estimated impact for this product:

\n \n\n
\n\n \n

Estimated impact for the category (Soups):

\n\n \n \n\n ", + "text_type": "summary" + } + }, { + "element_type": "table", + "table_element": { + "columns": [{ + "text": "Ingredients", + "type": "text" + }, { + "text": "Quantity", + "type": "text" + }], + "id": "ecoscore_extended_estimated_recipe", + "rows": [], + "table_type": "percents", + "title": "Estimated recipe" + } + }], + "evaluation": "good", + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/scale-balance.svg", + "subtitle": "Compared to: Category: Soup, mixed vegetables, prepacked, to be reheated", + "title": "Environmental impact of ingredients 66% smaller than similar products", + "type": "grade" + }, + "topics": ["environment"] + }, + "ecoscore_origins_of_ingredients": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n Environmental policy: +4
\n Transportation: 0
\n ", + "type": "default" + } + }, { + "element_type": "table", + "table_element": { + "columns": [{ + "text": "Origin of the product and/or its ingredients", + "type": "text" + }, { + "text": "% of ingredients", + "type": "percent" + }, { + "text": "Impact", + "type": "text" + }], + "id": "ecoscore_origins_of_ingredients_table", + "rows": [{ + "values": [{ + "text": "France" + }, { + "evaluation": "neutral", + "percent": 100, + "text": "100 %" + }, { + "evaluation": "neutral", + "text": "Medium" + }] + }], + "title": "Origins of ingredients" + } + }], + "evaluation": "average", + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/public.svg", + "subtitle": "Bonus: +4", + "title": "Origins of ingredients with a medium impact" + }, + "topics": ["environment"] + }, + "ecoscore_packaging": { + "elements": [{ + "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": "Bottle" + }, { + "text": "Glass" + }, { + "evaluation": "good", + "text": "Recycle" + }, { + "evaluation": "good", + "text": "Low" + }] + }, { + "values": [{ + "text": "Bottle cap" + }, { + "text": "Steel" + }, { + "evaluation": "good", + "text": "Recycle" + }, { + "evaluation": "good", + "text": "Low" + }] + }], + "title": "Packaging parts" + } + }], + "evaluation": "good", + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", + "subtitle": "Malus: -2", + "title": "Packaging with a low impact" + }, + "topics": ["environment"] + }, + "ecoscore_production_system": { + "elements": [{ + "element_type": "panel", + "panel_element": { + "panel_id": "environment_label_en:eu-organic" + } + }], + "evaluation": "good", + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/agriculture.svg", + "subtitle": "Bonus: +15", + "title": "Labels with high environmental benefits" + }, + "topics": ["environment"] + }, + "ecoscore_threatened_species": { + "evaluation": "good", + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/monkey_happy.svg", + "title": "No ingredients that threaten species" + }, + "topics": ["environment"] + }, + "ecoscore_total": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n Life cycle analysis score: 97
\n Sum of bonuses and maluses:\n \n +17\n

\n Final score: 114/100\n \n ", + "type": "summary" + } + }], + "level": "info", + "title_element": { + "grade": "a", + "subtitle": "Product: A good product for you - Open Food Facts - 200 g", + "title": "Impact for this product: A (Score: 114/100)", + "type": "grade" + }, + "topics": ["environment"] + }, + "environment_card": { + "elements": [{ + "element_type": "panel", + "panel_element": { + "panel_id": "ecoscore" + } + }, { + "element_type": "panel", + "panel_element": { + "panel_id": "ecoscore_extended" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["carbon_footprint"], + "title": "Carbon footprint" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["packaging_recycling"], + "title": "Packaging" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["manufacturing_place", "origins_of_ingredients"], + "title": "Transportation" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["environment_label_en:eu-organic"], + "title": "Labels" + } + }], + "expanded": true, + "title_element": { + "title": "Environment" + }, + "topics": ["environment"], + "type": "card" + }, + "environment_label_en:eu-organic": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n Organic food is food produced by methods complying with the standards of organic farming and features practices that cycle resources, promote ecological balance, and conserve biodiversity.\n ", + "type": "default" + } + }], + "evaluation": "good", + "level": "info", + "title_element": { + "icon_url": "https://static.openfoodfacts.org/images/lang/en/labels/eu-organic.135x90.svg", + "subtitle": "Organic agriculture contributes to preserve biodiversity, climate, water quality and soil fertility.", + "title": "EU Organic" + }, + "topics": ["environment"] + }, + "health_card": { + "elements": [{ + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["nutriscore", "physical_activities", "nutrition_facts_table"], + "title": "" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["ingredients"], + "title": "Ingredients" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["nova"], + "title": "Food processing" + } + }, { + "element_type": "panel_group", + "panel_group_element": { + "panel_ids": ["ingredients_analysis"], + "title": "Ingredients analysis" + } + }], + "expanded": true, + "title_element": { + "title": "Health" + }, + "topics": ["health"], + "type": "card" + }, + "ingredients": { + "elements": [{ + "element_type": "text", + "text_element": { + "edit_field_id": "ingredients_text_en", + "edit_field_type": "ingredients_text", + "edit_field_value": "Butternut squash 50%, water, carrots 10%, sweet potato, leeks, potatoes, salt.", + "html": "Butternut squash 50%, water, carrots 10%, sweet potato, leeks, potatoes, salt.", + "language": "English", + "lc": "en" + } + }], + "expanded": true, + "level": "info", + "topics": ["health"], + "type": "inline" + }, + "ingredients_analysis": { + "elements": [{ + "element_type": "panel", + "panel_element": { + "panel_id": "ingredients_analysis_en:palm-oil-free" + } + }, { + "element_type": "panel", + "panel_element": { + "panel_id": "ingredients_analysis_en:vegan" + } + }, { + "element_type": "panel", + "panel_element": { + "panel_id": "ingredients_analysis_en:vegetarian" + } + }, { + "element_type": "text", + "text_element": { + "html": "The analysis is based solely on the ingredients listed and does not take into account processing methods." + } + }], + "expanded": true, + "level": "info", + "topics": ["health"], + "type": "inline" + }, + "ingredients_analysis_en:palm-oil-free": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n \n No ingredients containing palm oil detected\n \n ", + "type": "summary" + } + }], + "evaluation": "good", + "level": "info", + "size": "small", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/palm-oil.svg", + "title": "Palm oil free" + }, + "topics": ["health"] + }, + "ingredients_analysis_en:vegan": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n \n No non-vegan ingredients\n \n ", + "type": "summary" + } + }], + "evaluation": "good", + "level": "info", + "size": "small", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/leaf.svg", + "title": "Vegan" + }, + "topics": ["health"] + }, + "ingredients_analysis_en:vegetarian": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n \n No non-vegetarian ingredients detected\n \n ", + "type": "summary" + } + }], + "evaluation": "good", + "level": "info", + "size": "small", + "title_element": { + "icon_color_from_evaluation": true, + "icon_size": "small", + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/vegetarian.svg", + "title": "Vegetarian" + }, + "topics": ["health"] + }, + "manufacturing_place": { + "elements": [{ + "element_type": "map", + "map_element": { + "pointers": [{ + "geo": { + "lat": 48.7951886, + "lng": 2.4871653 + } + }] + } + }], + "evaluation": "neutral", + "expanded": true, + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/transportation.svg", + "subtitle": "SAINT-MAUR-DES-FOSSES - France", + "title": "Manufacturing or processing place" + }, + "topics": ["environment"] + }, + "nova": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "\n\n \n \n \n\n" + } + }, { + "element_type": "text", + "text_element": { + "html": "\n

Food products are classified into 4 groups according to their degree of processing:

\n
    \n
  1. Unprocessed or minimally processed foods
  2. \n
  3. Processed culinary ingredients
  4. \n
  5. Processed foods
  6. \n
  7. Ultra processed foods
  8. \n
\n
\n

The determination of the group is based on the category of the product and on the ingredients it contains.

\n

Learn more about the NOVA classification

\n" + } + }], + "level": "info", + "title_element": { + "icon_url": "https://static.openfoodfacts.org/images/attributes/nova-group-3.svg", + "title": "Processed foods" + }, + "topics": ["health"] + }, + "nutriscore": { + "elements": [{ + "element_type": "text", + "text_element": { + "html": "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the list of ingredients: 60%\n ", + "type": "warning" + } + }, { + "element_type": "text", + "text_element": { + "html": "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 4 \n

\n\n \n\n\n\n

\n Negative points: 1 \n

\n\n \n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Score nutritionnel: -3\n (1 - 4)\n

\n

Nutri-Score: A

\n\n" + } + }], + "level": "info", + "title_element": { + "grade": "a", + "icon_url": "https://static.openfoodfacts.org/images/attributes/nutriscore-a.svg", + "title": "Very good nutritional quality", + "type": "grade" + }, + "topics": ["health"] + }, + "nutrition_facts_table": { + "elements": [{ + "element_type": "table", + "table_element": { + "columns": [{ + "style": "max-width:15rem", + "text": "Nutrition facts", + "type": "text" + }, { + "column_group_id": "product", + "shown_by_default": true, + "text": "As sold
for 100 g / 100 ml", + "text_for_small_screens": "100g", + "type": "text" + }, { + "column_group_id": "comparisons", + "shown_by_default": true, + "text": "Compared to: Vegetable soups", + "type": "text" + }], + "id": "nutrition_facts_table", + "rows": [{ + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Energy" + }, { + "text": "120 kj
(29 kcal)" + }, { + "evaluation": "good", + "text": "-50%" + }] + }, { + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Fat" + }, { + "text": "0.5 g" + }, { + "evaluation": "good", + "text": "-68%" + }] + }, { + "values": [{ + "level": 1, + "style": "max-width:15rem", + "text": "Saturated fat" + }, { + "text": "0.2 g" + }, { + "evaluation": "good", + "text": "-35%" + }] + }, { + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Salt" + }, { + "text": "0.4 g" + }, { + "evaluation": "good", + "text": "-33%" + }] + }, { + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Carbohydrates" + }, { + "text": "4 g" + }, { + "text": "-55%" + }] + }, { + "values": [{ + "level": 1, + "style": "max-width:15rem", + "text": "Fiber" + }, { + "text": "3 g" + }, { + "evaluation": "good", + "text": "+134%" + }] + }, { + "values": [{ + "level": 1, + "style": "max-width:15rem", + "text": "Sugars" + }, { + "text": "0.5 g" + }, { + "evaluation": "good", + "text": "-84%" + }] + }, { + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Proteins" + }, { + "text": "1 g" + }, { + "evaluation": "bad", + "text": "-34%" + }] + }, { + "values": [{ + "level": 0, + "style": "max-width:15rem", + "text": "Fruits‚ vegetables‚ nuts and rapeseed‚ walnut and olive oils (estimate from ingredients list analysis)" + }, { + "text": "60 %" + }, { + "text": "" + }] + }], + "title": "Nutrition facts" + } + }], + "expanded": true, + "level": "info", + "topics": ["health"], + "type": "inline" + }, + "origins_of_ingredients": { + "elements": [{ + "element_type": "table", + "table_element": { + "columns": [{ + "text": "Origin of the product and/or its ingredients", + "type": "text" + }, { + "text": "% of ingredients", + "type": "percent" + }, { + "text": "Impact", + "type": "text" + }], + "id": "ecoscore_origins_of_ingredients_table", + "rows": [{ + "values": [{ + "text": "France" + }, { + "evaluation": "neutral", + "percent": 100, + "text": "100 %" + }, { + "evaluation": "neutral", + "text": "Medium" + }] + }], + "table_type": "percents", + "title": "Origins of ingredients" + } + }], + "evaluation": "average", + "expanded": false, + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/public.svg", + "subtitle": "Origins of ingredients with a medium impact", + "title": "Origins of ingredients" + }, + "topics": ["environment"] + }, + "packaging_recycling": { + "elements": [{ + "element_type": "text", + "text_element": { + "evaluation": "good", + "html": "\n \n \n Bottle\n \n (Glass)\n \n
\n \n \n \n Bottle cap\n \n (Steel)\n \n
\n \n \n ", + "icon_alt": "Recycle", + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/recycle-variant.svg", + "type": "summary" + } + }], + "evaluation": "good", + "expanded": true, + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/packaging.svg", + "title": "Packaging with a low impact" + }, + "topics": ["environment"] + }, + "physical_activities": { + "elements": [{ + "element_type": "text", + "text_element": { + "evaluation": "good", + "html": "\n Swimming: 4 min \n ", + "icon_alt": "Swimming", + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-swimming.svg", + "type": "summary", + "valign": "middle" + } + }, { + "element_type": "text", + "text_element": { + "evaluation": "good", + "html": "\n Bicycling: 3 min \n ", + "icon_alt": "Bicycling", + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-bicycling.svg", + "type": "summary", + "valign": "middle" + } + }, { + "element_type": "text", + "text_element": { + "evaluation": "good", + "html": "\n Running: 2 min \n ", + "icon_alt": "Running", + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-running.svg", + "type": "summary", + "valign": "middle" + } + }, { + "element_type": "text", + "text_element": { + "html": "\n

Energy expenditure for a person weighting 70 kg / 154 lb

\n ", + "icon_color_from_evaluation": true, + "type": "summary" + } + }], + "evaluation": "good", + "expanded": false, + "level": "info", + "title_element": { + "icon_color_from_evaluation": true, + "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-walking.svg", + "subtitle": "Equal to walking 7 minutes or 700 steps", + "title": "120 kJ per 100g" + }, + "topics": ["health"] + }, + "root": { + "elements": [{ + "element_type": "panel", + "panel_element": { + "panel_id": "health_card" + } + }, { + "element_type": "panel", + "panel_element": { + "panel_id": "environment_card" + } + }], + "expanded": true, + "type": "root" + } + }, "labels_tags": ["en:organic", "en:eu-organic", "en:fair-trade"], "labels_tags_fr": ["Bio", "Bio européen", "Commerce équitable"], "lang": "en", diff --git a/packages/smooth_app/lib/data_models/onboarding_data_product.dart b/packages/smooth_app/lib/data_models/onboarding_data_product.dart index e8acb5e562b..f4a2b2d5bea 100644 --- a/packages/smooth_app/lib/data_models/onboarding_data_product.dart +++ b/packages/smooth_app/lib/data_models/onboarding_data_product.dart @@ -15,7 +15,7 @@ class OnboardingDataProduct extends AbstractOnboardingData { /// Was computed from [downloadDataString] in en_US /// - /// Something like https://world.openfoodfacts.org/api/v0/product/093270067481501.json?lc=en&cc=US&fields=product_name%2Cbrands%2Ccode%2Cnutrition_grade_fr%2Cimage_small_url%2Cimage_front_small_url%2Cimage_front_url%2Cimage_ingredients_url%2Cimage_nutrition_url%2Cimage_packaging_url%2Cselected_images%2Cquantity%2Cserving_size%2Cproduct_quantity%2Cnutriments%2Cnutrient_levels%2Cnutriment_energy_unit%2Cadditives_tags%2Cingredients_analysis_tags%2Clabels_tags%2Clabels_tags_fr%2Cenvironment_impact_level_tags%2Ccategories_tags_fr%2Clang%2Cattribute_groups%2Cstates_tags%2Cecoscore_data%2Cecoscore_grade%2Cecoscore_score%2Cenvironment_impact_level_tags + /// Something like https://world.openfoodfacts.org/api/v2/product/example/?fields=product_name%2Cbrands%2Ccode%2Cnutrition_grade_fr%2Cimage_small_url%2Cimage_front_small_url%2Cimage_front_url%2Cimage_ingredients_url%2Cimage_nutrition_url%2Cimage_packaging_url%2Cselected_images%2Cquantity%2Cserving_size%2Cproduct_quantity%2Cnutriments%2Cnutrient_levels%2Cnutriment_energy_unit%2Cadditives_tags%2Cingredients_analysis_tags%2Clabels_tags%2Clabels_tags_fr%2Cenvironment_impact_level_tags%2Ccategories_tags_fr%2Clang%2Cattribute_groups%2Cstates_tags%2Cecoscore_data%2Cecoscore_grade%2Cecoscore_score%2Cenvironment_impact_level_tags%2Cknowledge_panels&lc=en&cc=US OnboardingDataProduct.forProduct(final LocalDatabase _localDatabase) : this( _localDatabase, @@ -23,16 +23,6 @@ class OnboardingDataProduct extends AbstractOnboardingData { 'assets/onboarding/sample_product_data.json', ); - /// Was computed from [downloadDataString] in en_US - /// - /// Something like https://world.openfoodfacts.org/api/v2/product/093270067481501/?fields=knowledge_panels&lc=en&cc=US - OnboardingDataProduct.forKnowledgePanels(final LocalDatabase _localDatabase) - : this( - _localDatabase, - [ProductField.KNOWLEDGE_PANELS], - 'assets/onboarding/sample_knowledge_panels.json', - ); - final List fields; final String assetPath; diff --git a/packages/smooth_app/lib/data_models/onboarding_loader.dart b/packages/smooth_app/lib/data_models/onboarding_loader.dart index 6e071fd67ce..f1f6da2f81c 100644 --- a/packages/smooth_app/lib/data_models/onboarding_loader.dart +++ b/packages/smooth_app/lib/data_models/onboarding_loader.dart @@ -40,15 +40,10 @@ class OnboardingLoader { } /// Actual download of all data. - Future _downloadData() async { - await OnboardingDataProduct.forProduct(_localDatabase).downloadData(); - await OnboardingDataProduct.forKnowledgePanels(_localDatabase) - .downloadData(); - } + Future _downloadData() async => + OnboardingDataProduct.forProduct(_localDatabase).downloadData(); /// Unloads all data that are no longer required. - Future _unloadData() async { - await OnboardingDataProduct.forProduct(_localDatabase).clear(); - await OnboardingDataProduct.forKnowledgePanels(_localDatabase).clear(); - } + Future _unloadData() async => + OnboardingDataProduct.forProduct(_localDatabase).clear(); } diff --git a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart index 412afb5c61d..c9fe6491373 100644 --- a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart +++ b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart @@ -49,7 +49,7 @@ class _KnowledgePanelPageTemplateState Future _init() async { final Product product = - await OnboardingDataProduct.forKnowledgePanels(widget.localDatabase) + await OnboardingDataProduct.forProduct(widget.localDatabase) .getData(rootBundle); _knowledgePanels = product.knowledgePanels!; }