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

Implement action_element in the Knowledge Panel API #493

Open
1 of 2 tasks
teolemon opened this issue Jun 25, 2022 · 0 comments
Open
1 of 2 tasks

Implement action_element in the Knowledge Panel API #493

teolemon opened this issue Jun 25, 2022 · 0 comments

Comments

@teolemon
Copy link
Member

What

  • Leverage sub-knowledge panels towards the road to Scores
  • The server side now provides 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
https://world.openfoodfacts.org/api/v2/product/4006922007543.json?fields=knowledge_panels
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"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant