Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 2 tasks
Tracked by #499
teolemon opened this issue Feb 12, 2022 · 4 comments · Fixed by #2440
Closed
1 of 2 tasks
Tracked by #499

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

teolemon opened this issue Feb 12, 2022 · 4 comments · Fixed by #2440
Assignees
Labels
✏️ Contribution 📖 Knowledge panels 🎯 P1 🛣️ Road to scores The easier it is to get Nutri-Score, Eco-Score, the happier the users.
Milestone

Comments

@teolemon
Copy link
Member

teolemon commented Feb 12, 2022

What

  • Leverage sub-knowledge panels towards the road to Scores
  • This probably requires server side hints for editing

Mockup

image

Why

  • The user should never be in a dead end.

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
Copy link
Member Author

teolemon commented Jun 5, 2022

Related user report:
image

@teolemon
Copy link
Member Author

@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
Copy link
Member Author

teolemon commented Jun 25, 2022

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

@monsieurtanuki
Copy link
Contributor

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

@monsieurtanuki monsieurtanuki self-assigned this Jun 29, 2022
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 30, 2022
New files:
* `add_category_button.dart`: "Add category" button for user contribution.
* `add_ingredients_button.dart`: "Add ingredients" button for user contribution.
* `add_nutrition_button.dart`: "Add nutrition facts" button for user contribution.
* `knowledge_panel_action_card.dart`: "Contribute Actions" for the knowledge panels.

Impacted files:
* `knowledge_panel_card.dart`: refactored.
* `knowledge_panel_element_card.dart`: action "actions" element; refactored.
* `knowledge_panel_expanded_card.dart`: refactored.
* `knowledge_panel_group_card.dart`: refactored.
* `knowledge_panel_page.dart`: refactored.
* `knowledge_panel_page_template.dart`: refactored.
* `knowledge_panels_builder.dart`: added an explicit `bool onboardingMode` field; used new classes `AddNutritionButton` and `AddIngredientsButton`; refactored.
* `new_product_page.dart`: refactored.
* `summary_card.dart`: used new class `AddCategoryButton`; refactored.
monsieurtanuki added a commit that referenced this issue Jun 30, 2022
New files:
* `add_category_button.dart`: "Add category" button for user contribution.
* `add_ingredients_button.dart`: "Add ingredients" button for user contribution.
* `add_nutrition_button.dart`: "Add nutrition facts" button for user contribution.
* `knowledge_panel_action_card.dart`: "Contribute Actions" for the knowledge panels.

Impacted files:
* `knowledge_panel_card.dart`: refactored.
* `knowledge_panel_element_card.dart`: action "actions" element; refactored.
* `knowledge_panel_expanded_card.dart`: refactored.
* `knowledge_panel_group_card.dart`: refactored.
* `knowledge_panel_page.dart`: refactored.
* `knowledge_panel_page_template.dart`: refactored.
* `knowledge_panels_builder.dart`: added an explicit `bool onboardingMode` field; used new classes `AddNutritionButton` and `AddIngredientsButton`; refactored.
* `new_product_page.dart`: refactored.
* `summary_card.dart`: used new class `AddCategoryButton`; refactored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Contribution 📖 Knowledge panels 🎯 P1 🛣️ Road to scores The easier it is to get Nutri-Score, Eco-Score, the happier the users.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants