openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
800 stars 275 forks source link

Leverage sub-knowledge panels towards the road to Scores #1136

Closed teolemon closed 2 years ago

teolemon commented 2 years ago

What

Mockup

image

Why

How

The API should be available on the .net and .org server

e.g. ingredients panel when we don't have ingredients:

ingredients: {
elements: [
{
action_element: {
actions: [
"add_ingredients_text"
],
html: "Could you add the ingredients list?"
},
element_type: "action"
}
],
evaluation: "unknown",
expand_for: "large",
expanded: false,
level: "info",
title_element: {
icon_color_from_evaluation: true,
icon_url: "http://static.openfoodfacts.localhost/images/icons/dist/ingredients.svg",
title: "Les ingrédients sont manquants"
},
topics: [
"health"
]
},

Nutri-Score panel when we are missing the category + nutrition facts:

nutriscore: {
elements: [
{
element_type: "text",
text_element: {
html: "La catégorie du produit doit être spécifiée afin de calculer le Nutri-Score.
                    ",
type: "warning"
}
},
{
element_type: "text",
text_element: {
html: "Les données nutritionnelles du produit doivent être spécifiées afin de calculer le Nutri-Score.
                    ",
type: "warning"
}
},
{
action_element: {
actions: [
"add_categories",
"add_nutrition_facts"
],
html: "Could you add the information needed to compute the Nutri-Score?"
},
element_type: "action"
},
teolemon commented 2 years ago

Related user report: image

teolemon commented 2 years ago

@monsieurtanuki the API should be available on the .net server This extends the knowledge panels API to add a new "action" element that contains a list of actions such as "add_categories", "add_ingredients_text", "add_nutrition_facts". Clients can then add buttons or links to directly add or edit the corresponding data.

e.g. ingredients panel when we don't have ingredients:

ingredients: {
elements: [
{
action_element: {
actions: [
"add_ingredients_text"
],
html: "Could you add the ingredients list?"
},
element_type: "action"
}
],
evaluation: "unknown",
expand_for: "large",
expanded: false,
level: "info",
title_element: {
icon_color_from_evaluation: true,
icon_url: "http://static.openfoodfacts.localhost/images/icons/dist/ingredients.svg",
title: "Les ingrédients sont manquants"
},
topics: [
"health"
]
},

Nutri-Score panel when we are missing the category + nutrition facts:

nutriscore: {
elements: [
{
element_type: "text",
text_element: {
html: "La catégorie du produit doit être spécifiée afin de calculer le Nutri-Score.
                    ",
type: "warning"
}
},
{
element_type: "text",
text_element: {
html: "Les données nutritionnelles du produit doivent être spécifiées afin de calculer le Nutri-Score.
                    ",
type: "warning"
}
},
{
action_element: {
actions: [
"add_categories",
"add_nutrition_facts"
],
html: "Could you add the information needed to compute the Nutri-Score?"
},
element_type: "action"
},
teolemon commented 2 years ago

@monsieurtanuki would you be interested by implementing the Smoothie side ?

monsieurtanuki commented 2 years ago

From off-dart 1.20.0 we have the new 'action_element' (#495)