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

feat: Add short name, value and evaluation to knowledge panels #9683

Merged
merged 11 commits into from
Sep 30, 2024
14 changes: 14 additions & 0 deletions docs/api/ref/schemas/knowledge_panels/panel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ properties:
expand_for:
type: string
description: 'If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it.'
name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for name and description, I think it would fit best in the title element where we already have a title / sub_title:
https://github.com/openfoodfacts/openfoodfacts-server/blob/main/docs/api/ref/schemas/knowledge_panels/elements/title_element.yaml

Currently we have:

title_element: {
icon_size: "small",
title_element: {
icon_size: "small",
icon_url: "https://static.openfoodfacts.org/images/misc/high.svg",
title: "Saturated fat in high quantity (10.6%)"
},icon_url: "https://static.openfoodfacts.org/images/misc/high.svg",
title: "Saturated fat in high quantity (10.6%)"
},

We could add "name", "value" in there, as they would be displayed as the clickable knowledge panel title.

We could also add "value_label" or similar so that we can display the "Additives to avoid" in the mockup:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the "Additives to avoid" just names too? e.g. we could equally well display it as:

Additives to avoid >
(red circle) 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, in terms of data, both the Fat and Additive to avoid panels are the same. There's a "field" name (fat or additive to avoid) and a value, possibly a unit (%), and an evaluation. So no need for "value_label"

type: string
description: A short name of this panel, not including any actual values
value:
type: string
description: A simple summary value for the panel, e.g. a percentage, grade, number of, etc.
evaluation:
type: string
description: A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red
enum:
- good
- average
- bad
- unknown
title_element:
$ref: ./elements/title_element.yaml
elements:
Expand Down
Loading