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: Nutrient levels knowledge panels with facts and recommendations #6980

Merged
merged 6 commits into from
Jul 15, 2022

Conversation

stephanegigandet
Copy link
Contributor

This adds the nutrient levels (aka nutrition traffic lights) for fat, saturated fat, sugars and salt, as knowledge panels just below the Nutri-Score panel.

It's a very good place to educate users about those nutrients: why they matter, what to do about them.

As an example, I added facts + recommendations for salt, based on the WHO and the UK NHS recommendations.

We could use default recommendations from the WHO, and then try to work with local health agencies to have more country specific health messages. (for instance in some countries, MSG / Monosodium Glutamate is a huge source of sodium, and something that should be highlighted).

Here is what it would look like on the OFF website:

image

@stephanegigandet stephanegigandet added the 📖 Knowledge Panels - https://wiki.openfoodfacts.org/Knowledge_panels label Jun 29, 2022
@stephanegigandet stephanegigandet requested a review from a team as a code owner June 29, 2022 15:43
@github-actions github-actions bot added Display 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Jun 29, 2022
@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Jul 8, 2022
@github-actions github-actions bot removed the 💥 Merge Conflicts 💥 Merge Conflicts label Jul 15, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

LGTM but a minor remark (also tested ok)

Comment on lines +22 to +37
"html":
`
<b>[% lang("knowledge_panels_facts") %]</b>
<ul>
<li>[% lang('nutrient_info_salt_risk') %]</li>
<li>[% lang('nutrient_info_salt_high_blood_pressure') %]</li>
<li>[% lang('nutrient_info_salt_high_consumption') %]</li>
</ul>
<br>
<b>[% lang("knowledge_panels_recommendation") %]</b>[% sep %]:
<b>[% lang('nutrient_recommendation_salt_title') %]</b>
<ul>
<li>[% lang('nutrient_recommendation_salt_cooking_and_table') %]</li>
<li>[% lang('nutrient_recommendation_salt_limit_salty_snacks') %]</li>
</ul>
`,
Copy link
Member

Choose a reason for hiding this comment

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

I find it a bit annoying that this is defined here so deeply in a technical construct. Shouldn't we put it in an external template (that we could include here) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure if a new level of indirection would make things simpler or more complex. The initial idea was that the knowledge panels templates was the place where we could define what information is presented and how.

I'll merge as-is and we can refine

@stephanegigandet stephanegigandet merged commit 80911fa into main Jul 15, 2022
@stephanegigandet stephanegigandet deleted the nutrient-levels branch July 15, 2022 16:35
dipietroR added a commit that referenced this pull request Jul 18, 2022
* refactor: adding perltidy to t/lang.t (#7044)

Implementing perltidy to t/lang.t , will have a merge conflict with PR
6085

* taxonomy: add new Polish translations (#7068)

* Polish translations of meat

* add additinal polish translations of popular ingredients

* taxonomy: Corrections to cheeses (#7065)

Update categories.txt

* refactor: adding perltidy to files (#7070)

Implementing perltidy to t/dataquality.t , t/dataqualityfood.t , t/export.t

* taxonomy: flaxseed fiber (#6945)

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* update taxonomy and tests

Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>

* docs: Add how-to for remote dev (Gitpod) (#7053)

* docs: Add how-to for remote dev (Gitpod)
* docs: Add references/badges for gitpod environments

* feat: Nutrient levels knowledge panels with facts and recommendations (#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat

* fix: fix vitamin b1 thiamin %DV  (#7072)

fix: fix vitamin b1 thiamin %DV #6882

* refactor: updating perl critic

Changing the perl critic config file to make it easier to pick and
choose what tests will run.

* feat: perlcritic unused variables check

* refactor: perlcritic github testing

* fetch depth

* add perlcritic

* better error message

* all errors

* allow ProductOpener::PerlStandards

* remove undef

* comment out severity 3

Commented outunused variable, severity 3 so that there are less merge
conflicts when implementing perltidy to files.

* refactor: dont look into .git directory

Making sure that perlcritic doesn't look into .git directory

* adding perlcritic to Makefile

* moving perlcritic to pull_request.yml

* default for perlcritic

* refactor: uncomment severity 3

* refactor: removing unused variables

Co-authored-by: Teiron <12804636+Teiron@users.noreply.github.com>
Co-authored-by: moon-rabbitOFF <34795011+moon-rabbitOFF@users.noreply.github.com>
Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
Co-authored-by: Tushar <ditsuke@protonmail.com>
alexgarel pushed a commit that referenced this pull request Jul 19, 2022
* refactor: adding perltidy to t/lang.t (#7044)

Implementing perltidy to t/lang.t , will have a merge conflict with PR
6085

* taxonomy: add new Polish translations (#7068)

* Polish translations of meat

* add additinal polish translations of popular ingredients

* taxonomy: Corrections to cheeses (#7065)

Update categories.txt

* refactor: adding perltidy to files (#7070)

Implementing perltidy to t/dataquality.t , t/dataqualityfood.t , t/export.t

* taxonomy: flaxseed fiber (#6945)

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* Update ingredients.txt

* update taxonomy and tests

Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>

* docs: Add how-to for remote dev (Gitpod) (#7053)

* docs: Add how-to for remote dev (Gitpod)
* docs: Add references/badges for gitpod environments

* feat: Nutrient levels knowledge panels with facts and recommendations (#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat

* fix: fix vitamin b1 thiamin %DV  (#7072)

fix: fix vitamin b1 thiamin %DV #6882

* refactor: updating perl critic

Changing the perl critic config file to make it easier to pick and
choose what tests will run.

* feat: perlcritic unused variables check

* refactor: perlcritic github testing

* fetch depth

* add perlcritic

* better error message

* all errors

* allow ProductOpener::PerlStandards

* remove undef

* comment out severity 3

Commented outunused variable, severity 3 so that there are less merge
conflicts when implementing perltidy to files.

* refactor: dont look into .git directory

Making sure that perlcritic doesn't look into .git directory

* adding perlcritic to Makefile

* moving perlcritic to pull_request.yml

* default for perlcritic

* refactor: uncomment severity 3

* refactor: removing unused variables

Co-authored-by: Teiron <12804636+Teiron@users.noreply.github.com>
Co-authored-by: moon-rabbitOFF <34795011+moon-rabbitOFF@users.noreply.github.com>
Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
Co-authored-by: Tushar <ditsuke@protonmail.com>
LandonPattison pushed a commit that referenced this pull request Jul 24, 2022
…#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat
LandonPattison pushed a commit that referenced this pull request Jul 25, 2022
…#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat
LandonPattison pushed a commit that referenced this pull request Jul 25, 2022
…#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat
LandonPattison pushed a commit that referenced this pull request Jul 25, 2022
…#6980)

* feat: knowledge panels for nutrient levels #6947

* add quantity in nutrient panel title

* facts + recommendations for salt

* fixed conflict

* add info and recommendations for sugars, fat and saturated fat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Display 📖 Knowledge Panels - https://wiki.openfoodfacts.org/Knowledge_panels 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants