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

Conversation

john-gom
Copy link
Contributor

What

Create simple, short details for each panel to allow more compact visualisation, e.g. he new two-column approach in the mobile app.

Related issue(s) and discussion

@github-actions github-actions bot added 📚 Documentation Documentation issues improve the project for everyone. 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels labels Jan 22, 2024
@john-gom
Copy link
Contributor Author

Hi @stephanegigandet . Creating a draft pull request so you can review the proposed changes to the knowledge panel schema

@@ -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"

@github-actions github-actions bot added 🧪 tests Food.pm Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Display labels Jan 22, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9db5cd4) 49.44% compared to head (8c9e4e7) 39.18%.

❗ Current head 8c9e4e7 differs from pull request most recent head cb28796. Consider uploading reports for the commit cb28796 to get more accurate results

Files Patch % Lines
lib/ProductOpener/Food.pm 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9683       +/-   ##
===========================================
- Coverage   49.44%   39.18%   -10.27%     
===========================================
  Files          67       63        -4     
  Lines       20644    20164      -480     
  Branches     4978     4882       -96     
===========================================
- Hits        10208     7901     -2307     
- Misses       9139    11130     +1991     
+ Partials     1297     1133      -164     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) 🌱 Eco-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products 🧪 integration tests 🚦 Nutri-Score labels Jan 22, 2024
Copy link

sonarcloud bot commented Jan 22, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@teolemon
Copy link
Member

@john-gom @stephanegigandet any blockers to merging?

cc @g123k

@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Mar 26, 2024
@teolemon teolemon added 🎯 P0 🤳🥫 blocking mobile apps This issues are blocking a feature on the Open Food Facts mobile apps 🤳🥫 mobile apps labels Sep 18, 2024
@teolemon
Copy link
Member

@john-gom @stephanegigandet what's the command to update test results ? That might solve the conflict

@teolemon
Copy link
Member

@g123k FYI, the PR for the square knowledge panel is actually there

@stephanegigandet
Copy link
Contributor

I'm adding a property "half_width_on_mobile": true, for nutrient levels, and updating the tests.

@stephanegigandet stephanegigandet marked this pull request as ready for review September 27, 2024 09:56
@stephanegigandet stephanegigandet requested a review from a team as a code owner September 27, 2024 09:56
@teolemon teolemon requested a review from g123k September 27, 2024 10:14
@github-actions github-actions bot removed the 💥 Merge Conflicts 💥 Merge Conflicts label Sep 27, 2024
Copy link
Member

Choose a reason for hiding this comment

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

Cool to have updated the documentation here !

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

Great !

@alexgarel
Copy link
Member

/update_tests_results

Copy link

sonarcloud bot commented Sep 27, 2024

@stephanegigandet stephanegigandet merged commit bb5c3e2 into main Sep 30, 2024
13 checks passed
@stephanegigandet stephanegigandet deleted the issues/9368 branch September 30, 2024 13:42
stephanegigandet pushed a commit that referenced this pull request Oct 2, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.45.0](v2.44.0...v2.45.0)
(2024-10-02)


### Features

* Add short name, value and evaluation to knowledge panels
([#9683](#9683))
([bb5c3e2](bb5c3e2))
* enable attributes / personal search on OBF, OPF, OPFF, new config +
logos for OPF & OPFF
([#10757](#10757))
([7e25d9a](7e25d9a))
* make improvements to org table
([#10679](#10679))
([b0cfea1](b0cfea1))
* Small fixes + improvements
([#10818](#10818))
([bd91419](bd91419))


### Bug Fixes

* add Moji server IP to rate-limit allow-list
([#10785](#10785))
([065e0ab](065e0ab))
* add more nutrients to test, to test more things
([#10834](#10834))
([42b341d](42b341d))
* also check .pot GetText files in addition to .po files
([#10827](#10827))
([bb87197](bb87197))
* Determine obsolete and deleted from the product revision
([#10791](#10791))
([508d767](508d767))
* do not localize ecoscore on obf,opf,opff
([#10837](#10837))
([2f93877](2f93877))
* docs Adding closing ) to generate proper internal link
([#10850](#10850))
([492d6d9](492d6d9))
* docs Fixed proper denomination of product in query
([#10853](#10853))
([428dbb3](428dbb3))
* improve OCR JSON generation script
([#10802](#10802))
([3e8fee7](3e8fee7))
* incorrect self-reference in ingredient.yaml
([#10786](#10786))
([2757699](2757699))
* indicate some attributes have only mandatory / not_important options
([#10846](#10846))
([258dc8f](258dc8f))
* invalid type in product_misc.yaml
([#10787](#10787))
([21920a1](21920a1))
* new mongodb exports for obsolete products collection
([#10794](#10794))
([c22fc42](c22fc42))
* permissions for check-translations.sh
([#10838](#10838))
([62e12d6](62e12d6))
* YAML syntax in schema files.
([#10783](#10783))
([959c74c](959c74c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) 🤳🥫 blocking mobile apps This issues are blocking a feature on the Open Food Facts mobile apps Display 📚 Documentation Documentation issues improve the project for everyone. 🌱 Eco-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products Food.pm 🧪 integration tests 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels 🤳🥫 mobile apps 🚦 Nutri-Score 🎯 P0 Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests
Development

Successfully merging this pull request may close these issues.

New knowledge panels properties: half size panel + very short title and description
5 participants