From 931a4bc3585f5696c3840d498cfe762cf409196d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 24 Jan 2024 19:55:56 +0100 Subject: [PATCH 01/13] feat: new Nutri-Score panels --- .../attributes/src/points-negative-0-10.svg | 17 +++ .../attributes/src/points-negative-0-15.svg | 17 +++ .../attributes/src/points-negative-0-20.svg | 17 +++ .../attributes/src/points-negative-0-4.svg | 17 +++ .../attributes/src/points-negative-1-10.svg | 17 +++ .../attributes/src/points-negative-1-15.svg | 17 +++ .../attributes/src/points-negative-1-20.svg | 17 +++ .../attributes/src/points-negative-1-4.svg | 17 +++ .../attributes/src/points-negative-10-10.svg | 17 +++ .../attributes/src/points-negative-10-15.svg | 17 +++ .../attributes/src/points-negative-10-20.svg | 17 +++ .../attributes/src/points-negative-11-15.svg | 17 +++ .../attributes/src/points-negative-11-20.svg | 17 +++ .../attributes/src/points-negative-12-15.svg | 17 +++ .../attributes/src/points-negative-12-20.svg | 17 +++ .../attributes/src/points-negative-13-15.svg | 17 +++ .../attributes/src/points-negative-13-20.svg | 17 +++ .../attributes/src/points-negative-14-15.svg | 17 +++ .../attributes/src/points-negative-14-20.svg | 17 +++ .../attributes/src/points-negative-15-15.svg | 17 +++ .../attributes/src/points-negative-15-20.svg | 17 +++ .../attributes/src/points-negative-16-20.svg | 17 +++ .../attributes/src/points-negative-17-20.svg | 17 +++ .../attributes/src/points-negative-18-20.svg | 17 +++ .../attributes/src/points-negative-19-20.svg | 17 +++ .../attributes/src/points-negative-2-10.svg | 17 +++ .../attributes/src/points-negative-2-15.svg | 17 +++ .../attributes/src/points-negative-2-20.svg | 17 +++ .../attributes/src/points-negative-2-4.svg | 17 +++ .../attributes/src/points-negative-20-20.svg | 17 +++ .../attributes/src/points-negative-3-10.svg | 17 +++ .../attributes/src/points-negative-3-15.svg | 17 +++ .../attributes/src/points-negative-3-20.svg | 17 +++ .../attributes/src/points-negative-3-4.svg | 17 +++ .../attributes/src/points-negative-4-10.svg | 17 +++ .../attributes/src/points-negative-4-15.svg | 17 +++ .../attributes/src/points-negative-4-20.svg | 17 +++ .../attributes/src/points-negative-4-4.svg | 17 +++ .../attributes/src/points-negative-5-10.svg | 17 +++ .../attributes/src/points-negative-5-15.svg | 17 +++ .../attributes/src/points-negative-5-20.svg | 17 +++ .../attributes/src/points-negative-6-10.svg | 17 +++ .../attributes/src/points-negative-6-15.svg | 17 +++ .../attributes/src/points-negative-6-20.svg | 17 +++ .../attributes/src/points-negative-7-10.svg | 17 +++ .../attributes/src/points-negative-7-15.svg | 17 +++ .../attributes/src/points-negative-7-20.svg | 17 +++ .../attributes/src/points-negative-8-10.svg | 17 +++ .../attributes/src/points-negative-8-15.svg | 17 +++ .../attributes/src/points-negative-8-20.svg | 17 +++ .../attributes/src/points-negative-9-10.svg | 17 +++ .../attributes/src/points-negative-9-15.svg | 17 +++ .../attributes/src/points-negative-9-20.svg | 17 +++ .../attributes/src/points-positive-0-5.svg | 17 +++ .../attributes/src/points-positive-0-6.svg | 17 +++ .../attributes/src/points-positive-0-7.svg | 17 +++ .../attributes/src/points-positive-1-5.svg | 17 +++ .../attributes/src/points-positive-1-6.svg | 17 +++ .../attributes/src/points-positive-1-7.svg | 17 +++ .../attributes/src/points-positive-2-5.svg | 17 +++ .../attributes/src/points-positive-2-6.svg | 17 +++ .../attributes/src/points-positive-2-7.svg | 17 +++ .../attributes/src/points-positive-3-5.svg | 17 +++ .../attributes/src/points-positive-3-6.svg | 17 +++ .../attributes/src/points-positive-3-7.svg | 17 +++ .../attributes/src/points-positive-4-5.svg | 17 +++ .../attributes/src/points-positive-4-6.svg | 17 +++ .../attributes/src/points-positive-4-7.svg | 17 +++ .../attributes/src/points-positive-5-5.svg | 17 +++ .../attributes/src/points-positive-5-6.svg | 17 +++ .../attributes/src/points-positive-5-7.svg | 17 +++ .../attributes/src/points-positive-6-6.svg | 17 +++ .../attributes/src/points-positive-6-7.svg | 17 +++ .../attributes/src/points-positive-7-7.svg | 17 +++ icons/circle-minus.svg | 39 ++++++ icons/circle-plus.svg | 1 + icons/material/add_circle.svg | 1 + lib/ProductOpener/Display.pm | 29 ++-- lib/ProductOpener/KnowledgePanels.pm | 48 +++++++ lib/ProductOpener/Nutriscore.pm | 65 ++++++--- scripts/gen_svg_images_for_points.pl | 124 ++++++++++++++++++ .../health/nutriscore/nutriscore_2023.tt.json | 93 +++++++++++++ .../nutriscore/nutriscore_component.tt.json | 22 ++++ .../health/nutrition_panels.tt.json | 3 + templates/web/panels/panel.tt.html | 28 +++- 85 files changed, 1682 insertions(+), 29 deletions(-) create mode 100644 html/images/attributes/src/points-negative-0-10.svg create mode 100644 html/images/attributes/src/points-negative-0-15.svg create mode 100644 html/images/attributes/src/points-negative-0-20.svg create mode 100644 html/images/attributes/src/points-negative-0-4.svg create mode 100644 html/images/attributes/src/points-negative-1-10.svg create mode 100644 html/images/attributes/src/points-negative-1-15.svg create mode 100644 html/images/attributes/src/points-negative-1-20.svg create mode 100644 html/images/attributes/src/points-negative-1-4.svg create mode 100644 html/images/attributes/src/points-negative-10-10.svg create mode 100644 html/images/attributes/src/points-negative-10-15.svg create mode 100644 html/images/attributes/src/points-negative-10-20.svg create mode 100644 html/images/attributes/src/points-negative-11-15.svg create mode 100644 html/images/attributes/src/points-negative-11-20.svg create mode 100644 html/images/attributes/src/points-negative-12-15.svg create mode 100644 html/images/attributes/src/points-negative-12-20.svg create mode 100644 html/images/attributes/src/points-negative-13-15.svg create mode 100644 html/images/attributes/src/points-negative-13-20.svg create mode 100644 html/images/attributes/src/points-negative-14-15.svg create mode 100644 html/images/attributes/src/points-negative-14-20.svg create mode 100644 html/images/attributes/src/points-negative-15-15.svg create mode 100644 html/images/attributes/src/points-negative-15-20.svg create mode 100644 html/images/attributes/src/points-negative-16-20.svg create mode 100644 html/images/attributes/src/points-negative-17-20.svg create mode 100644 html/images/attributes/src/points-negative-18-20.svg create mode 100644 html/images/attributes/src/points-negative-19-20.svg create mode 100644 html/images/attributes/src/points-negative-2-10.svg create mode 100644 html/images/attributes/src/points-negative-2-15.svg create mode 100644 html/images/attributes/src/points-negative-2-20.svg create mode 100644 html/images/attributes/src/points-negative-2-4.svg create mode 100644 html/images/attributes/src/points-negative-20-20.svg create mode 100644 html/images/attributes/src/points-negative-3-10.svg create mode 100644 html/images/attributes/src/points-negative-3-15.svg create mode 100644 html/images/attributes/src/points-negative-3-20.svg create mode 100644 html/images/attributes/src/points-negative-3-4.svg create mode 100644 html/images/attributes/src/points-negative-4-10.svg create mode 100644 html/images/attributes/src/points-negative-4-15.svg create mode 100644 html/images/attributes/src/points-negative-4-20.svg create mode 100644 html/images/attributes/src/points-negative-4-4.svg create mode 100644 html/images/attributes/src/points-negative-5-10.svg create mode 100644 html/images/attributes/src/points-negative-5-15.svg create mode 100644 html/images/attributes/src/points-negative-5-20.svg create mode 100644 html/images/attributes/src/points-negative-6-10.svg create mode 100644 html/images/attributes/src/points-negative-6-15.svg create mode 100644 html/images/attributes/src/points-negative-6-20.svg create mode 100644 html/images/attributes/src/points-negative-7-10.svg create mode 100644 html/images/attributes/src/points-negative-7-15.svg create mode 100644 html/images/attributes/src/points-negative-7-20.svg create mode 100644 html/images/attributes/src/points-negative-8-10.svg create mode 100644 html/images/attributes/src/points-negative-8-15.svg create mode 100644 html/images/attributes/src/points-negative-8-20.svg create mode 100644 html/images/attributes/src/points-negative-9-10.svg create mode 100644 html/images/attributes/src/points-negative-9-15.svg create mode 100644 html/images/attributes/src/points-negative-9-20.svg create mode 100644 html/images/attributes/src/points-positive-0-5.svg create mode 100644 html/images/attributes/src/points-positive-0-6.svg create mode 100644 html/images/attributes/src/points-positive-0-7.svg create mode 100644 html/images/attributes/src/points-positive-1-5.svg create mode 100644 html/images/attributes/src/points-positive-1-6.svg create mode 100644 html/images/attributes/src/points-positive-1-7.svg create mode 100644 html/images/attributes/src/points-positive-2-5.svg create mode 100644 html/images/attributes/src/points-positive-2-6.svg create mode 100644 html/images/attributes/src/points-positive-2-7.svg create mode 100644 html/images/attributes/src/points-positive-3-5.svg create mode 100644 html/images/attributes/src/points-positive-3-6.svg create mode 100644 html/images/attributes/src/points-positive-3-7.svg create mode 100644 html/images/attributes/src/points-positive-4-5.svg create mode 100644 html/images/attributes/src/points-positive-4-6.svg create mode 100644 html/images/attributes/src/points-positive-4-7.svg create mode 100644 html/images/attributes/src/points-positive-5-5.svg create mode 100644 html/images/attributes/src/points-positive-5-6.svg create mode 100644 html/images/attributes/src/points-positive-5-7.svg create mode 100644 html/images/attributes/src/points-positive-6-6.svg create mode 100644 html/images/attributes/src/points-positive-6-7.svg create mode 100644 html/images/attributes/src/points-positive-7-7.svg create mode 100644 icons/circle-minus.svg create mode 120000 icons/circle-plus.svg create mode 100644 icons/material/add_circle.svg create mode 100755 scripts/gen_svg_images_for_points.pl create mode 100644 templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json create mode 100644 templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json diff --git a/html/images/attributes/src/points-negative-0-10.svg b/html/images/attributes/src/points-negative-0-10.svg new file mode 100644 index 0000000000000..2e41f1e3111b6 --- /dev/null +++ b/html/images/attributes/src/points-negative-0-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-0-15.svg b/html/images/attributes/src/points-negative-0-15.svg new file mode 100644 index 0000000000000..0087ae052c4f6 --- /dev/null +++ b/html/images/attributes/src/points-negative-0-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-0-20.svg b/html/images/attributes/src/points-negative-0-20.svg new file mode 100644 index 0000000000000..1b1a19deeed3c --- /dev/null +++ b/html/images/attributes/src/points-negative-0-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-0-4.svg b/html/images/attributes/src/points-negative-0-4.svg new file mode 100644 index 0000000000000..2bee428b6e885 --- /dev/null +++ b/html/images/attributes/src/points-negative-0-4.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-1-10.svg b/html/images/attributes/src/points-negative-1-10.svg new file mode 100644 index 0000000000000..b5b8facb08882 --- /dev/null +++ b/html/images/attributes/src/points-negative-1-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-1-15.svg b/html/images/attributes/src/points-negative-1-15.svg new file mode 100644 index 0000000000000..7217f6eca41d4 --- /dev/null +++ b/html/images/attributes/src/points-negative-1-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-1-20.svg b/html/images/attributes/src/points-negative-1-20.svg new file mode 100644 index 0000000000000..e23b0c5ab35a3 --- /dev/null +++ b/html/images/attributes/src/points-negative-1-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-1-4.svg b/html/images/attributes/src/points-negative-1-4.svg new file mode 100644 index 0000000000000..3fdc3ccc3e25b --- /dev/null +++ b/html/images/attributes/src/points-negative-1-4.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-10-10.svg b/html/images/attributes/src/points-negative-10-10.svg new file mode 100644 index 0000000000000..eae6bf54c86f2 --- /dev/null +++ b/html/images/attributes/src/points-negative-10-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-10-15.svg b/html/images/attributes/src/points-negative-10-15.svg new file mode 100644 index 0000000000000..4967c57563522 --- /dev/null +++ b/html/images/attributes/src/points-negative-10-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-10-20.svg b/html/images/attributes/src/points-negative-10-20.svg new file mode 100644 index 0000000000000..0f113ccb8e1fc --- /dev/null +++ b/html/images/attributes/src/points-negative-10-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-11-15.svg b/html/images/attributes/src/points-negative-11-15.svg new file mode 100644 index 0000000000000..bf17dbbd26854 --- /dev/null +++ b/html/images/attributes/src/points-negative-11-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-11-20.svg b/html/images/attributes/src/points-negative-11-20.svg new file mode 100644 index 0000000000000..5e2cd2817b357 --- /dev/null +++ b/html/images/attributes/src/points-negative-11-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-12-15.svg b/html/images/attributes/src/points-negative-12-15.svg new file mode 100644 index 0000000000000..ddd15263dd1b0 --- /dev/null +++ b/html/images/attributes/src/points-negative-12-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-12-20.svg b/html/images/attributes/src/points-negative-12-20.svg new file mode 100644 index 0000000000000..9ec107ea1b95b --- /dev/null +++ b/html/images/attributes/src/points-negative-12-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-13-15.svg b/html/images/attributes/src/points-negative-13-15.svg new file mode 100644 index 0000000000000..0e78cae7bbe35 --- /dev/null +++ b/html/images/attributes/src/points-negative-13-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-13-20.svg b/html/images/attributes/src/points-negative-13-20.svg new file mode 100644 index 0000000000000..7a8b77db14ece --- /dev/null +++ b/html/images/attributes/src/points-negative-13-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-14-15.svg b/html/images/attributes/src/points-negative-14-15.svg new file mode 100644 index 0000000000000..7bb8d90e15907 --- /dev/null +++ b/html/images/attributes/src/points-negative-14-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-14-20.svg b/html/images/attributes/src/points-negative-14-20.svg new file mode 100644 index 0000000000000..9eb5c161edf71 --- /dev/null +++ b/html/images/attributes/src/points-negative-14-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-15-15.svg b/html/images/attributes/src/points-negative-15-15.svg new file mode 100644 index 0000000000000..309884324ff3d --- /dev/null +++ b/html/images/attributes/src/points-negative-15-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-15-20.svg b/html/images/attributes/src/points-negative-15-20.svg new file mode 100644 index 0000000000000..05cd305c969bf --- /dev/null +++ b/html/images/attributes/src/points-negative-15-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-16-20.svg b/html/images/attributes/src/points-negative-16-20.svg new file mode 100644 index 0000000000000..c36c36cf4d615 --- /dev/null +++ b/html/images/attributes/src/points-negative-16-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-17-20.svg b/html/images/attributes/src/points-negative-17-20.svg new file mode 100644 index 0000000000000..eb8e37c0c97a3 --- /dev/null +++ b/html/images/attributes/src/points-negative-17-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-18-20.svg b/html/images/attributes/src/points-negative-18-20.svg new file mode 100644 index 0000000000000..bef639d406973 --- /dev/null +++ b/html/images/attributes/src/points-negative-18-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-19-20.svg b/html/images/attributes/src/points-negative-19-20.svg new file mode 100644 index 0000000000000..abe737b00a60f --- /dev/null +++ b/html/images/attributes/src/points-negative-19-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-2-10.svg b/html/images/attributes/src/points-negative-2-10.svg new file mode 100644 index 0000000000000..15645198809b5 --- /dev/null +++ b/html/images/attributes/src/points-negative-2-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-2-15.svg b/html/images/attributes/src/points-negative-2-15.svg new file mode 100644 index 0000000000000..a2302db67f90f --- /dev/null +++ b/html/images/attributes/src/points-negative-2-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-2-20.svg b/html/images/attributes/src/points-negative-2-20.svg new file mode 100644 index 0000000000000..f58aa71d6b019 --- /dev/null +++ b/html/images/attributes/src/points-negative-2-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-2-4.svg b/html/images/attributes/src/points-negative-2-4.svg new file mode 100644 index 0000000000000..4594a1aff2d21 --- /dev/null +++ b/html/images/attributes/src/points-negative-2-4.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-20-20.svg b/html/images/attributes/src/points-negative-20-20.svg new file mode 100644 index 0000000000000..a3badc673a461 --- /dev/null +++ b/html/images/attributes/src/points-negative-20-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-3-10.svg b/html/images/attributes/src/points-negative-3-10.svg new file mode 100644 index 0000000000000..01f7b4ae031d6 --- /dev/null +++ b/html/images/attributes/src/points-negative-3-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-3-15.svg b/html/images/attributes/src/points-negative-3-15.svg new file mode 100644 index 0000000000000..508c579c806e8 --- /dev/null +++ b/html/images/attributes/src/points-negative-3-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-3-20.svg b/html/images/attributes/src/points-negative-3-20.svg new file mode 100644 index 0000000000000..bb7cf1fcf884e --- /dev/null +++ b/html/images/attributes/src/points-negative-3-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-3-4.svg b/html/images/attributes/src/points-negative-3-4.svg new file mode 100644 index 0000000000000..a704ec9875061 --- /dev/null +++ b/html/images/attributes/src/points-negative-3-4.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-4-10.svg b/html/images/attributes/src/points-negative-4-10.svg new file mode 100644 index 0000000000000..365e2bea45601 --- /dev/null +++ b/html/images/attributes/src/points-negative-4-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-4-15.svg b/html/images/attributes/src/points-negative-4-15.svg new file mode 100644 index 0000000000000..a44d1192547d4 --- /dev/null +++ b/html/images/attributes/src/points-negative-4-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-4-20.svg b/html/images/attributes/src/points-negative-4-20.svg new file mode 100644 index 0000000000000..426644bf384f7 --- /dev/null +++ b/html/images/attributes/src/points-negative-4-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-4-4.svg b/html/images/attributes/src/points-negative-4-4.svg new file mode 100644 index 0000000000000..7b1da491be5df --- /dev/null +++ b/html/images/attributes/src/points-negative-4-4.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-5-10.svg b/html/images/attributes/src/points-negative-5-10.svg new file mode 100644 index 0000000000000..aa1856bad3380 --- /dev/null +++ b/html/images/attributes/src/points-negative-5-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-5-15.svg b/html/images/attributes/src/points-negative-5-15.svg new file mode 100644 index 0000000000000..c1de5699a678e --- /dev/null +++ b/html/images/attributes/src/points-negative-5-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-5-20.svg b/html/images/attributes/src/points-negative-5-20.svg new file mode 100644 index 0000000000000..301cd3befce93 --- /dev/null +++ b/html/images/attributes/src/points-negative-5-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-6-10.svg b/html/images/attributes/src/points-negative-6-10.svg new file mode 100644 index 0000000000000..6cd9e0e26ca10 --- /dev/null +++ b/html/images/attributes/src/points-negative-6-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-6-15.svg b/html/images/attributes/src/points-negative-6-15.svg new file mode 100644 index 0000000000000..cf432838ed6b3 --- /dev/null +++ b/html/images/attributes/src/points-negative-6-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-6-20.svg b/html/images/attributes/src/points-negative-6-20.svg new file mode 100644 index 0000000000000..4e723be36b262 --- /dev/null +++ b/html/images/attributes/src/points-negative-6-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-7-10.svg b/html/images/attributes/src/points-negative-7-10.svg new file mode 100644 index 0000000000000..a30a376ec927c --- /dev/null +++ b/html/images/attributes/src/points-negative-7-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-7-15.svg b/html/images/attributes/src/points-negative-7-15.svg new file mode 100644 index 0000000000000..eeef92340a27d --- /dev/null +++ b/html/images/attributes/src/points-negative-7-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-7-20.svg b/html/images/attributes/src/points-negative-7-20.svg new file mode 100644 index 0000000000000..761524436645c --- /dev/null +++ b/html/images/attributes/src/points-negative-7-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-8-10.svg b/html/images/attributes/src/points-negative-8-10.svg new file mode 100644 index 0000000000000..974e4bebc5e7e --- /dev/null +++ b/html/images/attributes/src/points-negative-8-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-8-15.svg b/html/images/attributes/src/points-negative-8-15.svg new file mode 100644 index 0000000000000..0a73c260d77bb --- /dev/null +++ b/html/images/attributes/src/points-negative-8-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-8-20.svg b/html/images/attributes/src/points-negative-8-20.svg new file mode 100644 index 0000000000000..aca40e1769f91 --- /dev/null +++ b/html/images/attributes/src/points-negative-8-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-9-10.svg b/html/images/attributes/src/points-negative-9-10.svg new file mode 100644 index 0000000000000..97af0f992026c --- /dev/null +++ b/html/images/attributes/src/points-negative-9-10.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-9-15.svg b/html/images/attributes/src/points-negative-9-15.svg new file mode 100644 index 0000000000000..197d08cf1ff81 --- /dev/null +++ b/html/images/attributes/src/points-negative-9-15.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-negative-9-20.svg b/html/images/attributes/src/points-negative-9-20.svg new file mode 100644 index 0000000000000..854035d3de9ed --- /dev/null +++ b/html/images/attributes/src/points-negative-9-20.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-0-5.svg b/html/images/attributes/src/points-positive-0-5.svg new file mode 100644 index 0000000000000..380728052addd --- /dev/null +++ b/html/images/attributes/src/points-positive-0-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-0-6.svg b/html/images/attributes/src/points-positive-0-6.svg new file mode 100644 index 0000000000000..3bafaa7095ec7 --- /dev/null +++ b/html/images/attributes/src/points-positive-0-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-0-7.svg b/html/images/attributes/src/points-positive-0-7.svg new file mode 100644 index 0000000000000..e329fded0a130 --- /dev/null +++ b/html/images/attributes/src/points-positive-0-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-1-5.svg b/html/images/attributes/src/points-positive-1-5.svg new file mode 100644 index 0000000000000..f6a4e4d0a2f3c --- /dev/null +++ b/html/images/attributes/src/points-positive-1-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-1-6.svg b/html/images/attributes/src/points-positive-1-6.svg new file mode 100644 index 0000000000000..2e2cb6eac7cf8 --- /dev/null +++ b/html/images/attributes/src/points-positive-1-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-1-7.svg b/html/images/attributes/src/points-positive-1-7.svg new file mode 100644 index 0000000000000..f09e6e619e58d --- /dev/null +++ b/html/images/attributes/src/points-positive-1-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-2-5.svg b/html/images/attributes/src/points-positive-2-5.svg new file mode 100644 index 0000000000000..50977fa77703b --- /dev/null +++ b/html/images/attributes/src/points-positive-2-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-2-6.svg b/html/images/attributes/src/points-positive-2-6.svg new file mode 100644 index 0000000000000..6373d99bb826a --- /dev/null +++ b/html/images/attributes/src/points-positive-2-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-2-7.svg b/html/images/attributes/src/points-positive-2-7.svg new file mode 100644 index 0000000000000..12fd429b6cfa2 --- /dev/null +++ b/html/images/attributes/src/points-positive-2-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-3-5.svg b/html/images/attributes/src/points-positive-3-5.svg new file mode 100644 index 0000000000000..dd9bc5b735f36 --- /dev/null +++ b/html/images/attributes/src/points-positive-3-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-3-6.svg b/html/images/attributes/src/points-positive-3-6.svg new file mode 100644 index 0000000000000..b087911e544f1 --- /dev/null +++ b/html/images/attributes/src/points-positive-3-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-3-7.svg b/html/images/attributes/src/points-positive-3-7.svg new file mode 100644 index 0000000000000..1c7cb815e4051 --- /dev/null +++ b/html/images/attributes/src/points-positive-3-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-4-5.svg b/html/images/attributes/src/points-positive-4-5.svg new file mode 100644 index 0000000000000..6a0cb62f1dbdf --- /dev/null +++ b/html/images/attributes/src/points-positive-4-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-4-6.svg b/html/images/attributes/src/points-positive-4-6.svg new file mode 100644 index 0000000000000..01c27fd4407d3 --- /dev/null +++ b/html/images/attributes/src/points-positive-4-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-4-7.svg b/html/images/attributes/src/points-positive-4-7.svg new file mode 100644 index 0000000000000..960af36636ab4 --- /dev/null +++ b/html/images/attributes/src/points-positive-4-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-5-5.svg b/html/images/attributes/src/points-positive-5-5.svg new file mode 100644 index 0000000000000..617aef390a50d --- /dev/null +++ b/html/images/attributes/src/points-positive-5-5.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-5-6.svg b/html/images/attributes/src/points-positive-5-6.svg new file mode 100644 index 0000000000000..bb306461d2a70 --- /dev/null +++ b/html/images/attributes/src/points-positive-5-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-5-7.svg b/html/images/attributes/src/points-positive-5-7.svg new file mode 100644 index 0000000000000..81e52162d0424 --- /dev/null +++ b/html/images/attributes/src/points-positive-5-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-6-6.svg b/html/images/attributes/src/points-positive-6-6.svg new file mode 100644 index 0000000000000..b37c45f0ff9ef --- /dev/null +++ b/html/images/attributes/src/points-positive-6-6.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-6-7.svg b/html/images/attributes/src/points-positive-6-7.svg new file mode 100644 index 0000000000000..6525f0bc5abdb --- /dev/null +++ b/html/images/attributes/src/points-positive-6-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/html/images/attributes/src/points-positive-7-7.svg b/html/images/attributes/src/points-positive-7-7.svg new file mode 100644 index 0000000000000..0038af5c62efa --- /dev/null +++ b/html/images/attributes/src/points-positive-7-7.svg @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/icons/circle-minus.svg b/icons/circle-minus.svg new file mode 100644 index 0000000000000..23f891427bb95 --- /dev/null +++ b/icons/circle-minus.svg @@ -0,0 +1,39 @@ + + + + + + diff --git a/icons/circle-plus.svg b/icons/circle-plus.svg new file mode 120000 index 0000000000000..06dbe2b627a5a --- /dev/null +++ b/icons/circle-plus.svg @@ -0,0 +1 @@ +material/add_circle.svg \ No newline at end of file diff --git a/icons/material/add_circle.svg b/icons/material/add_circle.svg new file mode 100644 index 0000000000000..238dd1c252c6a --- /dev/null +++ b/icons/material/add_circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index 5e2c3df127bb0..c83fcf3723e12 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -921,6 +921,10 @@ CSS }; } + if ($request_ref->{admin}) { + $knowledge_panels_options_ref->{admin} = 1; + } + $log->debug( "owner, org and user", { @@ -8873,7 +8877,7 @@ HTML return; } -=head2 display_nutriscore_calculation_details( $nutriscore_data_ref ) +=head2 display_nutriscore_calculation_details( $nutriscore_data_ref, $version = "2021" ) Generates HTML code with information on how the Nutri-Score was computed for a particular product. @@ -8882,7 +8886,7 @@ the rounded value according to the Nutri-Score rules, and the corresponding poin =cut -sub display_nutriscore_calculation_details ($nutriscore_data_ref) { +sub display_nutriscore_calculation_details ($nutriscore_data_ref, $version = "2021") { my $beverage_view; @@ -9069,7 +9073,7 @@ sub data_to_display_nutrient_levels ($product_ref) { return $result_data_ref; } -=head2 data_to_display_nutriscore ( $product_ref ) +=head2 data_to_display_nutriscore ($nutriscore_data_ref, $version = "2021" ) Generates a data structure to display the Nutri-Score. @@ -9085,9 +9089,7 @@ Reference to a data structure with needed data to display. =cut -sub data_to_display_nutriscore($) { - - my $product_ref = shift; +sub data_to_display_nutriscore ($product_ref, $version = "2021") { my $result_data_ref = {}; @@ -9095,9 +9097,17 @@ sub data_to_display_nutriscore($) { my @nutriscore_warnings = (); - if ((defined $product_ref->{nutrition_grade_fr}) and ($product_ref->{nutrition_grade_fr} =~ /^[abcde]$/)) { + my $nutriscore_grade = deep_get($product_ref, "nutriscore", $version, "grade"); + my $nutriscore_data_ref = deep_get($product_ref, "nutriscore", $version, "data"); + # On old product revisions, nutriscore grade was in nutrition_grade_fr + if ((not defined $nutriscore_grade) and ($version eq "2021")) { + $nutriscore_grade = $product_ref->{"nutrition_grade_fr"}; + $nutriscore_data_ref = $product_ref->{nutriscore_data}; + } + + if ((defined $nutriscore_grade) and ($nutriscore_grade =~ /^[abcde]$/)) { - $result_data_ref->{nutriscore_grade} = $product_ref->{"nutrition_grade_fr"}; + $result_data_ref->{nutriscore_grade} = $nutriscore_grade; # Do not display a warning for water if (not(has_tag($product_ref, "categories", "en:spring-waters"))) { @@ -9212,8 +9222,7 @@ sub data_to_display_nutriscore($) { # Display the details of the computation of the Nutri-Score if we computed one if ((defined $product_ref->{nutriscore_grade}) and ($product_ref->{nutriscore_grade} =~ /^[a-e]$/)) { - $result_data_ref->{nutriscore_details} - = display_nutriscore_calculation_details($product_ref->{nutriscore_data}); + $result_data_ref->{nutriscore_details} = display_nutriscore_calculation_details($nutriscore_data_ref, $version); } return $result_data_ref; diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index a17354ab553b1..aa93af2350cbb 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -810,6 +810,9 @@ sub create_health_card_panel ($product_ref, $target_lc, $target_cc, $options_ref $log->debug("create health card panel", {code => $product_ref->{code}}) if $log->is_debug(); create_nutriscore_panel($product_ref, $target_lc, $target_cc, $options_ref); + if ($options_ref->{admin}) { + create_nutriscore_2023_panel($product_ref, $target_lc, $target_cc, $options_ref); + } create_nutrient_levels_panels($product_ref, $target_lc, $target_cc, $options_ref); @@ -882,6 +885,51 @@ sub create_nutriscore_panel ($product_ref, $target_lc, $target_cc, $options_ref) return; } +sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options_ref) { + + my $version = "2023"; + + $log->debug("create nutriscore_2023 panel", + {code => $product_ref->{code}, nutriscore_data => deep_get($product_ref, qw/nutriscore 2023 data/)}) + if $log->is_debug(); + + my $panel_data_ref = data_to_display_nutriscore($product_ref, $version); + + # Nutri-Score panel + + if ($panel_data_ref->{nutriscore_grade} eq "not-applicable") { + $panel_data_ref->{title} = lang_in_other_lc($target_lc, "attribute_nutriscore_not_applicable_title"); + } + else { + $panel_data_ref->{title} = lang_in_other_lc($target_lc, + "attribute_nutriscore_" . $panel_data_ref->{nutriscore_grade} . "_description_short"); + } + + # Nutri-Score sub-panels for each positive or negative component + foreach my $type (qw/positive negative/) { + my $components_ref = deep_get($product_ref, "nutriscore", $version, "data", "components", $type) // []; + foreach my $component_ref (@$components_ref) { + my $component_panel_data_ref = { + "type" => $type, + "id" => $component_ref->{id}, + "value" => $component_ref->{value}, + "points" => $component_ref->{points}, + "max" => $component_ref->{max}, + }; + create_panel_from_json_template( + "nutriscore_component_" . $component_ref->{id}, + "api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json", + $component_panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref + ); + } + } + + # Nutri-Score panel: score + create_panel_from_json_template("nutriscore_2023", "api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json", + $panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref); + return; +} + =head2 create_nutrient_levels_panels ( $product_ref, $target_lc, $target_cc, $options_ref ) Creates knowledge panels for nutrient levels for fat, saturated fat, sugars and salt. diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index b394204345a41..c2092bd6b84d6 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -170,8 +170,8 @@ Returned values: - [nutrient]_value -> rounded values for each nutrient according to the Nutri-Score rules - [nutrient]_points -> points for each nutrient -- negative_points -> sum of unfavorable nutrients points -- positive_points -> sum of favorable nutrients points +- negative_points -> sum of negative nutrients points +- positive_points -> sum of positive nutrients points The nutrients that are counted for the negative and positive points depend on the product type (if it is a beverage, cheese or fat) and on the values for some of the nutrients. @@ -392,7 +392,7 @@ sub compute_nutriscore_score_2021 ($nutriscore_data_ref) { } } - # Negative points + # negative points $nutriscore_data_ref->{negative_points} = 0; foreach my $nutrient ("energy", "sugars", $saturated_fat, "sodium") { @@ -516,9 +516,9 @@ Returned values: - [nutrient]_value -> rounded values for each nutrient according to the Nutri-Score rules - [nutrient]_points -> points for each nutrient - negative_nutrients -> list of nutrients that are counted in negative points -- negative_points -> sum of unfavorable nutrients points +- negative_points -> sum of negative nutrients points - positive_nutrients -> list of nutrients that are counted in positive points -- positive_points -> sum of favorable nutrients points +- positive_points -> sum of positive nutrients points - count_proteins -> indicates if proteins are counted in the positive points - count_proteins_reason -> indicates why proteins are counted @@ -563,8 +563,7 @@ my %points_thresholds_2023 = ( sugars => [3.4, 6.8, 10, 14, 17, 20, 24, 27, 31, 34, 37, 41, 44, 48, 51], # g / 100g sugars_beverages => [0.5, 2, 3.5, 5, 6, 7, 8, 9, 10, 11], # g / 100g or 100ml saturated_fat => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # g / 100g - salt => [0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.2, 3.2, 3.4, 3.6, 3.8, 4] - , # g / 100g + salt => [0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.2, 3.4, 3.6, 3.8, 4], # g / 100g # for fats energy_from_saturated_fat => [120, 240, 360, 480, 600, 720, 840, 960, 1080, 1200], # g / 100g @@ -707,6 +706,8 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { $nutriscore_data_ref->{$nutrient . "_points"}++; } } + + $nutriscore_data_ref->{$nutrient . "_max"} = scalar @{$points_thresholds_2023{$nutrient_threshold_id}}; } # For red meat products, the number of maximum protein points is set at 2 points @@ -718,8 +719,23 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { $nutriscore_data_ref->{proteins_points_limited_reason} = "red_meat_product"; } + # Store the lists of negative and positive components retained for the Nutri-Score of the product + + $nutriscore_data_ref->{components} = { + negative => [], + positive => [], + }; + + # negative points + # We need to compute negative points first, as proteins may not be counted in the positive points + # depending on the total of negative points + + my $negative_components = [$energy, "sugars", $saturated_fat, "salt"]; + # Beverages with non-nutritive sweeteners have 4 extra negative points if ($nutriscore_data_ref->{is_beverage}) { + push @$negative_components, "non_nutritive_sweeteners"; + $nutriscore_data_ref->{"non_nutritive_sweeteners_max"} = 4; if ($nutriscore_data_ref->{with_non_nutritive_sweeteners}) { $nutriscore_data_ref->{"non_nutritive_sweeteners_points"} = 4; } @@ -728,21 +744,28 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { } } - # Negative points - - $nutriscore_data_ref->{negative_nutrients} - = [$energy, "sugars", $saturated_fat, "salt", "non_nutritive_sweeteners"]; $nutriscore_data_ref->{negative_points} = 0; - foreach my $nutrient (@{$nutriscore_data_ref->{negative_nutrients}}) { - $nutriscore_data_ref->{negative_points} += ($nutriscore_data_ref->{$nutrient . "_points"} || 0); + + foreach my $nutrient (@$negative_components) { + my $points = ($nutriscore_data_ref->{$nutrient . "_points"} || 0); + my $max = $nutriscore_data_ref->{$nutrient . "_max"}; + push @{$nutriscore_data_ref->{components}{negative}}, + { + id => $nutrient, + value => $nutriscore_data_ref->{$nutrient}, + points => $points, + max => $max, + }; + $nutriscore_data_ref->{negative_points} += $points; + $nutriscore_data_ref->{negative_max} += $max; } - # Positive points + # positive points $nutriscore_data_ref->{positive_points} = 0; $nutriscore_data_ref->{positive_nutrients} = ["fruits_vegetables_legumes", "fiber"]; - # Positive points for proteins are counted in the following 3 cases: + # positive points for proteins are counted in the following 3 cases: # - the product is a beverage # - the product is not in the fats, oils, nuts and seeds category # and the negative points are less than 11 or the product is a cheese @@ -784,7 +807,17 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { } foreach my $nutrient (@{$nutriscore_data_ref->{positive_nutrients}}) { - $nutriscore_data_ref->{positive_points} += ($nutriscore_data_ref->{$nutrient . "_points"} || 0); + my $points = ($nutriscore_data_ref->{$nutrient . "_points"} || 0); + my $max = $nutriscore_data_ref->{$nutrient . "_max"}; + push @{$nutriscore_data_ref->{components}{positive}}, + { + id => $nutrient, + value => $nutriscore_data_ref->{$nutrient}, + points => $points, + max => $max, + }; + $nutriscore_data_ref->{positive_points} += $points; + $nutriscore_data_ref->{positive_max} += $max; } my $score = $nutriscore_data_ref->{negative_points} - $nutriscore_data_ref->{positive_points}; diff --git a/scripts/gen_svg_images_for_points.pl b/scripts/gen_svg_images_for_points.pl new file mode 100755 index 0000000000000..9757e9beeb8d2 --- /dev/null +++ b/scripts/gen_svg_images_for_points.pl @@ -0,0 +1,124 @@ +#!/usr/bin/perl -w + +# This file is part of Product Opener. +# +# Product Opener +# Copyright (C) 2011-2023 Association Open Food Facts +# Contact: contact@openfoodfacts.org +# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France +# +# Product Opener is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +=head1 NAME + +gen_svg_images_for_points.pl - Generates SVG images for positive or negative points for Nutri-Score components + +=head1 DESCRIPTION + +Each image has a number of squares corresponding to the maximum number of points for the component. +The number of squares filled in green or red (for positive or negative points) corresponds to the number of points for the product. +The remaining squares are filled in grey. + +=cut + +use ProductOpener::PerlStandards; + +# Each square is 6x6 pixels, squares are separated by 1 pixel +# Squares are displayed in one or two rows, with at most 10 squares per row +# The rows are centered vertically in the image +# There is extra padding on top and bottom, so that the image is high enough + +sub generate_image ($dir, $type, $points, $max) { + + my $image = < + +SVG +; + my $x = 0; + my $y = 11; + # If there is only one row, center it vertically + if ($max <= 10) { + $y += 3; + } + my $row = 0; + + for (my $i = 0; $i < $max; $i++) { + + my $color = "#BDBDBD"; + if ($i < $points) { + if ($type eq "positive") { + $color = "#219653"; + } + elsif ($type eq "negative") { + $color = "#EB5757"; + } + } + + $image .= ""; + + $x += 7; + if ($x >= 69) { + $x = 0; + $y += 7; + $row++; + } + } + + $image .= ""; + + my $filename = "$dir/points-$type-$points-$max.svg"; + open(my $file, ">:encoding(UTF-8)", $filename); + print $file $image; + close($file); + + return; +} + +# Different maximum points used for Nutri-Score components +my @max_negative_points = (4, 10, 15, 20); +my @max_positive_points = (5, 6, 7,); + +# Usage: gen_svg_images_for_points.pl [path to directory to save the images] +my $dir = shift @ARGV; + +# Generate images for negative points +foreach my $max (@max_negative_points) { + for (my $points = 0; $points <= $max; $points++) { + generate_image($dir, "negative", $points, $max); + } +} + +# Generate images for positive points +foreach my $max (@max_positive_points) { + for (my $points = 0; $points <= $max; $points++) { + generate_image($dir, "positive", $points, $max); + } +} + +exit(0); diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json new file mode 100644 index 0000000000000..7db87f7e17d78 --- /dev/null +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json @@ -0,0 +1,93 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "title_element": { + "icon_url": "[% static_subdomain %]/images/attributes/dist/nutriscore-[% panel.nutriscore_grade %].svg", + [% IF panel.nutriscore_unknown_reason_short %] + "subtitle": "[% panel.nutriscore_unknown_reason_short %]", + [% END %] + "title": "[% panel.title %]", + "type": "grade", + "grade": "[% panel.nutriscore_grade %]", + }, + "elements": [ + // First display warnings + [% IF panel.nutriscore_warnings %] + [% FOREACH warning IN panel.nutriscore_warnings %] + { + "element_type": "text", + "text_element": { + "type": "warning", + "html": `[% warning %] + `, + } + }, + [% END %] + [% END %] + // Display actions if we are missing data to compute the Nutri-Score + [% IF panel.nutriscore_unknown_reason %] + { + "element_type": "action", + "action_element": { + "html": `[% lang("actions_to_compute_nutriscore") %]`, + "actions": [ + [% IF panel.nutriscore_unknown_reason == "missing_category" %] + "add_categories" + [% ELSIF panel.nutriscore_unknown_reason == "missing_nutrition_data" %] + "add_nutrition_facts" + [% ELSIF panel.nutriscore_unknown_reason == "missing_category_and_nutrition_data" %] + "add_categories", + "add_nutrition_facts" + [% END %] + ] + } + }, + [% END %] + { + "element_type": "panel_group", + "panel_group_element": { + "title": "[% lang('nutriscore_positive_points') %][% sep %]: [% product.nutriscore.2023.data.positive_points %]/[% product.nutriscore.2023.data.positive_max %]", + "evaluation": "good", + "icon_url": "[% static_subdomain %]/images/icons/dist/circle-plus.svg", + "icon_size": "small", + "icon_color_from_evaluation": true, + "panel_ids": [ + [% FOREACH component IN product.nutriscore.2023.data.components.positive %] + "nutriscore_component_[% component.id %]", + [% END %] + ], + }, + }, + { + "element_type": "panel_group", + "panel_group_element": { + "title": "[% lang('nutriscore_negative_points') %][% sep %]: [% product.nutriscore.2023.data.negative_points %]/[% product.nutriscore.2023.data.negative_max %]", + "evaluation": "bad", + "icon_url": "[% static_subdomain %]/images/icons/dist/circle-minus.svg", + "icon_size": "small", + "icon_color_from_evaluation": true, + "panel_ids": [ + [% FOREACH component IN product.nutriscore.2023.data.components.negative %] + "nutriscore_component_[% component.id %]", + [% END %] + ], + }, + }, + { + "element_type": "text", + "text_element": { + "html": `[% panel.nutriscore_details %]`, + } + }, + { + "element_type": "text", + "text_element": { + "html": ` +

[% lang('nutriscore_learn_more') %]

+` + }, + }, + ] +} diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json new file mode 100644 index 0000000000000..f6be10dc55187 --- /dev/null +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json @@ -0,0 +1,22 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "size": "small", + "title_element": { + "icon_url": "[% static_subdomain %]/images/attributes/dist/points-[% panel.type %]-[% panel.points %]-[% panel.max %].svg", + "title": "[% panel.id %]", + "subtitle": "[% panel.points %]/[% panel.max %] points [% lang("for") %] [% panel.value %]g", + }, + "elements": [ + + { + "element_type": "text", + "text_element": { + "html": `Some text about the component + `, + } + }, + ] +} diff --git a/templates/api/knowledge-panels/health/nutrition_panels.tt.json b/templates/api/knowledge-panels/health/nutrition_panels.tt.json index f625dd8c2bec9..cf8762f4f9570 100644 --- a/templates/api/knowledge-panels/health/nutrition_panels.tt.json +++ b/templates/api/knowledge-panels/health/nutrition_panels.tt.json @@ -11,6 +11,9 @@ [% IF panels.nutriscore.defined %] "nutriscore", [% END %] + [% IF panels.nutriscore_2023.defined %] + "nutriscore_2023", + [% END %] [% IF panels.nutrient_level_fat.defined %] "nutrient_level_fat", [% END %] diff --git a/templates/web/panels/panel.tt.html b/templates/web/panels/panel.tt.html index 0fa37eb53f8a5..10908a7e69010 100644 --- a/templates/web/panels/panel.tt.html +++ b/templates/web/panels/panel.tt.html @@ -33,7 +33,7 @@

[% panel.title_element.title %]

> [% IF panel.title_element.icon_url.defined %] [% IF panel.title_element.icon_alt.defined %][% panel.title_element.icon_alt %][% ELSE %]icon[% END %][% panel.title_element.title %] [% panel.title_element.title %] [% IF panel.title_element.subtitle.defined %] -
[% panel.title_element.subtitle %]
+ [% panel.title_element.subtitle %] [% END %]
@@ -106,8 +106,30 @@
[% panel.title_element.subtitle %]
[% END %] + [% IF panel_group_element.icon_url.defined %] + [% IF panel_group_element.icon_alt.defined %][% panel_group_element.icon_alt %][% ELSE %]icon[% END %] + [% END %] + [% IF panel_group_element.title.defined %] -

[% panel_group_element.title %]

+

[% panel_group_element.title %]

[% END %] [% FOREACH panel_id IN panel_group_element.panel_ids %] [% INCLUDE web/panels/panel.tt.html panel_id = panel_id %] From 01fe6f8eb393ea6234119bc6018f2577926a4605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 13:02:50 +0100 Subject: [PATCH 02/13] improved Nutri-Score and nutrient levels panels --- .../src/nutriscore-a-new-formula-en.svg | 142 ++++++ .../src/nutriscore-a-new-formula-fr.svg | 150 ++++++ .../src/nutriscore-b-new-formula-en.svg | 77 ++++ .../src/nutriscore-b-new-formula-fr.svg | 85 ++++ .../src/nutriscore-c-new-formula-en.svg | 213 +++++++++ .../src/nutriscore-c-new-formula-fr.svg | 221 +++++++++ .../src/nutriscore-d-new-formula-en.svg | 81 ++++ .../src/nutriscore-d-new-formula-fr.svg | 89 ++++ .../src/nutriscore-e-new-formula-en.svg | 279 ++++++++++++ .../src/nutriscore-e-new-formula-fr.svg | 287 ++++++++++++ ...triscore-not-applicable-new-formula-en.svg | 324 +++++++++++++ ...triscore-not-applicable-new-formula-fr.svg | 324 +++++++++++++ .../src/nutriscore-unknown-new-formula-en.svg | 325 +++++++++++++ .../src/nutriscore-unknown-new-formula-fr.svg | 325 +++++++++++++ icons/material/nutrition.svg | 1 + icons/nutrition.svg | 1 + lib/ProductOpener/Food.pm | 7 +- lib/ProductOpener/KnowledgePanels.pm | 25 +- lib/ProductOpener/Numbers.pm | 15 + lib/ProductOpener/Nutriscore.pm | 64 ++- po/common/common.pot | 146 ++++++ po/common/en.po | 141 ++++++ po/common/fr.po | 107 +++++ ...n_svg_images_for_nutriscore_new_formula.pl | 196 ++++++++ .../{ => images}/gen_svg_images_for_points.pl | 96 ++-- .../images/nutriscore-new-formula-source.svg | 212 +++++++++ .../health/nutriscore/nutriscore_2023.tt.json | 63 ++- .../nutriscore/nutriscore_component.tt.json | 24 +- .../nutriscore/nutriscore_description.tt.json | 38 ++ .../health/nutrition/nutrient_levels.tt.json | 36 ++ .../health/nutrition_panels.tt.json | 15 +- templates/web/panels/panel.tt.html | 2 +- .../get-existing-product.json | 84 +++- .../get-fields-all-knowledge-panels.json | 109 ++++- .../api_v2_product_read/get-fields-all.json | 84 +++- ...attribute-groups-all-knowledge-panels.json | 109 ++++- .../api_v2_product_read/get-fields-raw.json | 84 +++- .../get-knowledge-panels-fr.json | 25 +- .../get-knowledge-panels.json | 25 +- ...uct-ingredients-text-without-language.json | 83 ++-- .../get-existing-product-gs1-ai-data-str.json | 84 +++- .../get-existing-product-gs1-caret.json | 84 +++- .../get-existing-product-gs1-data-uri.json | 84 +++- .../get-existing-product-gs1-fnc1.json | 84 +++- .../get-existing-product-gs1-gs.json | 84 +++- .../get-existing-product.json | 84 +++- .../get-fields-all-knowledge-panels.json | 109 ++++- .../api_v3_product_read/get-fields-all.json | 84 +++- ...attribute-groups-all-knowledge-panels.json | 109 ++++- .../api_v3_product_read/get-fields-raw.json | 84 +++- .../get-knowledge-panels-fr.json | 25 +- .../get-knowledge-panels.json | 25 +- .../patch-request-fields-all.json | 2 +- ...ted-attribute-groups-knowledge-panels.json | 23 + .../products/3560070167470.json | 2 +- .../products/3560070815746.json | 2 +- .../products/3250390017165.json | 2 +- .../products/3250390020745.json | 2 +- .../products/3250390020806.json | 2 +- .../products/3250390020998.json | 2 +- .../products/3250390021001.json | 2 +- .../products/3250390021469.json | 2 +- .../products/3250390021544.json | 2 +- .../products/3250390021568.json | 2 +- .../products/3250390021926.json | 2 +- .../products/3250390024781.json | 2 +- .../products/3250390024804.json | 2 +- .../products/3250390024842.json | 2 +- .../products/3250390024866.json | 2 +- .../products/3250390025399.json | 2 +- .../products/3250390025863.json | 2 +- .../products/3250390026044.json | 2 +- .../products/3250390026648.json | 2 +- .../products/3250390026754.json | 2 +- .../test/products/3270190128403.json | 2 +- .../test/products/7270190128403.json | 2 +- .../data-quality.json | 27 +- .../no-data-quality.json | 23 + .../3003004006001.json | 2 +- .../3003004006002.json | 2 +- .../3003004006003.json | 2 +- .../3003004006004.json | 2 +- .../3003004006005.json | 2 +- .../3003004006006.json | 2 +- .../3003004006007.json | 2 +- .../import_csv_file/test/2003004006001.json | 2 +- .../import_csv_file/test/2003004006002.json | 2 +- .../import_csv_file/test/2003004006003.json | 2 +- .../import_csv_file/test/2003004006004.json | 2 +- .../import_csv_file/test/2003004006005.json | 2 +- .../import_csv_file/test/2003004006006.json | 2 +- .../import_csv_file/test/2003004006007.json | 2 +- .../search_v1/search-no-filter.json | 427 ++++++++++++------ ...ies-without-ingredients-from-palm-oil.json | 172 +++++-- ...rch-without-ingredients-from-palm-oil.json | 427 ++++++++++++------ .../attributes/en-attributes.json | 79 +++- .../en-ecoscore-score-at-20-threshold.json | 2 +- .../attributes/en-no-ingredients.json | 2 +- .../attributes/en-nutriscore.json | 79 +++- .../beverage-with-80-percent-milk.json | 92 +++- .../nutriscore/breakfast-cereals.json | 78 +++- .../cocoa-and-chocolate-powders.json | 83 +++- .../nutriscore/colza-oil.json | 86 ++-- .../nutriscore/cookies.json | 78 +++- .../dairy-drink-with-80-percent-milk.json | 92 +++- ...-drink-with-less-than-80-percent-milk.json | 92 +++- .../nutriscore/dairy-drinks-without-milk.json | 92 +++- .../en-apple-estimated-nutrients.json | 84 +++- .../nutriscore/en-avocado-oil.json | 96 ++-- .../nutriscore/en-beers-category.json | 2 +- .../nutriscore/en-cherry-tomatoes.json | 84 +++- .../nutriscore/en-milk.json | 91 +++- .../en-olive-oil-no-ingredients.json | 96 ++-- ...en-olive-oil-unrecognized-ingredients.json | 96 ++-- .../nutriscore/en-olive-oil.json | 96 ++-- ...orange-juice-category-and-ingredients.json | 92 +++- .../nutriscore/en-orange-juice-category.json | 92 +++- .../nutriscore/en-potatoes-category.json | 84 +++- ...ategory-ingredients-with-lots-of-meat.json | 84 +++- ...ous-category-ingredients-with-no-meat.json | 84 +++- ...ory-ingredients-with-very-little-meat.json | 84 +++- ...eat-ambiguous-category-no-ingredients.json | 83 +++- .../en-red-meat-category-no-ingredients.json | 83 +++- ...n-soy-beans-processed-and-unprocessed.json | 84 +++- .../en-sugar-estimated-nutrients.json | 79 +++- .../nutriscore/en-sweeteners-erythritol.json | 92 +++- .../nutriscore/en-sweeteners.json | 90 +++- .../nutriscore/en-tofu.json | 84 +++- .../nutriscore/en-vegetable-crisps.json | 84 +++- .../flavored-spring-water-no-nutrition.json | 2 +- .../flavored-spring-with-nutrition.json | 91 +++- .../nutriscore/fr-canned-green-beans.json | 84 +++- .../nutriscore/fr-canned-pineapple.json | 84 +++- .../nutriscore/fr-coconut-milk.json | 84 +++- .../nutriscore/fr-gaspacho.json | 84 +++- .../nutriscore/fr-green-beans-beverage.json | 84 +++- .../nutriscore/fr-ice-tea-with-sweetener.json | 90 +++- .../fr-mixed-oils-with-olive-oil.json | 87 ++-- .../nutriscore/fr-orange-nectar-0-fat.json | 93 ++-- .../fr-plant-beverages-soy-milk.json | 92 +++- .../nutriscore/fr-rapeseed-oil.json | 87 ++-- .../nutriscore/milk.json | 92 +++- .../nutriscore/mushrooms.json | 84 +++- .../nutriscore/olive-oil.json | 91 ++-- .../nutriscore/spring-water-no-nutrition.json | 86 +++- .../sunflower-oil-no-sugar-no-sat-fat.json | 4 +- .../nutriscore/sunflower-oil-no-sugar.json | 90 ++-- .../nutriscore/sunflower-oil.json | 90 ++-- .../nutriscore/walnut-oil.json | 90 ++-- 149 files changed, 9037 insertions(+), 2078 deletions(-) create mode 100644 html/images/attributes/src/nutriscore-a-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-a-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-b-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-b-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-c-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-c-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-d-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-d-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-e-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-e-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-not-applicable-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-not-applicable-new-formula-fr.svg create mode 100644 html/images/attributes/src/nutriscore-unknown-new-formula-en.svg create mode 100644 html/images/attributes/src/nutriscore-unknown-new-formula-fr.svg create mode 100644 icons/material/nutrition.svg create mode 120000 icons/nutrition.svg create mode 100755 scripts/images/gen_svg_images_for_nutriscore_new_formula.pl rename scripts/{ => images}/gen_svg_images_for_points.pl (66%) create mode 100644 scripts/images/nutriscore-new-formula-source.svg create mode 100644 templates/api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json create mode 100644 templates/api/knowledge-panels/health/nutrition/nutrient_levels.tt.json diff --git a/html/images/attributes/src/nutriscore-a-new-formula-en.svg b/html/images/attributes/src/nutriscore-a-new-formula-en.svg new file mode 100644 index 0000000000000..5b2d4cedb6d01 --- /dev/null +++ b/html/images/attributes/src/nutriscore-a-new-formula-en.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-a-new-formula-fr.svg b/html/images/attributes/src/nutriscore-a-new-formula-fr.svg new file mode 100644 index 0000000000000..98eadef0fd020 --- /dev/null +++ b/html/images/attributes/src/nutriscore-a-new-formula-fr.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-b-new-formula-en.svg b/html/images/attributes/src/nutriscore-b-new-formula-en.svg new file mode 100644 index 0000000000000..6c8e2ef18e4e1 --- /dev/null +++ b/html/images/attributes/src/nutriscore-b-new-formula-en.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-b-new-formula-fr.svg b/html/images/attributes/src/nutriscore-b-new-formula-fr.svg new file mode 100644 index 0000000000000..b69eecab2e61f --- /dev/null +++ b/html/images/attributes/src/nutriscore-b-new-formula-fr.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-c-new-formula-en.svg b/html/images/attributes/src/nutriscore-c-new-formula-en.svg new file mode 100644 index 0000000000000..70fbe53119490 --- /dev/null +++ b/html/images/attributes/src/nutriscore-c-new-formula-en.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-c-new-formula-fr.svg b/html/images/attributes/src/nutriscore-c-new-formula-fr.svg new file mode 100644 index 0000000000000..71587caf79964 --- /dev/null +++ b/html/images/attributes/src/nutriscore-c-new-formula-fr.svg @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-d-new-formula-en.svg b/html/images/attributes/src/nutriscore-d-new-formula-en.svg new file mode 100644 index 0000000000000..f5310bd9632f9 --- /dev/null +++ b/html/images/attributes/src/nutriscore-d-new-formula-en.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-d-new-formula-fr.svg b/html/images/attributes/src/nutriscore-d-new-formula-fr.svg new file mode 100644 index 0000000000000..cbf15b2395d7b --- /dev/null +++ b/html/images/attributes/src/nutriscore-d-new-formula-fr.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-e-new-formula-en.svg b/html/images/attributes/src/nutriscore-e-new-formula-en.svg new file mode 100644 index 0000000000000..e02b91a1e010a --- /dev/null +++ b/html/images/attributes/src/nutriscore-e-new-formula-en.svg @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-e-new-formula-fr.svg b/html/images/attributes/src/nutriscore-e-new-formula-fr.svg new file mode 100644 index 0000000000000..6d0dcc74a0024 --- /dev/null +++ b/html/images/attributes/src/nutriscore-e-new-formula-fr.svg @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-not-applicable-new-formula-en.svg b/html/images/attributes/src/nutriscore-not-applicable-new-formula-en.svg new file mode 100644 index 0000000000000..871c7e26a87c0 --- /dev/null +++ b/html/images/attributes/src/nutriscore-not-applicable-new-formula-en.svg @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-not-applicable-new-formula-fr.svg b/html/images/attributes/src/nutriscore-not-applicable-new-formula-fr.svg new file mode 100644 index 0000000000000..871c7e26a87c0 --- /dev/null +++ b/html/images/attributes/src/nutriscore-not-applicable-new-formula-fr.svg @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-unknown-new-formula-en.svg b/html/images/attributes/src/nutriscore-unknown-new-formula-en.svg new file mode 100644 index 0000000000000..4b8e472d650d3 --- /dev/null +++ b/html/images/attributes/src/nutriscore-unknown-new-formula-en.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/html/images/attributes/src/nutriscore-unknown-new-formula-fr.svg b/html/images/attributes/src/nutriscore-unknown-new-formula-fr.svg new file mode 100644 index 0000000000000..4b8e472d650d3 --- /dev/null +++ b/html/images/attributes/src/nutriscore-unknown-new-formula-fr.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/material/nutrition.svg b/icons/material/nutrition.svg new file mode 100644 index 0000000000000..4ef7d26172df9 --- /dev/null +++ b/icons/material/nutrition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/nutrition.svg b/icons/nutrition.svg new file mode 120000 index 0000000000000..25da3e06af0d7 --- /dev/null +++ b/icons/nutrition.svg @@ -0,0 +1 @@ +material/nutrition.svg \ No newline at end of file diff --git a/lib/ProductOpener/Food.pm b/lib/ProductOpener/Food.pm index f7e526be62c49..f399897e087b6 100644 --- a/lib/ProductOpener/Food.pm +++ b/lib/ProductOpener/Food.pm @@ -1581,7 +1581,9 @@ sub compute_nutriscore_data ($product_ref, $prepared, $nutriments_field, $versio } else { # fruits, vegetables, legumes - 2023 - my $fruits_vegetables_legumes = compute_nutriscore_2023_fruits_vegetables_legumes($product_ref, $prepared); + my $fruits_vegetables_legumes + = round_to_max_decimal_places(compute_nutriscore_2023_fruits_vegetables_legumes($product_ref, $prepared), + 1); my $is_fat_oil_nuts_seeds = is_fat_oil_nuts_seeds_for_nutrition_score($product_ref); my $is_beverage = is_beverage_for_nutrition_score_2023($product_ref); @@ -1610,7 +1612,8 @@ sub compute_nutriscore_data ($product_ref, $prepared, $nutriments_field, $versio if ($is_fat_oil_nuts_seeds) { # Add the fat and saturated fat / fat ratio $nutriscore_data_ref->{fat} = $nutriments_ref->{"fat" . $prepared . "_100g"}; - $nutriscore_data_ref->{saturated_fat_ratio} = saturated_fat_ratio($nutriments_ref, $prepared); + $nutriscore_data_ref->{saturated_fat_ratio} + = round_to_max_decimal_places(1, saturated_fat_ratio($nutriments_ref, $prepared)); # Compute the energy from saturates if (defined $nutriscore_data_ref->{saturated_fat}) { $nutriscore_data_ref->{energy_from_saturated_fat} = $nutriscore_data_ref->{saturated_fat} * 37; diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index aa93af2350cbb..17ef0e0e4fb41 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -357,7 +357,9 @@ sub create_panel_from_json_template ($panel_id, $panel_template, $panel_data_ref # Save the JSON file so that it can be more easily debugged, and that we can monitor issues my $target_dir = "$BASE_DIRS{PUBLIC_FILES}/debug/knowledge_panels/"; - my $target_file = "$target_dir/$panel_id." . $product_ref->{code} . ".json"; + my $filename = $panel_id . $product_ref->{code} . ".json"; + my $target_file = "$target_dir/" . $filename; + my $url = "/files/debug/knowledge_panels/" . $filename; ensure_dir_created_or_die($target_dir); open(my $out, ">:encoding(UTF-8)", $target_file) or die "cannot open $target_file"; print $out $panel_json; @@ -367,7 +369,7 @@ sub create_panel_from_json_template ($panel_id, $panel_template, $panel_data_ref "template" => $panel_template, "json_error" => $json_decode_error, "json" => $panel_json, - "json_debug_url" => $static_subdomain . $target_file + "json_debug_url" => $static_subdomain . $url }; } } @@ -896,12 +898,18 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options my $panel_data_ref = data_to_display_nutriscore($product_ref, $version); # Nutri-Score panel + my $grade = deep_get($product_ref, "nutriscore", $version, "grade"); - if ($panel_data_ref->{nutriscore_grade} eq "not-applicable") { + if ($grade eq "not-applicable") { $panel_data_ref->{title} = lang_in_other_lc($target_lc, "attribute_nutriscore_not_applicable_title"); } else { - $panel_data_ref->{title} = lang_in_other_lc($target_lc, + $panel_data_ref->{title} + = sprintf(lang_in_other_lc($target_lc, "attribute_nutriscore_grade_title"), uc($grade)); + if ($panel_data_ref->{nutriscore_unknown_reason_short}) { + $panel_data_ref->{subtitle} = $panel_data_ref->{nutriscore_unknown_reason_short}; + } + $panel_data_ref->{subtitle} = lang_in_other_lc($target_lc, "attribute_nutriscore_" . $panel_data_ref->{nutriscore_grade} . "_description_short"); } @@ -909,10 +917,12 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options foreach my $type (qw/positive negative/) { my $components_ref = deep_get($product_ref, "nutriscore", $version, "data", "components", $type) // []; foreach my $component_ref (@$components_ref) { + my $component_panel_data_ref = { "type" => $type, "id" => $component_ref->{id}, "value" => $component_ref->{value}, + "unit" => $component_ref->{unit}, "points" => $component_ref->{points}, "max" => $component_ref->{max}, }; @@ -927,6 +937,9 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options # Nutri-Score panel: score create_panel_from_json_template("nutriscore_2023", "api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json", $panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref); + create_panel_from_json_template("nutriscore_description", + "api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json", + $panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref); return; } @@ -967,6 +980,10 @@ sub create_nutrient_levels_panels ($product_ref, $target_lc, $target_cc, $option $nutrient_level_ref, $product_ref, $target_lc, $target_cc, $options_ref ); } + + create_panel_from_json_template("nutrient_levels", + "api/knowledge-panels/health/nutrition/nutrient_levels.tt.json", + {}, $product_ref, $target_lc, $target_cc, $options_ref); } return; } diff --git a/lib/ProductOpener/Numbers.pm b/lib/ProductOpener/Numbers.pm index c30d6ce211605..6ff18945256b9 100644 --- a/lib/ProductOpener/Numbers.pm +++ b/lib/ProductOpener/Numbers.pm @@ -41,6 +41,7 @@ BEGIN { &remove_insignificant_digits &convert_string_to_number $number_regexp + &round_to_max_decimal_places ); # symbols to export on request %EXPORT_TAGS = (all => [@EXPORT_OK]); @@ -153,5 +154,19 @@ sub convert_string_to_number ($value) { return $value; } +=head2 round_to_max_decimal_places($value, $max_decimal_places) + +Round a number to a maximum number of decimal places. + +=cut + +sub round_to_max_decimal_places ($value, $max_decimal_places) { + + # Round to the maximum number of decimal places + my $rounded_value = sprintf("%.${max_decimal_places}f", $value); + + return $rounded_value + 0; +} + 1; diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index c2092bd6b84d6..a9e3237b9df42 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -658,6 +658,37 @@ sub get_value_with_one_more_positive_point_2023 ($nutriscore_data_ref, $nutrient return $return_value; } +sub add_units_to_positive_and_negative_nutriscore_components ($nutriscore_data_ref) { + + foreach my $type (qw/positive negative/) { + my $components_ref = $nutriscore_data_ref->{components}{$type}; + + foreach my $component_ref (@$components_ref) { + # Compute the unit. + my $unit; + if ($component_ref->{id} eq 'non_nutritive_sweeteners') { + $unit = undef; + } + elsif (($component_ref->{id} eq 'fruits_vegetables_legumes') + or ($component_ref->{id} eq 'saturated_fat_ratio')) + { + $unit = '%'; + } + else { + if ($component_ref->{id} =~ /^energy/) { + $unit = 'kJ'; + } + else { + $unit = 'g'; + } + } + $component_ref->{unit} = $unit; + } + } + + return; +} + sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { # The values must be rounded with one more digit than the thresholds. @@ -735,12 +766,14 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { # Beverages with non-nutritive sweeteners have 4 extra negative points if ($nutriscore_data_ref->{is_beverage}) { push @$negative_components, "non_nutritive_sweeteners"; - $nutriscore_data_ref->{"non_nutritive_sweeteners_max"} = 4; + $nutriscore_data_ref->{non_nutritive_sweeteners_max} = 4; if ($nutriscore_data_ref->{with_non_nutritive_sweeteners}) { - $nutriscore_data_ref->{"non_nutritive_sweeteners_points"} = 4; + $nutriscore_data_ref->{non_nutritive_sweeteners_points} = 4; + $nutriscore_data_ref->{non_nutritive_sweeteners} = "presence"; } else { - $nutriscore_data_ref->{"non_nutritive_sweeteners_points"} = 0; + $nutriscore_data_ref->{non_nutritive_sweeteners_points} = 0; + $nutriscore_data_ref->{non_nutritive_sweeteners} = "absence"; } } @@ -763,7 +796,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { # positive points $nutriscore_data_ref->{positive_points} = 0; - $nutriscore_data_ref->{positive_nutrients} = ["fruits_vegetables_legumes", "fiber"]; + $nutriscore_data_ref->{positive_nutrients} = ["fiber", "fruits_vegetables_legumes"]; # positive points for proteins are counted in the following 3 cases: # - the product is a beverage @@ -788,7 +821,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { $nutriscore_data_ref->{count_proteins_reason} = "negative_points_less_than_7"; } else { - $nutriscore_data_ref->{count_proteins_reason} = "negative_points_more_than_7"; + $nutriscore_data_ref->{count_proteins_reason} = "negative_points_greater_than_or_equal_to_7"; } } else { @@ -797,13 +830,13 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { $nutriscore_data_ref->{count_proteins_reason} = "negative_points_less_than_11"; } else { - $nutriscore_data_ref->{count_proteins_reason} = "negative_points_more_than_11"; + $nutriscore_data_ref->{count_proteins_reason} = "negative_points_greater_than_or_equal_to_11"; } } } if ($nutriscore_data_ref->{count_proteins}) { - push @{$nutriscore_data_ref->{positive_nutrients}}, "proteins"; + unshift @{$nutriscore_data_ref->{positive_nutrients}}, "proteins"; } foreach my $nutrient (@{$nutriscore_data_ref->{positive_nutrients}}) { @@ -820,6 +853,23 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { $nutriscore_data_ref->{positive_max} += $max; } + # Add units for the retained positive and negative components + # We add the units directly in the data instead of computing them at runtime when needed + # in order to make the data more easily understood by itself + add_units_to_positive_and_negative_nutriscore_components($nutriscore_data_ref); + + # Delete input nutrient values, keep only values inside the retained positive and negative components + foreach my $key (keys %$nutriscore_data_ref) { + if ($key + =~ /^(energy|energy_from_saturated_fat|sugars|fat|saturated_fat|saturated_fat_ratio|salt|non_nutritive_sweeteners|fruits_vegetables_legumes|fiber|proteins)$/ + ) + { + delete $nutriscore_data_ref->{$key}; + delete $nutriscore_data_ref->{$key . "_points"}; + delete $nutriscore_data_ref->{$key . "_max"}; + } + } + my $score = $nutriscore_data_ref->{negative_points} - $nutriscore_data_ref->{positive_points}; return $score; diff --git a/po/common/common.pot b/po/common/common.pot index f254471e06e4b..ee666c709444e 100644 --- a/po/common/common.pot +++ b/po/common/common.pot @@ -6648,3 +6648,149 @@ msgstr "Weight per 100g of product" msgctxt "weight_percent" msgid "Weight percent" msgstr "Weight percent" + +msgctxt "nutriscore_component_energy" +msgid "Energy" +msgstr "" + +msgctxt "nutriscore_component_energy_from_saturated_fat" +msgid "Energy from saturated fat" +msgstr "" + +msgctxt "nutriscore_component_sugars" +msgid "Sugars" +msgstr "" + +msgctxt "nutriscore_component_saturated_fat" +msgid "Saturated fat" +msgstr "" + +msgctxt "nutriscore_component_saturated_fat_ratio" +msgid "Saturated fat / fat" +msgstr "" + +msgctxt "nutriscore_component_salt" +msgid "Salt" +msgstr "" + +msgctxt "nutriscore_component_non_nutritive_sweeteners" +msgid "Non-nutritive sweeteners" +msgstr "" + +msgctxt "nutriscore_component_fruits_vegetables_legumes" +msgid "Fruits, vegetables and legumes" +msgstr "" + +msgctxt "nutriscore_component_fiber" +msgid "Fiber" +msgstr "" + +msgctxt "nutriscore_component_proteins" +msgid "Proteins" +msgstr "" + +msgctxt "presence" +msgid "Presence" +msgstr "" + +msgctxt "absence" +msgid "Absence" +msgstr "" + +msgctxt "nutriscore_is_water" +msgid "This product is considered to be water for the calculation of the Nutri-Score." +msgstr "" + +msgctxt "nutriscore_is_fat_oil_nuts_seeds" +msgid "This product is considered to be fat, oil, nuts or seeds for the calculation of the Nutri-Score." +msgstr "" + +msgctxt "nutriscore_is_cheese" +msgid "This product is considered to be cheese for the calculation of the Nutri-Score." +msgstr "" + +msgctxt "nutriscore_is_red_meat_product" +msgid "This product is considered to be a red meat product for the calculation of the Nutri-Score." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_beverage" +msgid "Points for proteins are counted because the product is considered to be a beverage." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_cheese" +msgid "Points for proteins are counted because the product is considered to be cheese." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_7" +msgid "Points for proteins are counted because the negative points are less than 7." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_11" +msgid "Points for proteins are counted because the negative points are less than 11." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_7" +msgid "Points for proteins are not counted because the negative points greater than or equal to 7." +msgstr "" + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_11" +msgid "Points for proteins are not counted because the negative points greater than or equal to 11." +msgstr "" + +msgctxt "nutriscore_explanation_what_it_is" +msgid "The Nutri-Score is a logo on the overall nutritional quality of products." +msgstr "The Nutri-Score is a logo on the overall nutritional quality of products." + +msgctxt "nutriscore_explanation_what_it_takes_into_account" +msgid "The score from A to E is calculated based on nutrients and foods to favor (proteins, fiber, fruits, vegetables and legumes ...) and nutrients to limit (calories, saturated fat, sugars, salt)." +msgstr "The score from A to E is calculated based on nutrients and foods to favor (proteins, fiber, fruits, vegetables and legumes ...) and nutrients to limit (calories, saturated fat, sugars, salt)." + +msgctxt "nutriscore_explanation_where_the_data_comes_from" +msgid "The score is calculated from the data of the nutrition facts table and the composition data (fruits, vegetables and legumes)." +msgstr "The score is calculated from the data of the nutrition facts table and the composition data (fruits, vegetables and legumes)." + +msgctxt "nutriscore_explanation_recommended_by_public_health_authorities" +msgid "The display of this logo is recommended by public health authorities without obligation for companies." +msgstr "The display of this logo is recommended by public health authorities without obligation for companies." + +msgctxt "nutriscore_explanation_title" +msgid "What is the Nutri-Score?" +msgstr "" + +# For benefits and risks of Nutri-Score components, see the "rationale" sections in the different Nutri-Score algorithms documents + +msgctxt "nutrient_info_energy_risk" +msgid "Energy intakes above energy requirements are associated with increased risks of weight gain, overweight, obesity, and consequently risk of diet-related chronic diseases." +msgstr "Energy intakes above energy requirements are associated with increased risks of weight gain, overweight, obesity, and consequently risk of diet-related chronic diseases." + +msgctxt "nutrient_info_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_info_saturated_fat_ratio_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_info_energy_from_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +# https://www.who.int/news/item/15-05-2023-who-advises-not-to-use-non-sugar-sweeteners-for-weight-control-in-newly-released-guideline + +msgctxt "nutrient_info_non_nutritive_sweeteners_risk" +msgid "Non-nutritive sweeteners may not confer any long-term benefit in reducing body fat in adults or children. There may be potential undesirable effects from long-term use of non-nutritive sweeteners, such as an increased risk of type 2 diabetes and cardiovascular diseases in adults." +msgstr "Non-nutritive sweeteners may not confer any long-term benefit in reducing body fat in adults or children. There may be potential undesirable effects from long-term use of non-nutritive sweeteners, such as an increased risk of type 2 diabetes and cardiovascular diseases in adults." + +msgctxt "nutrient_info_fiber_benefit" +msgid "Consuming foods rich in fiber (especially whole grain foods) reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." +msgstr "Consuming foods rich in fiber (especially whole grain foods) reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." + +msgctxt "nutrient_info_fruits_vegetables_legumes_benefit" +msgid "Consuming foods rich in fruits, vegetables and legumes reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." +msgstr "Consuming foods rich in fruits, vegetables and legumes reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." + +# Proteins are included in the Nutri-Score because they are a proxy for calcium and iron (there is no added benefit from consuming more proteins) + +msgctxt "nutrient_info_proteins_benefit" +msgid "Foods that are rich in proteins are usually rich in calcium or iron which are essential minerals with numerous health benefits." +msgstr "Foods that are rich in proteins are usually rich in calcium or iron which are essential minerals with numerous health benefits." \ No newline at end of file diff --git a/po/common/en.po b/po/common/en.po index b9388062752a2..aa1db0b69ad57 100644 --- a/po/common/en.po +++ b/po/common/en.po @@ -6673,3 +6673,144 @@ msgctxt "weight_percent" msgid "Weight percent" msgstr "Weight percent" +msgctxt "nutriscore_component_energy" +msgid "Energy" +msgstr "Energy" + +msgctxt "nutriscore_component_energy_from_saturated_fat" +msgid "Energy from saturated fat" +msgstr "Energy from saturated fat" + +msgctxt "nutriscore_component_sugars" +msgid "Sugars" +msgstr "Sugars" + +msgctxt "nutriscore_component_saturated_fat" +msgid "Saturated fat" +msgstr "Saturated fat" + +msgctxt "nutriscore_component_saturated_fat_ratio" +msgid "Saturated fat / fat" +msgstr "Saturated fat / fat" + +msgctxt "nutriscore_component_salt" +msgid "Salt" +msgstr "Salt" + +msgctxt "nutriscore_component_non_nutritive_sweeteners" +msgid "Non-nutritive sweeteners" +msgstr "Non-nutritive sweeteners" + +msgctxt "nutriscore_component_fruits_vegetables_legumes" +msgid "Fruits, vegetables and legumes" +msgstr "Fruits, vegetables and legumes" + +msgctxt "nutriscore_component_fiber" +msgid "Fiber" +msgstr "Fiber" + +msgctxt "nutriscore_component_proteins" +msgid "Proteins" +msgstr "Proteins" + +msgctxt "presence" +msgid "Presence" +msgstr "Presence" + +msgctxt "absence" +msgid "Absence" +msgstr "Absence" + +msgctxt "nutriscore_is_water" +msgid "This product is considered to be water for the calculation of the Nutri-Score." +msgstr "This product is considered to be water for the calculation of the Nutri-Score." + +msgctxt "nutriscore_is_fat_oil_nuts_seeds" +msgid "This product is considered to be fat, oil, nuts or seeds for the calculation of the Nutri-Score." +msgstr "This product is considered to be fat, oil, nuts or seeds for the calculation of the Nutri-Score." + +msgctxt "nutriscore_is_cheese" +msgid "This product is considered to be cheese for the calculation of the Nutri-Score." +msgstr "This product is considered to be cheese for the calculation of the Nutri-Score." + +msgctxt "nutriscore_is_red_meat_product" +msgid "This product is considered to be a red meat product for the calculation of the Nutri-Score." +msgstr "This product is considered to be a red meat product for the calculation of the Nutri-Score." + +msgctxt "nutriscore_count_proteins_reason_beverage" +msgid "Points for proteins are counted because the product is considered to be a beverage." +msgstr "Points for proteins are counted because the product is considered to be a beverage." + +msgctxt "nutriscore_count_proteins_reason_cheese" +msgid "Points for proteins are counted because the product is considered to be cheese." +msgstr "Points for proteins are counted because the product is considered to be cheese." + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_7" +msgid "Points for proteins are counted because the negative points are less than 7." +msgstr "Points for proteins are counted because the negative points are less than 7." + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_11" +msgid "Points for proteins are counted because the negative points are less than 11." +msgstr "Points for proteins are counted because the negative points are less than 11." + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_7" +msgid "Points for proteins are not counted because the negative points greater than or equal to 7." +msgstr "Points for proteins are not counted because the negative points greater than or equal to 7." + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_11" +msgid "Points for proteins are not counted because the negative points greater than or equal to 11." +msgstr "Points for proteins are not counted because the negative points greater than or equal to 11." + +msgctxt "nutriscore_explanation_what_it_is" +msgid "The Nutri-Score is a logo on the overall nutritional quality of products." +msgstr "The Nutri-Score is a logo on the overall nutritional quality of products." + +msgctxt "nutriscore_explanation_what_it_takes_into_account" +msgid "The score from A to E is calculated based on nutrients and foods to favor (proteins, fiber, fruits, vegetables and legumes ...) and nutrients to limit (calories, saturated fat, sugars, salt)." +msgstr "The score from A to E is calculated based on nutrients and foods to favor (proteins, fiber, fruits, vegetables and legumes ...) and nutrients to limit (calories, saturated fat, sugars, salt)." + +msgctxt "nutriscore_explanation_where_the_data_comes_from" +msgid "The score is calculated from the data of the nutrition facts table and the composition data (fruits, vegetables and legumes)." +msgstr "The score is calculated from the data of the nutrition facts table and the composition data (fruits, vegetables and legumes)." + +msgctxt "nutriscore_explanation_recommended_by_public_health_authorities" +msgid "The display of this logo is recommended by public health authorities without obligation for companies." +msgstr "The display of this logo is recommended by public health authorities without obligation for companies." + +msgctxt "nutriscore_explanation_title" +msgid "What is the Nutri-Score?" +msgstr "What is the Nutri-Score?" + +msgctxt "nutrient_info_energy_risk" +msgid "Energy intakes above energy requirements are associated with increased risks of weight gain, overweight, obesity, and consequently risk of diet-related chronic diseases." +msgstr "Energy intakes above energy requirements are associated with increased risks of weight gain, overweight, obesity, and consequently risk of diet-related chronic diseases." + +msgctxt "nutrient_info_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_info_saturated_fat_ratio_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_info_energy_from_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +# https://www.who.int/news/item/15-05-2023-who-advises-not-to-use-non-sugar-sweeteners-for-weight-control-in-newly-released-guideline + +msgctxt "nutrient_info_non_nutritive_sweeteners_risk" +msgid "Non-nutritive sweeteners may not confer any long-term benefit in reducing body fat in adults or children. There may be potential undesirable effects from long-term use of non-nutritive sweeteners, such as an increased risk of type 2 diabetes and cardiovascular diseases in adults." +msgstr "Non-nutritive sweeteners may not confer any long-term benefit in reducing body fat in adults or children. There may be potential undesirable effects from long-term use of non-nutritive sweeteners, such as an increased risk of type 2 diabetes and cardiovascular diseases in adults." + +msgctxt "nutrient_info_fiber_benefit" +msgid "Consuming foods rich in fiber (especially whole grain foods) reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." +msgstr "Consuming foods rich in fiber (especially whole grain foods) reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." + +msgctxt "nutrient_info_fruits_vegetables_legumes_benefit" +msgid "Consuming foods rich in fruits, vegetables and legumes reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." +msgstr "Consuming foods rich in fruits, vegetables and legumes reduces the risks of aerodigestive cancers, cardiovascular diseases, obesity and diabetes." + +msgctxt "nutrient_info_proteins_benefit" +msgid "Foods that are rich in proteins are usually rich in calcium or iron which are essential minerals with numerous health benefits." +msgstr "Foods that are rich in proteins are usually rich in calcium or iron which are essential minerals with numerous health benefits." diff --git a/po/common/fr.po b/po/common/fr.po index 63b304064ab6f..a9b5731c915ab 100644 --- a/po/common/fr.po +++ b/po/common/fr.po @@ -6671,3 +6671,110 @@ msgctxt "weight_percent" msgid "Weight percent" msgstr "Pourcentage du poids" +msgctxt "nutriscore_component_energy" +msgid "Energy" +msgstr "Energie" + +msgctxt "nutriscore_component_energy_from_saturated_fat" +msgid "Energy from saturated fat" +msgstr "Energie provenant des graisses saturées" + +msgctxt "nutriscore_component_sugars" +msgid "Sugars" +msgstr "Sucres" + +msgctxt "nutriscore_component_saturated_fat" +msgid "Saturated fat" +msgstr "Matières grasses saturées" + +msgctxt "nutriscore_component_saturated_fat_ratio" +msgid "Saturated fat / fat" +msgstr "Matières grasses saturées / matières grasses" + +msgctxt "nutriscore_component_salt" +msgid "Salt" +msgstr "Sel" + +msgctxt "nutriscore_component_non_nutritive_sweeteners" +msgid "Non-nutritive sweeteners" +msgstr "Edulcorants non-nutritifs" + +msgctxt "nutriscore_component_fruits_vegetables_legumes" +msgid "Fruits, vegetables and legumes" +msgstr "Fruits, légumes et légumineuses" + +msgctxt "nutriscore_component_fiber" +msgid "Fiber" +msgstr "Fibre" + +msgctxt "nutriscore_component_proteins" +msgid "Proteins" +msgstr "Protéines" + +msgctxt "presence" +msgid "Presence" +msgstr "Présence" + +msgctxt "absence" +msgid "Absence" +msgstr "Absence" + +msgctxt "nutriscore_is_water" +msgid "This product is considered to be water for the calculation of the Nutri-Score." +msgstr "Ce produit est considéré comme étant de l'eau pour le calcul du Nutri-Score." + +msgctxt "nutriscore_is_fat_oil_nuts_seeds" +msgid "This product is considered to be fat, oil, nuts or seeds for the calculation of the Nutri-Score." +msgstr "Ce produit est considéré comme étant une matière grasse, de l'huile, des noix ou des graines pour le calcul du Nutri-Score." + +msgctxt "nutriscore_is_cheese" +msgid "This product is considered to be cheese for the calculation of the Nutri-Score." +msgstr "Ce produit est considéré comme étant du fromage pour le calcul du Nutri-Score." + +msgctxt "nutriscore_is_red_meat_product" +msgid "This product is considered to be a red meat product for the calculation of the Nutri-Score." +msgstr "Ce produit est considéré comme étant un produit à base de viande rouge pour le calcul du Nutri-Score." + +msgctxt "nutriscore_count_proteins_reason_beverage" +msgid "Points for proteins are counted because the product is considered to be a beverage." +msgstr "Les points pour les protéines sont comptés car le produit est considéré comme étant une boisson." + +msgctxt "nutriscore_count_proteins_reason_cheese" +msgid "Points for proteins are counted because the product is considered to be cheese." +msgstr "Les points pour les protéines sont comptés car le produit est considéré comme étant du fromage." + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_7" +msgid "Points for proteins are counted because the negative points are less than 7." +msgstr "Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 7." + +msgctxt "nutriscore_count_proteins_reason_negative_points_less_than_11" +msgid "Points for proteins are counted because the negative points are less than 11." +msgstr "Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 11." + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_7" +msgid "Points for proteins are not counted because the negative points greater than or equal to 7." +msgstr "Les points pour les protéines ne sont pas comptés car les points négatifs sont supérieurs ou égaux à 7." + +msgctxt "nutriscore_count_proteins_reason_negative_points_greater_than_or_equal_to_11" +msgid "Points for proteins are not counted because the negative points greater than or equal to 11." +msgstr "Les points pour les protéines ne sont pas comptés car les points négatifs sont supérieurs ou égaux à 11." + +msgctxt "nutriscore_explanation_what_it_is" +msgid "The Nutri-Score is a logo on the overall nutritional quality of products." +msgstr "Le Nutri-Score est un logo sur la qualité nutritionnelle globale des produits." + +msgctxt "nutriscore_explanation_what_it_takes_into_account" +msgid "The score from A to E is calculated based on nutrients and foods to favor (proteins, fiber, fruits, vegetables and legumes ...) and nutrients to limit (calories, saturated fat, sugars, salt)." +msgstr "Le score de A à E est calculé en fonction des nutriments et aliments à favoriser (protéines, fibres, fruits et légumes, légumes secs…) et des nutriments à limiter (calories, matières grasses saturées, sucres, sel)." + +msgctxt "nutriscore_explanation_where_the_data_comes_from" +msgid "The score is calculated from the data of the nutrition facts table and the composition data (fruits, vegetables and legumes)." +msgstr "Le score est calculé à partir des données du tableau de la déclaration nutritionnelle et des données de composition (fruits, légumes et légumes secs)." + +msgctxt "nutriscore_explanation_recommended_by_public_health_authorities" +msgid "The display of this logo is recommended by public health authorities without obligation for companies." +msgstr "L'affichage de ce logo est recommandé par les pouvoirs publics sans obligation pour les entreprises." + +msgctxt "nutriscore_explanation_title" +msgid "What is the Nutri-Score?" +msgstr "Qu'est ce que le Nutri-Score ?" diff --git a/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl new file mode 100755 index 0000000000000..125abd6cd0d7e --- /dev/null +++ b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl @@ -0,0 +1,196 @@ +#!/usr/bin/perl -w + +# This file is part of Product Opener. +# +# Product Opener +# Copyright (C) 2011-2024 Association Open Food Facts +# Contact: contact@openfoodfacts.org +# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France +# +# Product Opener is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +=head1 NAME + +gen_svg_images_for_nutriscore_new_formula.pl - Add a "New formula" banner to Nutri-Score logos. + +=head1 DESCRIPTION + + + +=cut + +use ProductOpener::PerlStandards; +use ProductOpener::Config qw/:all/; + +# We will add a white rectangle below the Nutri-Score logo, and a blue banner with the "New formula" text +# We can have a different text for several languages + +my $new_formula_below = < +SVG +; + +my $new_formula_banner = < +SVG +; + +my %new_formula_text = ( + en => < + +SVG +, + fr => < +SVG +, +); + + +# Read the Nutri-Score SVG images in the html/images/attributes/src directory +# and add a "New formula" banner to the Nutri-Score logos. + +my $dir = "$www_root/images/attributes/src"; + +my @files = <$dir/nutriscore-*.svg>; + +foreach my $lc ("en", "fr") { + + foreach my $file (@files) { + + # skip the Nutri-Score logo with the new formula banner + next if ($file =~ /new-formula/); + + my $new_file = $file; + $new_file =~ s/\.svg$/-new-formula-$lc.svg/; + + open (my $fh, "<", $file) or die "Could not open file $file: $!\n"; + open (my $fh2, ">", $new_file) or die "Could not open file $new_file: $!\n"; + + while (my $line = <$fh>) { + + if ($line =~ / + $line =~ s/height="130"/height="162"/; + $line =~ s/viewBox="0 0 240 130"/viewBox="0 0 240 162"/; + print $fh2 $line; + print $fh2 $new_formula_below; + } + elsif ($line =~ /<\/svg>/) { + # No banner for not-applicable / unknown + if ($file !~ /unknown|not-applicable/) { + print $fh2 $new_formula_banner; + print $fh2 $new_formula_text{$lc}; + } + print $fh2 $line; + } + else { + print $fh2 $line; + } + } + + close $fh; + close $fh2; + } +} + +exit(0); \ No newline at end of file diff --git a/scripts/gen_svg_images_for_points.pl b/scripts/images/gen_svg_images_for_points.pl similarity index 66% rename from scripts/gen_svg_images_for_points.pl rename to scripts/images/gen_svg_images_for_points.pl index 9757e9beeb8d2..c00dd4dadfceb 100755 --- a/scripts/gen_svg_images_for_points.pl +++ b/scripts/images/gen_svg_images_for_points.pl @@ -3,7 +3,7 @@ # This file is part of Product Opener. # # Product Opener -# Copyright (C) 2011-2023 Association Open Food Facts +# Copyright (C) 2011-2024 Association Open Food Facts # Contact: contact@openfoodfacts.org # Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France # @@ -40,8 +40,8 @@ =head1 DESCRIPTION # There is extra padding on top and bottom, so that the image is high enough sub generate_image ($dir, $type, $points, $max) { - - my $image = < SVG -; - my $x = 0; - my $y = 11; - # If there is only one row, center it vertically - if ($max <= 10) { - $y += 3; - } - my $row = 0; - - for (my $i = 0; $i < $max; $i++) { - - my $color = "#BDBDBD"; - if ($i < $points) { - if ($type eq "positive") { - $color = "#219653"; - } - elsif ($type eq "negative") { - $color = "#EB5757"; - } - } - - $image .= ""; - - $x += 7; - if ($x >= 69) { - $x = 0; - $y += 7; - $row++; - } - } - - $image .= ""; - - my $filename = "$dir/points-$type-$points-$max.svg"; - open(my $file, ">:encoding(UTF-8)", $filename); - print $file $image; - close($file); - - return; + ; + my $x = 0; + my $y = 11; + # If there is only one row, center it vertically + if ($max <= 10) { + $y += 3; + } + my $row = 0; + + for (my $i = 0; $i < $max; $i++) { + + my $color = "#BDBDBD"; + if ($i < $points) { + if ($type eq "positive") { + $color = "#219653"; + } + elsif ($type eq "negative") { + $color = "#EB5757"; + } + } + + $image .= ""; + + $x += 7; + if ($x >= 69) { + $x = 0; + $y += 7; + $row++; + } + } + + $image .= ""; + + my $filename = "$dir/points-$type-$points-$max.svg"; + open(my $file, ">:encoding(UTF-8)", $filename); + print $file $image; + close($file); + + return; } # Different maximum points used for Nutri-Score components @@ -109,16 +109,16 @@ ($dir, $type, $points, $max) # Generate images for negative points foreach my $max (@max_negative_points) { - for (my $points = 0; $points <= $max; $points++) { - generate_image($dir, "negative", $points, $max); - } + for (my $points = 0; $points <= $max; $points++) { + generate_image($dir, "negative", $points, $max); + } } # Generate images for positive points foreach my $max (@max_positive_points) { - for (my $points = 0; $points <= $max; $points++) { - generate_image($dir, "positive", $points, $max); - } + for (my $points = 0; $points <= $max; $points++) { + generate_image($dir, "positive", $points, $max); + } } exit(0); diff --git a/scripts/images/nutriscore-new-formula-source.svg b/scripts/images/nutriscore-new-formula-source.svg new file mode 100644 index 0000000000000..6e8013a614a09 --- /dev/null +++ b/scripts/images/nutriscore-new-formula-source.svg @@ -0,0 +1,212 @@ + +NEW FORMULA diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json index 7db87f7e17d78..ce640f0e47090 100644 --- a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json @@ -4,16 +4,21 @@ "health" ], "title_element": { - "icon_url": "[% static_subdomain %]/images/attributes/dist/nutriscore-[% panel.nutriscore_grade %].svg", - [% IF panel.nutriscore_unknown_reason_short %] - "subtitle": "[% panel.nutriscore_unknown_reason_short %]", - [% END %] + "icon_url": "[% static_subdomain %]/images/attributes/dist/nutriscore-[% panel.nutriscore_grade %]-new-formula-[% IF lc == "fr" %][% lc %][% ELSE %]en[% END %].svg", "title": "[% panel.title %]", + "subtitle": "[% panel.subtitle %]", "type": "grade", "grade": "[% panel.nutriscore_grade %]", }, "elements": [ - // First display warnings + // Explanation of Nutri-Score + { + "element_type": "panel", + "panel_element": { + "panel_id": "nutriscore_description", + }, + }, + // Display warnings [% IF panel.nutriscore_warnings %] [% FOREACH warning IN panel.nutriscore_warnings %] { @@ -45,40 +50,66 @@ } }, [% END %] + // Start with negative points first, as the positive points depend on negative points { "element_type": "panel_group", "panel_group_element": { - "title": "[% lang('nutriscore_positive_points') %][% sep %]: [% product.nutriscore.2023.data.positive_points %]/[% product.nutriscore.2023.data.positive_max %]", - "evaluation": "good", - "icon_url": "[% static_subdomain %]/images/icons/dist/circle-plus.svg", + "title": "[% lang('nutriscore_negative_points') %][% sep %]: [% product.nutriscore.2023.data.negative_points %]/[% product.nutriscore.2023.data.negative_max %]", + "evaluation": "bad", + "icon_url": "[% static_subdomain %]/images/icons/dist/circle-minus.svg", "icon_size": "small", "icon_color_from_evaluation": true, "panel_ids": [ - [% FOREACH component IN product.nutriscore.2023.data.components.positive %] + [% FOREACH component IN product.nutriscore.2023.data.components.negative %] "nutriscore_component_[% component.id %]", [% END %] ], }, - }, + }, { "element_type": "panel_group", "panel_group_element": { - "title": "[% lang('nutriscore_negative_points') %][% sep %]: [% product.nutriscore.2023.data.negative_points %]/[% product.nutriscore.2023.data.negative_max %]", - "evaluation": "bad", - "icon_url": "[% static_subdomain %]/images/icons/dist/circle-minus.svg", + "title": "[% lang('nutriscore_positive_points') %][% sep %]: [% product.nutriscore.2023.data.positive_points %]/[% product.nutriscore.2023.data.positive_max %]", + "evaluation": "good", + "icon_url": "[% static_subdomain %]/images/icons/dist/circle-plus.svg", "icon_size": "small", "icon_color_from_evaluation": true, "panel_ids": [ - [% FOREACH component IN product.nutriscore.2023.data.components.negative %] + [% FOREACH component IN product.nutriscore.2023.data.components.positive %] "nutriscore_component_[% component.id %]", [% END %] ], }, - }, + }, { "element_type": "text", "text_element": { - "html": `[% panel.nutriscore_details %]`, + "html": ` +[% IF product.nutriscore.2023.data.is_beverage %] +

[% lang('nutriscore_is_beverage') %]

+[% ELSE %] +

[% lang('nutriscore_is_not_beverage') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_water %] +

[% lang('nutriscore_is_water') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_fat_oil_nuts_seeds %] +

[% lang('nutriscore_is_fat_oil_nuts_seeds') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_cheese %] +

[% lang('nutriscore_is_cheese') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_red_meat_product %] +

[% lang('nutriscore_is_red_meat_product') %]

+[% END %] +

[% lang("nutriscore_count_proteins_reason_" _ product.nutriscore.2023.data.count_proteins_reason )%]

+ +

+ [% lang('nutriscore_score') %][% sep %]: [% product.nutriscore.2023.score %] + ([% product.nutriscore.2023.data.negative_points %] - [% product.nutriscore.2023.data.positive_points %]) +

+

[% lang('nutriscore_grade') %][% sep %]: [% product.nutriscore.2023.grade FILTER ucfirst %]

+ `, } }, { diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json index f6be10dc55187..15aa538e2a837 100644 --- a/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json @@ -6,17 +6,21 @@ "size": "small", "title_element": { "icon_url": "[% static_subdomain %]/images/attributes/dist/points-[% panel.type %]-[% panel.points %]-[% panel.max %].svg", - "title": "[% panel.id %]", - "subtitle": "[% panel.points %]/[% panel.max %] points [% lang("for") %] [% panel.value %]g", + "title": "[% lang("nutriscore_component_" _ panel.id) %]", + "subtitle": "[% panel.points %]/[% panel.max %] points ([% panel.value %][% panel.unit %])", }, "elements": [ - - { - "element_type": "text", - "text_element": { - "html": `Some text about the component - `, - } - }, + + { + "element_type": "text", + "text_element": { + "html": ` +

+ [% lang("nutrient_info_" _ panel.id _ "_benefit") %] + [% lang("nutrient_info_" _ panel.id _ "_risk") %] +

+ `, + } + }, ] } diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json new file mode 100644 index 0000000000000..3026a3c066a61 --- /dev/null +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json @@ -0,0 +1,38 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "title_element": { + "icon_url": "[% static_subdomain %]/images/icons/dist/info.svg", + "icon_size": "small", + "title": "[% lang("nutriscore_explanation_title") %]", + "type": "info", + }, + "elements": [ + // Explanation of Nutri-Score + { + "element_type": "text", + "text_element": { + "type": "info", + "html": `

[% lang("nutriscore_explanation_what_it_is") %]

+

+[% lang("nutriscore_explanation_what_it_takes_into_account") %] +[% lang("nutriscore_explanation_where_the_data_comes_from") %] +

+[% IF cc == 'be' || cc == 'es' || cc == 'ch' || cc == 'de' || cc == 'fr' || cc == 'nl' || cc == 'lu' %] +

[% lang("nutriscore_explanation_recommended_by_public_health_authorities") %]

+[% END %] + `, + } + }, + { + "element_type": "text", + "text_element": { + "html": ` +

[% lang('nutriscore_learn_more') %]

+` + }, + }, + ] +} diff --git a/templates/api/knowledge-panels/health/nutrition/nutrient_levels.tt.json b/templates/api/knowledge-panels/health/nutrition/nutrient_levels.tt.json new file mode 100644 index 0000000000000..37973a3e573b4 --- /dev/null +++ b/templates/api/knowledge-panels/health/nutrition/nutrient_levels.tt.json @@ -0,0 +1,36 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "expanded": false, + "expand_for": "large", + "evaluation": "unknown", + "title_element": { + "icon_url": "[% static_subdomain %]/images/icons/dist/nutrition.svg", + "title": "[% lang('nutrient_levels_p') FILTER ucfirst %]", + "icon_color_from_evaluation": true, + }, + "elements": [ + { + "element_type": "panel_group", + "panel_group_element": { + "panel_group_id": "nutrient_levels_group", + "panel_ids": [ + [% IF panels.nutrient_level_fat.defined %] + "nutrient_level_fat", + [% END %] + [% IF panels.${'nutrient_level_saturated-fat'}.defined %] + "nutrient_level_saturated-fat", + [% END %] + [% IF panels.nutrient_level_sugars.defined %] + "nutrient_level_sugars", + [% END %] + [% IF panels.nutrient_level_salt.defined %] + "nutrient_level_salt", + [% END %] + ] + } + } + ] +} \ No newline at end of file diff --git a/templates/api/knowledge-panels/health/nutrition_panels.tt.json b/templates/api/knowledge-panels/health/nutrition_panels.tt.json index cf8762f4f9570..d095eabe127b8 100644 --- a/templates/api/knowledge-panels/health/nutrition_panels.tt.json +++ b/templates/api/knowledge-panels/health/nutrition_panels.tt.json @@ -14,18 +14,9 @@ [% IF panels.nutriscore_2023.defined %] "nutriscore_2023", [% END %] - [% IF panels.nutrient_level_fat.defined %] - "nutrient_level_fat", - [% END %] - [% IF panels.${'nutrient_level_saturated-fat'}.defined %] - "nutrient_level_saturated-fat", - [% END %] - [% IF panels.nutrient_level_sugars.defined %] - "nutrient_level_sugars", - [% END %] - [% IF panels.nutrient_level_salt.defined %] - "nutrient_level_salt", - [% END %] + [% IF panels.nutrient_level_fat.defined || panels.${'nutrient_level_saturated-fat'}.defined || panels.nutrient_level_sugars.defined || panels.nutrient_level_salt.defined %] + "nutrient_levels", + [% END %] ], }, }, diff --git a/templates/web/panels/panel.tt.html b/templates/web/panels/panel.tt.html index 10908a7e69010..a12c7176248a8 100644 --- a/templates/web/panels/panel.tt.html +++ b/templates/web/panels/panel.tt.html @@ -74,7 +74,7 @@

[% panel.title_element.title %]

[% panel.title_element.title %] [% IF panel.title_element.subtitle.defined %] - [% panel.title_element.subtitle %] + [% panel.title_element.subtitle %] [% END %]
diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json index 34db6b4178051..a8133f6d75a03 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json @@ -872,41 +872,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json index 3b0605189da34..ae1ef1b5d4d12 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json @@ -1512,6 +1512,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -1531,7 +1554,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { @@ -2163,41 +2186,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json index 15ec668b42201..d7019f92814a8 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json @@ -872,41 +872,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json index acfcfc26dfce0..373c180cb1c26 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2160,6 +2160,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -2179,7 +2202,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { @@ -2811,41 +2834,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json index ed684ab10c8fc..d6618785c3c87 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json @@ -867,41 +867,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json index 18a1de0db0d76..854552f65b990 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels-fr.json @@ -821,6 +821,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Repères nutritionnels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -840,7 +863,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

Ce produit n'est pas considéré comme une boisson pour le calcul du Nutri-Score.

\n\n\n\n\n\n

\n Points positifs : 3 \n

\n\n
    \n \n
  • \n Protéines :\n1 / 5\n(valeur : 1.974375, \n valeur arrondie : 1.97)\n
  • \n \n
  • \n Fibre :\n0 / 5\n(valeur : 0.8125, \n valeur arrondie : 0.81)\n
  • \n \n
  • \n Fruits, légumes, noix et huiles de colza / noix / olive :\n2 / 5\n(valeur : 62.5, \n valeur arrondie : 62.5)\n
  • \n \n
\n\n\n\n

\n Points négatifs : 6 \n

\n\n
    \n \n
  • \n Énergie :\n1 / 10\n(valeur : 558.75, \n valeur arrondie : 558.8)\n
  • \n \n
  • \n Sucres :\n1 / 10\n(valeur : 7.2621875, \n valeur arrondie : 7.26)\n
  • \n \n
  • \n Graisses saturées :\n4 / 10\n(valeur : 4.903125, \n valeur arrondie : 4.9)\n
  • \n \n
  • \n Sodium :\n0 / 10\n(valeur : 19.725, \n valeur arrondie : 19.7)\n
  • \n \n
\n\n\n\n

Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 11.

\n\n

\n Score nutritionnel : 3\n (6 - 3)\n

\n

Nutri-Score : C

\n\n" + "html" : "\n\n

Ce produit n'est pas considéré comme une boisson pour le calcul du Nutri-Score.

\n\n\n\n\n\n

\n Points positifs : 3 \n

\n\n
    \n \n
  • \n Protéines :\n1 / 5\n(valeur : 1.974375, \n valeur arrondie : 1.97)\n
  • \n \n
  • \n Fibre :\n0 / 5\n(valeur : 0.8125, \n valeur arrondie : 0.81)\n
  • \n \n
  • \n Fruits, légumes, noix et huiles de colza / noix / olive :\n2 / 5\n(valeur : 62.5, \n valeur arrondie : 62.5)\n
  • \n \n
\n\n\n\n

\n Points négatifs : 6 \n

\n\n
    \n \n
  • \n Énergie :\n1 / 10\n(valeur : 558.75, \n valeur arrondie : 558.8)\n
  • \n \n
  • \n Sucres :\n1 / 10\n(valeur : 7.2621875, \n valeur arrondie : 7.26)\n
  • \n \n
  • \n Graisses saturées :\n4 / 10\n(valeur : 4.903125, \n valeur arrondie : 4.9)\n
  • \n \n
  • \n Sodium :\n0 / 10\n(valeur : 19.725, \n valeur arrondie : 19.7)\n
  • \n \n
\n\n\n\n

Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 11.

\n\n

\n Score nutritionnel : \n (6 - 3)\n

\n

Nutri-Score :

\n\n" } }, { diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json index 22e474d88c3a5..7bea315570310 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-knowledge-panels.json @@ -821,6 +821,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -840,7 +863,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { diff --git a/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json b/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json index f10b1f4656d01..d3bc1ee6c5a08 100644 --- a/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json +++ b/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json @@ -603,47 +603,76 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 645 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 2, + "unit" : "g", + "value" : 2.64 + }, + { + "id" : "salt", + "max" : 20, + "points" : 20, + "unit" : "g", + "value" : 24.54 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 645, - "energy_points" : 1, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 24, + "negative_max" : 55, + "negative_points" : 23, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], "positive_points" : 0, - "proteins" : 21.825, - "proteins_points" : 2, - "proteins_points_limited_reason" : "red_meat_product", - "salt" : 24.54, - "salt_points" : 21, - "saturated_fat" : 2.64, - "saturated_fat_points" : 2, - "sugars" : 0, - "sugars_points" : 0 + "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "e", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 24 + "score" : 23 } }, "nutriscore_2021_tags" : [ diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json index 16db1d44ed322..62a4aa3137207 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json index 463bd6800c9b4..f7af1547ce1b7 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json index 463bd6800c9b4..f7af1547ce1b7 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json index 16db1d44ed322..62a4aa3137207 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json index 463bd6800c9b4..f7af1547ce1b7 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json index 3051244cc969c..d096ff490256c 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json index 437845525bd78..618e224752c8f 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json @@ -1514,6 +1514,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -1533,7 +1556,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { @@ -2165,41 +2188,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json index d8e993f3fcde7..20d00854fa817 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json @@ -874,41 +874,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json index 394887f26ce12..0d5d3af564aaf 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2162,6 +2162,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -2181,7 +2204,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { @@ -2813,41 +2836,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json index d3504cd53522a..c6c5b253e2968 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json @@ -869,41 +869,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json index 565595c5ccb78..7a10baf2152d3 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels-fr.json @@ -822,6 +822,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Repères nutritionnels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -841,7 +864,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

Ce produit n'est pas considéré comme une boisson pour le calcul du Nutri-Score.

\n\n\n\n\n\n

\n Points positifs : 3 \n

\n\n
    \n \n
  • \n Protéines :\n1 / 5\n(valeur : 1.974375, \n valeur arrondie : 1.97)\n
  • \n \n
  • \n Fibre :\n0 / 5\n(valeur : 0.8125, \n valeur arrondie : 0.81)\n
  • \n \n
  • \n Fruits, légumes, noix et huiles de colza / noix / olive :\n2 / 5\n(valeur : 62.5, \n valeur arrondie : 62.5)\n
  • \n \n
\n\n\n\n

\n Points négatifs : 6 \n

\n\n
    \n \n
  • \n Énergie :\n1 / 10\n(valeur : 558.75, \n valeur arrondie : 558.8)\n
  • \n \n
  • \n Sucres :\n1 / 10\n(valeur : 7.2621875, \n valeur arrondie : 7.26)\n
  • \n \n
  • \n Graisses saturées :\n4 / 10\n(valeur : 4.903125, \n valeur arrondie : 4.9)\n
  • \n \n
  • \n Sodium :\n0 / 10\n(valeur : 19.725, \n valeur arrondie : 19.7)\n
  • \n \n
\n\n\n\n

Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 11.

\n\n

\n Score nutritionnel : 3\n (6 - 3)\n

\n

Nutri-Score : C

\n\n" + "html" : "\n\n

Ce produit n'est pas considéré comme une boisson pour le calcul du Nutri-Score.

\n\n\n\n\n\n

\n Points positifs : 3 \n

\n\n
    \n \n
  • \n Protéines :\n1 / 5\n(valeur : 1.974375, \n valeur arrondie : 1.97)\n
  • \n \n
  • \n Fibre :\n0 / 5\n(valeur : 0.8125, \n valeur arrondie : 0.81)\n
  • \n \n
  • \n Fruits, légumes, noix et huiles de colza / noix / olive :\n2 / 5\n(valeur : 62.5, \n valeur arrondie : 62.5)\n
  • \n \n
\n\n\n\n

\n Points négatifs : 6 \n

\n\n
    \n \n
  • \n Énergie :\n1 / 10\n(valeur : 558.75, \n valeur arrondie : 558.8)\n
  • \n \n
  • \n Sucres :\n1 / 10\n(valeur : 7.2621875, \n valeur arrondie : 7.26)\n
  • \n \n
  • \n Graisses saturées :\n4 / 10\n(valeur : 4.903125, \n valeur arrondie : 4.9)\n
  • \n \n
  • \n Sodium :\n0 / 10\n(valeur : 19.725, \n valeur arrondie : 19.7)\n
  • \n \n
\n\n\n\n

Les points pour les protéines sont comptés car les points négatifs sont inférieurs à 11.

\n\n

\n Score nutritionnel : \n (6 - 3)\n

\n

Nutri-Score :

\n\n" } }, { diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json index e37d18c3855fe..d9d1444b0469d 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-knowledge-panels.json @@ -822,6 +822,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { @@ -841,7 +864,7 @@ { "element_type" : "text", "text_element" : { - "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: 3\n (6 - 3)\n

\n

Nutri-Score: C

\n\n" + "html" : "\n\n

This product is not considered a beverage for the calculation of the Nutri-Score.

\n\n\n\n\n\n

\n Positive points: 3 \n

\n\n
    \n \n
  • \n Proteins:\n1 / 5\n(value: 1.974375, \n rounded value: 1.97)\n
  • \n \n
  • \n Fiber:\n0 / 5\n(value: 0.8125, \n rounded value: 0.81)\n
  • \n \n
  • \n Fruits, vegetables, nuts, and colza/walnut/olive oils:\n2 / 5\n(value: 62.5, \n rounded value: 62.5)\n
  • \n \n
\n\n\n\n

\n Negative points: 6 \n

\n\n
    \n \n
  • \n Energy:\n1 / 10\n(value: 558.75, \n rounded value: 558.8)\n
  • \n \n
  • \n Sugars:\n1 / 10\n(value: 7.2621875, \n rounded value: 7.26)\n
  • \n \n
  • \n Saturated fat:\n4 / 10\n(value: 4.903125, \n rounded value: 4.9)\n
  • \n \n
  • \n Sodium:\n0 / 10\n(value: 19.725, \n rounded value: 19.7)\n
  • \n \n
\n\n\n\n

The points for proteins are counted because the negative points are less than 11.

\n\n

\n Nutritional score: \n (6 - 3)\n

\n

Nutri-Score:

\n\n" } }, { diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json index 8715d055544c3..fde972ff2f308 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-all.json @@ -403,7 +403,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated-attribute-groups-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated-attribute-groups-knowledge-panels.json index e989ed12d88b3..f9325b254c176 100644 --- a/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated-attribute-groups-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_write/patch-request-fields-updated-attribute-groups-knowledge-panels.json @@ -502,6 +502,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070167470.json b/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070167470.json index d09f92f85e78c..a56003ba3e1dd 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070167470.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070167470.json @@ -502,7 +502,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070815746.json b/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070815746.json index 149931c72a113..f91991d750e85 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070815746.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/carrefour-images/products/3560070815746.json @@ -540,7 +540,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390017165.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390017165.json index 7a528b9068f44..4cda461127d51 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390017165.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390017165.json @@ -449,7 +449,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020745.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020745.json index 0386ca65bb9d7..4c0557be0a5d5 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020745.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020745.json @@ -446,7 +446,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020806.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020806.json index e4f9974fa2846..34971bc5db255 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020806.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020806.json @@ -435,7 +435,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020998.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020998.json index 2b3df847f91de..9445eca0e4117 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020998.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390020998.json @@ -449,7 +449,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021001.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021001.json index df55b0b74a2eb..bfd281c40441a 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021001.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021001.json @@ -443,7 +443,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021469.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021469.json index 44821c3b63158..197bef122887d 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021469.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021469.json @@ -440,7 +440,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021544.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021544.json index cf99f787062d7..52d5915354cd7 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021544.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021544.json @@ -443,7 +443,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021568.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021568.json index 95cfaa1dad22f..f277f1f6975fc 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021568.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021568.json @@ -441,7 +441,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021926.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021926.json index 3062b68dbf556..8bd5f3fad7cf5 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021926.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390021926.json @@ -433,7 +433,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024781.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024781.json index 4fd9b87895f02..3561231c8b7ce 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024781.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024781.json @@ -468,7 +468,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024804.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024804.json index 7d87177b81813..69481be3ac0a2 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024804.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024804.json @@ -457,7 +457,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024842.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024842.json index f315ae1d2011b..6e85a32cee409 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024842.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024842.json @@ -458,7 +458,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024866.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024866.json index 63b84c85bb8ad..6fd75d781b75f 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024866.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390024866.json @@ -458,7 +458,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025399.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025399.json index 59e817ca6a28a..c7dccaf0a5992 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025399.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025399.json @@ -450,7 +450,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025863.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025863.json index a2145fb32c09c..ee1ce8f38111c 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025863.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390025863.json @@ -432,7 +432,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026044.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026044.json index f0b5521ac7715..2a9179785524c 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026044.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026044.json @@ -454,7 +454,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026648.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026648.json index f1fd287b1f34f..85ce702fda54d 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026648.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026648.json @@ -469,7 +469,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026754.json b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026754.json index 5669e0bd840fd..ff13b8f588600 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026754.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/packagings-mousquetaires/products/3250390026754.json @@ -451,7 +451,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json index dae10a57f3965..05971f2e62499 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json @@ -884,7 +884,7 @@ "proteins" : null, "salt" : null, "saturated_fat" : null, - "saturated_fat_ratio" : 0, + "saturated_fat_ratio" : 1, "sugars" : null }, "grade" : "unknown", diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/7270190128403.json b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/7270190128403.json index df4e7587ff3a0..a468445b004a0 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/7270190128403.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/7270190128403.json @@ -420,7 +420,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/data_quality_knowledge_panel/data-quality.json b/tests/integration/expected_test_results/data_quality_knowledge_panel/data-quality.json index 48ed01d496c89..321e0f3d81437 100644 --- a/tests/integration/expected_test_results/data_quality_knowledge_panel/data-quality.json +++ b/tests/integration/expected_test_results/data_quality_knowledge_panel/data-quality.json @@ -272,7 +272,7 @@ "panel_group_id" : "nutrition", "panel_ids" : [ "nutriscore", - "nutrient_level_salt" + "nutrient_levels" ], "title" : "Nutrition", "type" : "subcard" @@ -576,6 +576,31 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [ + "nutrient_level_salt" + ] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { diff --git a/tests/integration/expected_test_results/data_quality_knowledge_panel/no-data-quality.json b/tests/integration/expected_test_results/data_quality_knowledge_panel/no-data-quality.json index 0de636c5d4dc5..7a10651184cfe 100644 --- a/tests/integration/expected_test_results/data_quality_knowledge_panel/no-data-quality.json +++ b/tests/integration/expected_test_results/data_quality_knowledge_panel/no-data-quality.json @@ -496,6 +496,29 @@ "health" ] }, + "nutrient_levels" : { + "elements" : [ + { + "element_type" : "panel_group", + "panel_group_element" : { + "panel_group_id" : "nutrient_levels_group", + "panel_ids" : [] + } + } + ], + "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/nutrition.svg", + "title" : "Nutrient levels" + }, + "topics" : [ + "health" + ] + }, "nutriscore" : { "elements" : [ { diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006001.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006001.json index 397f06d33f7c3..1355c5ae8931a 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006001.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006001.json @@ -620,7 +620,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006002.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006002.json index d9969953ef0df..4edb90988f515 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006002.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006002.json @@ -433,7 +433,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006003.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006003.json index dbcd6ff92a9ec..aea8b174a5d58 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006003.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006003.json @@ -428,7 +428,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006004.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006004.json index eac4c3a1ea7cf..c000d3463753b 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006004.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006004.json @@ -645,7 +645,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006005.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006005.json index 3017e0278ff0c..d5a76b9c8039a 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006005.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006005.json @@ -443,7 +443,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006006.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006006.json index 4eb5bdfbd0299..68e4a6aba10d6 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006006.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006006.json @@ -436,7 +436,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006007.json b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006007.json index bdc966c590a24..4e3e34b1e9150 100644 --- a/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006007.json +++ b/tests/integration/expected_test_results/import_csv_file/replace_existing_values/3003004006007.json @@ -430,7 +430,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006001.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006001.json index a77c2c6b4a760..08a3680a8ba08 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006001.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006001.json @@ -614,7 +614,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006002.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006002.json index bd844f4271c00..5d7c2e3b93b36 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006002.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006002.json @@ -425,7 +425,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006003.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006003.json index 37e25b8cedc07..df348c8204fb6 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006003.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006003.json @@ -428,7 +428,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006004.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006004.json index 9036c096c5b46..461f981843396 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006004.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006004.json @@ -607,7 +607,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006005.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006005.json index dd1203ab4ee1b..c3fb6e30e6e8b 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006005.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006005.json @@ -435,7 +435,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006006.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006006.json index f7318fdd7fb48..eb8344ac5f760 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006006.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006006.json @@ -434,7 +434,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/import_csv_file/test/2003004006007.json b/tests/integration/expected_test_results/import_csv_file/test/2003004006007.json index be2534ebf060a..0ad9c8449f4de 100644 --- a/tests/integration/expected_test_results/import_csv_file/test/2003004006007.json +++ b/tests/integration/expected_test_results/import_csv_file/test/2003004006007.json @@ -430,7 +430,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/integration/expected_test_results/search_v1/search-no-filter.json b/tests/integration/expected_test_results/search_v1/search-no-filter.json index 9005b408da6d0..02dd6df1018fc 100644 --- a/tests/integration/expected_test_results/search_v1/search-no-filter.json +++ b/tests/integration/expected_test_results/search_v1/search-no-filter.json @@ -536,7 +536,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -677,41 +677,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, @@ -1318,7 +1354,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -1990,7 +2026,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -2130,41 +2166,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 260 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.6 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.472333333333333 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.07 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 1, + "unit" : "g", + "value" : 2.84333333333333 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.866666666666667 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 66.7 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 260, - "energy_points" : 0, - "fiber" : 0.866666666666667, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 66.6666666666667, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 3, - "proteins" : 2.84333333333333, - "proteins_points" : 1, - "salt" : 0.07, - "salt_points" : 0, - "saturated_fat" : 0.472333333333333, - "saturated_fat_points" : 0, - "sugars" : 7.6, - "sugars_points" : 2 + "positive_points" : 3 }, "grade" : "a", "nutrients_available" : 1, @@ -2762,7 +2834,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "es", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -2900,40 +2972,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 2, + "unit" : "kJ", + "value" : 754.666666666666 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 6.73333333333333 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 8, + "unit" : "g", + "value" : 8.23066666666666 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.00126666666666667 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.866666666666667 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 66.7 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 754.666666666666, - "energy_points" : 2, - "fiber" : 0.866666666666667, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 66.6666666666667, - "fruits_vegetables_legumes_points" : 2, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 11, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.18, - "proteins_points" : 0, - "salt" : 0.00126666666666667, - "salt_points" : 0, - "saturated_fat" : 8.23066666666666, - "saturated_fat_points" : 8, - "sugars" : 6.73333333333333, - "sugars_points" : 1 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, @@ -3674,7 +3775,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "es", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -3819,41 +3920,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, @@ -4612,7 +4749,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -4757,41 +4894,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json index df6930d924b82..8ef6dee983419 100644 --- a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json @@ -608,7 +608,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "es", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -753,41 +753,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, @@ -1546,7 +1582,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -1691,41 +1727,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json index 9005b408da6d0..02dd6df1018fc 100644 --- a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json @@ -536,7 +536,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -677,41 +677,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 558.75 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.2621875 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 4.903125 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0496875 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 1.974375 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.8125 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 62.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 558.75, - "energy_points" : 1, - "fiber" : 0.8125, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 62.5, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 7, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 1.974375, - "proteins_points" : 0, - "salt" : 0.0496875, - "salt_points" : 0, - "saturated_fat" : 4.903125, - "saturated_fat_points" : 4, - "sugars" : 7.2621875, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, @@ -1318,7 +1354,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -1990,7 +2026,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -2130,41 +2166,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 260 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.6 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.472333333333333 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.07 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 1, + "unit" : "g", + "value" : 2.84333333333333 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.866666666666667 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 66.7 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 260, - "energy_points" : 0, - "fiber" : 0.866666666666667, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 66.6666666666667, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 3, - "proteins" : 2.84333333333333, - "proteins_points" : 1, - "salt" : 0.07, - "salt_points" : 0, - "saturated_fat" : 0.472333333333333, - "saturated_fat_points" : 0, - "sugars" : 7.6, - "sugars_points" : 2 + "positive_points" : 3 }, "grade" : "a", "nutrients_available" : 1, @@ -2762,7 +2834,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "es", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -2900,40 +2972,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 2, + "unit" : "kJ", + "value" : 754.666666666666 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 6.73333333333333 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 8, + "unit" : "g", + "value" : 8.23066666666666 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.00126666666666667 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.866666666666667 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 66.7 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 754.666666666666, - "energy_points" : 2, - "fiber" : 0.866666666666667, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 66.6666666666667, - "fruits_vegetables_legumes_points" : 2, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 11, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.18, - "proteins_points" : 0, - "salt" : 0.00126666666666667, - "salt_points" : 0, - "saturated_fat" : 8.23066666666666, - "saturated_fat_points" : 8, - "sugars" : 6.73333333333333, - "sugars_points" : 1 + "positive_points" : 2 }, "grade" : "c", "nutrients_available" : 1, @@ -3674,7 +3775,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "es", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -3819,41 +3920,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, @@ -4612,7 +4749,7 @@ "last_editor" : "tests", "last_modified_by" : "tests", "last_modified_t" : "--ignore--", - "last_updated_t" : "--ignore--", + "last_updated_t" : "--ignore--", "lc" : "en", "link" : "http://world.openfoodfacts.org/", "main_countries_tags" : [], @@ -4757,41 +4894,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 155.25 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 7.575 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.01575 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0019 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2025 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.975 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 75 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 155.25, - "energy_points" : 0, - "fiber" : 0.975, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 75, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2025, - "proteins_points" : 0, - "salt" : 0.0019, - "salt_points" : 0, - "saturated_fat" : 0.01575, - "saturated_fat_points" : 0, - "sugars" : 7.575, - "sugars_points" : 2 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/attributes/en-attributes.json b/tests/unit/expected_test_results/attributes/en-attributes.json index 656e2230df6c5..c6815693304df 100644 --- a/tests/unit/expected_test_results/attributes/en-attributes.json +++ b/tests/unit/expected_test_results/attributes/en-attributes.json @@ -1222,40 +1222,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 2, + "unit" : "kJ", + "value" : 800 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 7, + "unit" : "g", + "value" : 25 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 3, + "unit" : "g", + "value" : 4 + }, + { + "id" : "salt", + "max" : 20, + "points" : 1, + "unit" : "g", + "value" : 0.25 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 3 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 10.2 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 800, - "energy_points" : 2, - "fiber" : 3, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 10.2272727272727, - "fruits_vegetables_legumes_points" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 13, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 2, - "proteins_points" : 0, - "salt" : 0.25, - "salt_points" : 1, - "saturated_fat" : 4, - "saturated_fat_points" : 3, - "sugars" : 25, - "sugars_points" : 7 + "positive_points" : 0 }, "grade" : "d", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/attributes/en-ecoscore-score-at-20-threshold.json b/tests/unit/expected_test_results/attributes/en-ecoscore-score-at-20-threshold.json index b95a740277ec0..fa11493a74754 100644 --- a/tests/unit/expected_test_results/attributes/en-ecoscore-score-at-20-threshold.json +++ b/tests/unit/expected_test_results/attributes/en-ecoscore-score-at-20-threshold.json @@ -855,7 +855,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/unit/expected_test_results/attributes/en-no-ingredients.json b/tests/unit/expected_test_results/attributes/en-no-ingredients.json index dca72ed028fc7..707028badb4ff 100644 --- a/tests/unit/expected_test_results/attributes/en-no-ingredients.json +++ b/tests/unit/expected_test_results/attributes/en-no-ingredients.json @@ -850,7 +850,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 1, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/unit/expected_test_results/attributes/en-nutriscore.json b/tests/unit/expected_test_results/attributes/en-nutriscore.json index 3b9bb456124fc..46833f01142b8 100644 --- a/tests/unit/expected_test_results/attributes/en-nutriscore.json +++ b/tests/unit/expected_test_results/attributes/en-nutriscore.json @@ -947,40 +947,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 7, + "unit" : "kJ", + "value" : 2591 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 5.1 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 9.7 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 3, + "unit" : "g", + "value" : 5.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 2591, - "energy_points" : 7, - "fiber" : 5.5, - "fiber_points" : 3, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 17, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 8, - "proteins" : 29, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 9.7, - "saturated_fat_points" : 9, - "sugars" : 5.1, - "sugars_points" : 1 + "positive_points" : 8 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json index 36c219dcaed4f..c03005645605b 100644 --- a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json @@ -216,42 +216,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 10, + "unit" : "g", + "value" : 20 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 5 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 3378, - "energy_points" : 10, - "fiber" : 2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 24, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 5, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 5, - "saturated_fat_points" : 4, - "sugars" : 20, - "sugars_points" : 10 + "positive_points" : 7 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json index 49111866e2bd1..80aa34cd0a817 100644 --- a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json +++ b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json @@ -103,39 +103,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 7, + "unit" : "kJ", + "value" : 2450 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 8, + "unit" : "g", + "value" : 31 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 1, + "unit" : "g", + "value" : 1.03 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5525 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 4, + "unit" : "g", + "value" : 6.9 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 2450, - "energy_points" : 7, - "fiber" : 6.9, - "fiber_points" : 4, - "fruits_vegetables_legumes" : null, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 18, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 4, - "proteins" : 10.3, - "proteins_points" : 4, - "salt" : 0.5525, - "salt_points" : 2, - "saturated_fat" : 1.03, - "saturated_fat_points" : 1, - "sugars" : 31, - "sugars_points" : 8 + "positive_points" : 4 }, "grade" : "d", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json index 02de0a3b4b652..ca9c80744bfbf 100644 --- a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json +++ b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json @@ -90,40 +90,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 287 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 6.3 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 1, + "unit" : "g", + "value" : 1.1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.1125 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 1, + "unit" : "g", + "value" : 3.8 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 1.9 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 287, - "energy_points" : 0, - "fiber" : 1.9, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 1, - "proteins" : 3.8, - "proteins_points" : 1, - "salt" : 0.1125, - "salt_points" : 0, - "saturated_fat" : 1.1, - "saturated_fat_points" : 1, - "sugars" : 6.3, - "sugars_points" : 1 + "positive_points" : 1 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/colza-oil.json b/tests/unit/expected_test_results/nutriscore/colza-oil.json index 9b5cb598ebbc8..2d35f739ada46 100644 --- a/tests/unit/expected_test_results/nutriscore/colza-oil.json +++ b/tests/unit/expected_test_results/nutriscore/colza-oil.json @@ -106,43 +106,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 2, + "unit" : "kJ", + "value" : 259 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3760, - "energy_from_saturated_fat" : 259, - "energy_from_saturated_fat_points" : 2, - "fat" : 100, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 7, - "saturated_fat_ratio" : 7, - "saturated_fat_ratio_points" : 0, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/cookies.json b/tests/unit/expected_test_results/nutriscore/cookies.json index 67f58ca6967cf..86e98f69ecd30 100644 --- a/tests/unit/expected_test_results/nutriscore/cookies.json +++ b/tests/unit/expected_test_results/nutriscore/cookies.json @@ -96,39 +96,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3460 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 10, + "unit" : "g", + "value" : 15 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 3460, - "energy_points" : 10, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 20, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 15, - "saturated_fat_points" : 10, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json index 79cfbe91a422e..084bc7ab412f1 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json @@ -224,42 +224,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 8, + "unit" : "g", + "value" : 10 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 5 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 3378, - "energy_points" : 10, - "fiber" : 2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 22, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 5, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 5, - "saturated_fat_points" : 4, - "sugars" : 10, - "sugars_points" : 8 + "positive_points" : 7 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json index 1a75ef6f628f2..ee02a09983eea 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json @@ -220,42 +220,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 10, + "unit" : "g", + "value" : 20 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 5 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 3378, - "energy_points" : 10, - "fiber" : 2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 24, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 5, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 5, - "saturated_fat_points" : 4, - "sugars" : 20, - "sugars_points" : 10 + "positive_points" : 7 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json index 2347fbfe93bac..27cb3b844a9d2 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json @@ -213,42 +213,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 8, + "unit" : "g", + "value" : 10 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 5 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 3378, - "energy_points" : 10, - "fiber" : 2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 22, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 5, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 5, - "saturated_fat_points" : 4, - "sugars" : 10, - "sugars_points" : 8 + "positive_points" : 7 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json index f9f9dee217e11..03d7a8d374c31 100644 --- a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json @@ -208,41 +208,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 207 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 3, + "unit" : "g", + "value" : 10.1 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.021 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.27 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 1.3 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 207, - "energy_points" : 0, - "fiber" : 1.3, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 3, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0.27, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 0.021, - "saturated_fat_points" : 0, - "sugars" : 10.1, - "sugars_points" : 3 + "positive_points" : 5 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json index 9726b066ea2dd..06a665b9a9786 100644 --- a/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json +++ b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json @@ -172,49 +172,83 @@ "2023" : { "category_available" : 1, "data" : { - "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_7", - "energy" : 3448, - "energy_from_saturated_fat" : 606.8, - "energy_from_saturated_fat_points" : 5, - "fat" : 91.6, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 606.8 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 7, + "negative_max" : 55, + "negative_points" : 5, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "proteins", + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 16.4, - "saturated_fat_ratio" : 17.9039301310044, - "saturated_fat_ratio_points" : 2, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 2 + "score" : 0 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-beers-category.json b/tests/unit/expected_test_results/nutriscore/en-beers-category.json index 48802e2fdceea..60c16548b6a38 100644 --- a/tests/unit/expected_test_results/nutriscore/en-beers-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-beers-category.json @@ -76,7 +76,7 @@ "data" : { "energy" : 182, "fiber" : 0.5, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json index 6acc1d1cbf553..7be0900fc1599 100644 --- a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json +++ b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json @@ -218,41 +218,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 81 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 2.48 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.056 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.86 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 1.2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 81, - "energy_points" : 0, - "fiber" : 1.2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 0, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0.86, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 0.056, - "saturated_fat_points" : 0, - "sugars" : 2.48, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-milk.json b/tests/unit/expected_test_results/nutriscore/en-milk.json index 2ba2a7d3df8b4..3da4c26f852be 100644 --- a/tests/unit/expected_test_results/nutriscore/en-milk.json +++ b/tests/unit/expected_test_results/nutriscore/en-milk.json @@ -93,41 +93,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 195 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 3, + "unit" : "g", + "value" : 4.8 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.1 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 3.3 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 195, - "energy_points" : 3, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 6, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 3.3, - "proteins_points" : 7, - "salt" : 0.1, - "salt_points" : 0, - "saturated_fat" : 1, - "saturated_fat_points" : 0, - "sugars" : 4.8, - "sugars_points" : 3 + "positive_points" : 7 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json index 0595d5199f356..b7cf02f0c92b8 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json @@ -109,49 +109,83 @@ "2023" : { "category_available" : 1, "data" : { - "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_7", - "energy" : 3367, - "energy_from_saturated_fat" : 629, - "energy_from_saturated_fat_points" : 5, - "fat" : 91, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 629 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 7, + "negative_max" : 55, + "negative_points" : 5, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "proteins", + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 17, - "saturated_fat_ratio" : 18.6813186813187, - "saturated_fat_ratio_points" : 2, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 2 + "score" : 0 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json index 08c40a23e6614..cddf1da0a8b36 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json @@ -176,49 +176,83 @@ "2023" : { "category_available" : 1, "data" : { - "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_7", - "energy" : 3367, - "energy_from_saturated_fat" : 629, - "energy_from_saturated_fat_points" : 5, - "fat" : 91, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 629 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 7, + "negative_max" : 55, + "negative_points" : 5, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "proteins", + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 17, - "saturated_fat_ratio" : 18.6813186813187, - "saturated_fat_ratio_points" : 2, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 2 + "score" : 0 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json index e87a6a35403d0..155812ba87752 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json @@ -221,49 +221,83 @@ "2023" : { "category_available" : 1, "data" : { - "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_7", - "energy" : 3367, - "energy_from_saturated_fat" : 629, - "energy_from_saturated_fat_points" : 5, - "fat" : 91, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 629 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, + "count_proteins" : 1, + "count_proteins_reason" : "negative_points_less_than_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 7, + "negative_max" : 55, + "negative_points" : 5, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "proteins", + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 17, - "saturated_fat_ratio" : 18.6813186813187, - "saturated_fat_ratio_points" : 2, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 2 + "score" : 0 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json index 98fe0dc014227..f93e3470954fe 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json @@ -252,42 +252,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 182 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 7, + "unit" : "g", + "value" : 8.9 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 2, + "unit" : "%", + "value" : 50 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 182, - "energy_points" : 3, - "fiber" : 0.5, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 50, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 12, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.2, - "proteins_points" : 0, - "salt" : 0.5, - "salt_points" : 2, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 8.9, - "sugars_points" : 7 + "positive_points" : 2 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json index 66b443bf518cf..4c4a38b9779a4 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json @@ -107,42 +107,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 182 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 7, + "unit" : "g", + "value" : 8.9 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 6, + "unit" : "%", + "value" : 100 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 182, - "energy_points" : 3, - "fiber" : 0.5, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 6, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 12, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 6, - "proteins" : 0.2, - "proteins_points" : 0, - "salt" : 0.5, - "salt_points" : 2, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 8.9, - "sugars_points" : 7 + "positive_points" : 6 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json b/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json index 90a4e342243d2..a847131e93ba8 100644 --- a/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json @@ -105,41 +105,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 182 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 2, + "unit" : "g", + "value" : 8.9 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.2 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 182, - "energy_points" : 0, - "fiber" : 0.5, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 4, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0.2, - "proteins_points" : 0, - "salt" : 0.5, - "salt_points" : 2, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 8.9, - "sugars_points" : 2 + "positive_points" : 0 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json index 1e087fb72460f..75ab4bd70f883 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json @@ -265,42 +265,78 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 10 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 2, + "unit" : "g", + "value" : 50 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 9, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], "positive_points" : 2, - "proteins" : 50, - "proteins_points" : 2, - "proteins_points_limited_reason" : "red_meat_product", - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_points" : 9, - "sugars" : 0, - "sugars_points" : 0 + "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json index 6b642ddc0299d..ac34497e42ead 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json @@ -247,41 +247,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 10 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 50 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 9, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 50, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_points" : 9, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json index 2b4c368f75a47..8d90388cf3277 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json @@ -291,41 +291,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 10 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 50 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 9, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 50, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_points" : 9, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json index 622e92d564f69..ceceae41b6b8d 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json @@ -94,40 +94,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 10 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 50 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 9, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 50, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_points" : 9, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json index ac3c564bcb858..49e0274f3f9ea 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json @@ -103,41 +103,78 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 9, + "unit" : "g", + "value" : 10 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 2, + "unit" : "g", + "value" : 50 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 9, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], "positive_points" : 2, - "proteins" : 50, - "proteins_points" : 2, - "proteins_points_limited_reason" : "red_meat_product", - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_points" : 9, - "sugars" : 0, - "sugars_points" : 0 + "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json index d52f2753cfce5..f3447bf2f02b2 100644 --- a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json +++ b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json @@ -241,41 +241,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 1.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 20 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 1, + "unit" : "%", + "value" : 55 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 55, - "fruits_vegetables_legumes_points" : 1, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 0, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 8, - "proteins" : 20, - "proteins_points" : 7, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 1.5, - "sugars_points" : 0 + "positive_points" : 8 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json index 7d2d18e605f94..51bd2e9f16b06 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json @@ -201,40 +201,69 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 1700 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 15, + "unit" : "g", + "value" : 99.8 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.0054 + } + ], + "positive" : [ + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 0, - "count_proteins_reason" : "negative_points_more_than_11", - "energy" : 1700, - "energy_points" : 5, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_11", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 20, + "positive_max" : 10, "positive_nutrients" : [ - "fruits_vegetables_legumes", - "fiber" + "fiber", + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0.0054, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 99.8, - "sugars_points" : 15 + "positive_points" : 0 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json index 6cc8802ef4ab1..8abfaf463422f 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json @@ -213,42 +213,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 3, + "unit" : "g", + "value" : 4.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 4, + "unit" : "%", + "value" : 70.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 82, - "energy_points" : 1, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 70.5, - "fruits_vegetables_legumes_points" : 4, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 4, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 4, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 4.5, - "sugars_points" : 3 + "positive_points" : 4 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json index 60d8e386c8820..d1bbb920684fd 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json @@ -212,42 +212,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 3, + "unit" : "g", + "value" : 4.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 4, + "unit" : null, + "value" : "presence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 4, + "unit" : "%", + "value" : 70.5 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 82, - "energy_points" : 1, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 70.5, - "fruits_vegetables_legumes_points" : 4, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 8, - "non_nutritive_sweeteners_points" : 4, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], "positive_points" : 4, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 4.5, - "sugars_points" : 3, "with_non_nutritive_sweeteners" : 1 }, "grade" : "c", diff --git a/tests/unit/expected_test_results/nutriscore/en-tofu.json b/tests/unit/expected_test_results/nutriscore/en-tofu.json index a4829a88be86f..4a0acf8c4a2e4 100644 --- a/tests/unit/expected_test_results/nutriscore/en-tofu.json +++ b/tests/unit/expected_test_results/nutriscore/en-tofu.json @@ -246,41 +246,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 1.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 20 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 0, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 20, - "proteins_points" : 7, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 1.5, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json index dbaf415e2c581..31fc104262083 100644 --- a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json +++ b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json @@ -228,41 +228,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 1.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 20 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 82, - "energy_points" : 0, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 0, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 20, - "proteins_points" : 7, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 1.5, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/flavored-spring-water-no-nutrition.json b/tests/unit/expected_test_results/nutriscore/flavored-spring-water-no-nutrition.json index d1246dddd271e..30dab9840d54e 100644 --- a/tests/unit/expected_test_results/nutriscore/flavored-spring-water-no-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/flavored-spring-water-no-nutrition.json @@ -75,7 +75,7 @@ "data" : { "energy" : null, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, diff --git a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json index 38cfd02ab2e1d..b95ec47b0f717 100644 --- a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json @@ -98,41 +98,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 9, + "unit" : "kJ", + "value" : 378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 2, + "unit" : "g", + "value" : 3 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 378, - "energy_points" : 9, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 11, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 3, - "sugars_points" : 2 + "positive_points" : 0 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json b/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json index 15a1292ffc523..ba9ced1c9b366 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json +++ b/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json @@ -263,41 +263,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 315 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 3.6 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 5, + "unit" : "g", + "value" : 1.2 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 2, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 3, + "unit" : "g", + "value" : 5.3 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 1, + "unit" : "%", + "value" : 50 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 315, - "energy_points" : 0, - "fiber" : 5.3, - "fiber_points" : 3, - "fruits_vegetables_legumes" : 50, - "fruits_vegetables_legumes_points" : 1, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 6, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 6, - "proteins" : 5, - "proteins_points" : 2, - "salt" : 1.2, - "salt_points" : 5, - "saturated_fat" : 0.1, - "saturated_fat_points" : 0, - "sugars" : 3.6, - "sugars_points" : 1 + "positive_points" : 6 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json b/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json index 276fe8ddbdf29..8dd974a3062f3 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json +++ b/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json @@ -190,41 +190,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 315 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 3.6 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 5, + "unit" : "g", + "value" : 1.2 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 2, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 3, + "unit" : "g", + "value" : 5.3 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 10 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 315, - "energy_points" : 0, - "fiber" : 5.3, - "fiber_points" : 3, - "fruits_vegetables_legumes" : 10, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 6, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 5, - "proteins_points" : 2, - "salt" : 1.2, - "salt_points" : 5, - "saturated_fat" : 0.1, - "saturated_fat_points" : 0, - "sugars" : 3.6, - "sugars_points" : 1 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json index 16f5620a16e30..1c3b8e8791489 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json @@ -219,41 +219,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 178 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.6 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.03 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 1, + "unit" : "g", + "value" : 3.9 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 1, + "unit" : "%", + "value" : 60 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 178, - "energy_points" : 0, - "fiber" : 0.5, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 60, - "fruits_vegetables_legumes_points" : 1, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 0, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 3.9, - "proteins_points" : 1, - "salt" : 0.03, - "salt_points" : 0, - "saturated_fat" : 0.6, - "saturated_fat_points" : 0, - "sugars" : 0.5, - "sugars_points" : 0 + "positive_points" : 2 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json index 48d8f9266c3d3..33b857b43927c 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json +++ b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json @@ -335,41 +335,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 148 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 3 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.2 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.9 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 1.1 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 95 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 148, - "energy_points" : 0, - "fiber" : 1.1, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 94.9997159090909, - "fruits_vegetables_legumes_points" : 5, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0.9, - "proteins_points" : 0, - "salt" : 0.5, - "salt_points" : 2, - "saturated_fat" : 0.2, - "saturated_fat_points" : 0, - "sugars" : 3, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json b/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json index c7730a77fa179..018459bcdb178 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json +++ b/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json @@ -233,41 +233,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 0, + "unit" : "kJ", + "value" : 315 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 1, + "unit" : "g", + "value" : 3.6 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 3, + "unit" : "g", + "value" : 0.8 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 2, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 3, + "unit" : "g", + "value" : 5.3 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 10 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 315, - "energy_points" : 0, - "fiber" : 5.3, - "fiber_points" : 3, - "fruits_vegetables_legumes" : 10, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 4, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 5, - "proteins_points" : 2, - "salt" : 0.8, - "salt_points" : 3, - "saturated_fat" : 0.1, - "saturated_fat_points" : 0, - "sugars" : 3.6, - "sugars_points" : 1 + "positive_points" : 5 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json index b79664bfebcc7..40346ab74564c 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json +++ b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json @@ -451,42 +451,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 82 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 3, + "unit" : "g", + "value" : 4.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.025 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 4, + "unit" : null, + "value" : "presence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0.1 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 82, - "energy_points" : 1, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0.1, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 8, - "non_nutritive_sweeteners_points" : 4, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0.025, - "salt_points" : 0, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "sugars" : 4.5, - "sugars_points" : 3, "with_non_nutritive_sweeteners" : 1 }, "grade" : "d", diff --git a/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json index 767a49a09e31a..1e1eb47148828 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json @@ -284,44 +284,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 362.6 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3700, - "energy_from_saturated_fat" : 362.6, - "energy_from_saturated_fat_points" : 3, - "fat" : 100, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 3, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 9.8, - "saturated_fat_ratio" : 9.8, - "saturated_fat_ratio_points" : 0, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json index bcf334e7f001d..1454b6bbc0e12 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json +++ b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json @@ -262,43 +262,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 5, + "unit" : "kJ", + "value" : 250 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 10, + "unit" : "g", + "value" : 12 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 2, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 2, + "unit" : "%", + "value" : 57 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 250, - "energy_points" : 5, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 57, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 17, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 2, - "proteins" : 0.5, - "proteins_points" : 0, - "salt" : 0.5, - "salt_points" : 2, - "saturated_fat" : 0, - "saturated_fat_points" : 0, - "saturated_fat_ratio" : 0, - "sugars" : 12, - "sugars_points" : 10 + "positive_points" : 2 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json index 12804a510d742..219cda614d373 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json @@ -240,42 +240,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 178 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 0, + "unit" : "g", + "value" : 0.6 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0.03 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 3.9 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0.5 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 8 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 178, - "energy_points" : 3, - "fiber" : 0.5, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 8, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 3, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 3.9, - "proteins_points" : 7, - "salt" : 0.03, - "salt_points" : 0, - "saturated_fat" : 0.6, - "saturated_fat_points" : 0, - "sugars" : 0.5, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json index e9f13a93122da..179261ecade5c 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json +++ b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json @@ -218,44 +218,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 2, + "unit" : "kJ", + "value" : 270.1 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3400, - "energy_from_saturated_fat" : 270.1, - "energy_from_saturated_fat_points" : 2, - "fat" : 92, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 2, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 7.3, - "saturated_fat_ratio" : 7.93478260869565, - "saturated_fat_ratio_points" : 0, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/milk.json b/tests/unit/expected_test_results/nutriscore/milk.json index eee2bd12c39ad..f7e612c4e557a 100644 --- a/tests/unit/expected_test_results/nutriscore/milk.json +++ b/tests/unit/expected_test_results/nutriscore/milk.json @@ -205,42 +205,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 10, + "unit" : "kJ", + "value" : 3378 + }, + { + "id" : "sugars", + "max" : 10, + "points" : 8, + "unit" : "g", + "value" : 10 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "g", + "value" : 5 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 7, + "unit" : "g", + "value" : 5 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 2 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : 3378, - "energy_points" : 10, - "fiber" : 2, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 0, - "fruits_vegetables_legumes_points" : 0, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 54, "negative_points" : 22, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 18, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 5, - "proteins_points" : 7, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 5, - "saturated_fat_points" : 4, - "sugars" : 10, - "sugars_points" : 8 + "positive_points" : 7 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/mushrooms.json b/tests/unit/expected_test_results/nutriscore/mushrooms.json index d076cc62eb5b0..fd1be798b1e68 100644 --- a/tests/unit/expected_test_results/nutriscore/mushrooms.json +++ b/tests/unit/expected_test_results/nutriscore/mushrooms.json @@ -174,41 +174,77 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : 10, + "points" : 1, + "unit" : "kJ", + "value" : 667 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 1.1 + }, + { + "id" : "saturated_fat", + "max" : 10, + "points" : 1, + "unit" : "g", + "value" : 1.2 + }, + { + "id" : "salt", + "max" : 20, + "points" : 4, + "unit" : "g", + "value" : 1 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 2.4 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 5, + "unit" : "g", + "value" : 10.9 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 2, + "unit" : "%", + "value" : 69 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_11", - "energy" : 667, - "energy_points" : 1, - "fiber" : 10.9, - "fiber_points" : 5, - "fruits_vegetables_legumes" : 69, - "fruits_vegetables_legumes_points" : 2, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 55, "negative_points" : 6, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 7, - "proteins" : 2.4, - "proteins_points" : 0, - "salt" : 1, - "salt_points" : 4, - "saturated_fat" : 1.2, - "saturated_fat_points" : 1, - "sugars" : 1.1, - "sugars_points" : 0 + "positive_points" : 7 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/olive-oil.json b/tests/unit/expected_test_results/nutriscore/olive-oil.json index 4dd99bb38c820..7c12f5fc93000 100644 --- a/tests/unit/expected_test_results/nutriscore/olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/olive-oil.json @@ -109,50 +109,83 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 4, + "unit" : "kJ", + "value" : 518 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 0 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 5, + "unit" : "%", + "value" : 100 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3460, - "energy_from_saturated_fat" : 518, - "energy_from_saturated_fat_points" : 4, - "fat" : 92, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : 100, - "fruits_vegetables_legumes_points" : 5, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 5, + "negative_max" : 55, + "negative_points" : 4, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 5, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 14, - "saturated_fat_ratio" : 15.2173913043478, - "saturated_fat_ratio_points" : 1, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 5 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 0 + "score" : -1 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json index 44a063e72220a..f51009cab773e 100644 --- a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json @@ -84,36 +84,84 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy", + "max" : null, + "points" : 0, + "unit" : "kJ", + "value" : null + }, + { + "id" : "sugars", + "max" : null, + "points" : 0, + "unit" : "g", + "value" : null + }, + { + "id" : "saturated_fat", + "max" : null, + "points" : 0, + "unit" : "g", + "value" : null + }, + { + "id" : "salt", + "max" : null, + "points" : 0, + "unit" : "g", + "value" : null + }, + { + "id" : "non_nutritive_sweeteners", + "max" : 4, + "points" : 0, + "unit" : null, + "value" : "absence" + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : null, + "points" : 0, + "unit" : "g", + "value" : null + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 6, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "beverage", - "energy" : null, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 1, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : "1", - "negative_nutrients" : [ - "energy", - "sugars", - "saturated_fat", - "salt", - "non_nutritive_sweeteners" - ], + "negative_max" : 4, "negative_points" : 0, - "non_nutritive_sweeteners_points" : 0, + "positive_max" : 11, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : null, - "salt" : null, - "saturated_fat" : null, - "sugars" : null + "positive_points" : 0 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json index 38d90bb4f681c..dd03ba1753f5d 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json @@ -90,7 +90,7 @@ "energy" : 3378, "fat" : 100, "fiber" : 0, - "fruits_vegetables_legumes" : null, + "fruits_vegetables_legumes" : 0, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, @@ -99,7 +99,7 @@ "proteins" : 0, "salt" : 0, "saturated_fat" : null, - "saturated_fat_ratio" : 0, + "saturated_fat_ratio" : 1, "sugars" : 0 }, "grade" : "unknown", diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json index 3b1eab1326cf8..881fad74688f5 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json @@ -107,49 +107,83 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 370 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3378, - "energy_from_saturated_fat" : 370, - "energy_from_saturated_fat_points" : 3, - "fat" : 100, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 4, + "negative_max" : 55, + "negative_points" : 3, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_ratio" : 10, - "saturated_fat_ratio_points" : 1, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 4 + "score" : 3 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json index f9cb1da68f198..4c86672f51320 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json @@ -107,49 +107,83 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 370 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3378, - "energy_from_saturated_fat" : 370, - "energy_from_saturated_fat_points" : 3, - "fat" : 100, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 4, + "negative_max" : 55, + "negative_points" : 3, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_ratio" : 10, - "saturated_fat_ratio_points" : 1, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 4 + "score" : 3 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/walnut-oil.json b/tests/unit/expected_test_results/nutriscore/walnut-oil.json index d90752b1264c7..828d950e7c2bb 100644 --- a/tests/unit/expected_test_results/nutriscore/walnut-oil.json +++ b/tests/unit/expected_test_results/nutriscore/walnut-oil.json @@ -109,49 +109,83 @@ "2023" : { "category_available" : 1, "data" : { + "components" : { + "negative" : [ + { + "id" : "energy_from_saturated_fat", + "max" : 10, + "points" : 3, + "unit" : "kJ", + "value" : 370 + }, + { + "id" : "sugars", + "max" : 15, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "saturated_fat_ratio", + "max" : 10, + "points" : 0, + "unit" : "%", + "value" : 1 + }, + { + "id" : "salt", + "max" : 20, + "points" : 0, + "unit" : "g", + "value" : 0 + } + ], + "positive" : [ + { + "id" : "proteins", + "max" : 7, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fiber", + "max" : 5, + "points" : 0, + "unit" : "g", + "value" : 0 + }, + { + "id" : "fruits_vegetables_legumes", + "max" : 5, + "points" : 0, + "unit" : "%", + "value" : 0 + } + ] + }, "count_proteins" : 1, "count_proteins_reason" : "negative_points_less_than_7", - "energy" : 3378, - "energy_from_saturated_fat" : 370, - "energy_from_saturated_fat_points" : 3, - "fat" : 100, - "fiber" : 0, - "fiber_points" : 0, - "fruits_vegetables_legumes" : null, "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_nutrients" : [ - "energy_from_saturated_fat", - "sugars", - "saturated_fat_ratio", - "salt", - "non_nutritive_sweeteners" - ], - "negative_points" : 4, + "negative_max" : 55, + "negative_points" : 3, + "positive_max" : 17, "positive_nutrients" : [ - "fruits_vegetables_legumes", + "proteins", "fiber", - "proteins" + "fruits_vegetables_legumes" ], - "positive_points" : 0, - "proteins" : 0, - "proteins_points" : 0, - "salt" : 0, - "salt_points" : 0, - "saturated_fat" : 10, - "saturated_fat_ratio" : 10, - "saturated_fat_ratio_points" : 1, - "sugars" : 0, - "sugars_points" : 0 + "positive_points" : 0 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 4 + "score" : 3 } }, "nutriscore_2021_tags" : [ From de5d14f0718dc344cd22046e569588e5c8e37974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 17:00:28 +0100 Subject: [PATCH 03/13] lint --- lib/ProductOpener/Display.pm | 6 ++ lib/ProductOpener/KnowledgePanels.pm | 2 +- ...n_svg_images_for_nutriscore_new_formula.pl | 89 +++++++++---------- 3 files changed, 51 insertions(+), 46 deletions(-) diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index c83fcf3723e12..bb8a0b272366a 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -924,6 +924,12 @@ CSS if ($request_ref->{admin}) { $knowledge_panels_options_ref->{admin} = 1; } + if ($User{moderator}) { + $knowledge_panels_options_ref->{moderator} = 1; + } + if ($server_options{producers_platform}) { + $knowledge_panels_options_ref->{producers_platform} = 1; + } $log->debug( "owner, org and user", diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index 17ef0e0e4fb41..ba508c5e54879 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -812,7 +812,7 @@ sub create_health_card_panel ($product_ref, $target_lc, $target_cc, $options_ref $log->debug("create health card panel", {code => $product_ref->{code}}) if $log->is_debug(); create_nutriscore_panel($product_ref, $target_lc, $target_cc, $options_ref); - if ($options_ref->{admin}) { + if ($options_ref->{admin} || $options_ref->{moderator} || $options_ref->{producers_platform}) { create_nutriscore_2023_panel($product_ref, $target_lc, $target_cc, $options_ref); } diff --git a/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl index 125abd6cd0d7e..84cfa8065cc1b 100755 --- a/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl +++ b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl @@ -45,7 +45,7 @@ =head1 DESCRIPTION x="0" y="98" /> SVG -; + ; my $new_formula_banner = < SVG -; + ; my %new_formula_text = ( - en => < < SVG -, - fr => < < SVG -, + , ); - # Read the Nutri-Score SVG images in the html/images/attributes/src directory # and add a "New formula" banner to the Nutri-Score logos. @@ -154,43 +153,43 @@ =head1 DESCRIPTION foreach my $lc ("en", "fr") { - foreach my $file (@files) { - - # skip the Nutri-Score logo with the new formula banner - next if ($file =~ /new-formula/); - - my $new_file = $file; - $new_file =~ s/\.svg$/-new-formula-$lc.svg/; - - open (my $fh, "<", $file) or die "Could not open file $file: $!\n"; - open (my $fh2, ">", $new_file) or die "Could not open file $new_file: $!\n"; - - while (my $line = <$fh>) { - - if ($line =~ / - $line =~ s/height="130"/height="162"/; - $line =~ s/viewBox="0 0 240 130"/viewBox="0 0 240 162"/; - print $fh2 $line; - print $fh2 $new_formula_below; - } - elsif ($line =~ /<\/svg>/) { - # No banner for not-applicable / unknown - if ($file !~ /unknown|not-applicable/) { - print $fh2 $new_formula_banner; - print $fh2 $new_formula_text{$lc}; - } - print $fh2 $line; - } - else { - print $fh2 $line; - } - } - - close $fh; - close $fh2; - } + foreach my $file (@files) { + + # skip the Nutri-Score logo with the new formula banner + next if ($file =~ /new-formula/); + + my $new_file = $file; + $new_file =~ s/\.svg$/-new-formula-$lc.svg/; + + open(my $fh, "<", $file) or die "Could not open file $file: $!\n"; + open(my $fh2, ">", $new_file) or die "Could not open file $new_file: $!\n"; + + while (my $line = <$fh>) { + + if ($line =~ / + $line =~ s/height="130"/height="162"/; + $line =~ s/viewBox="0 0 240 130"/viewBox="0 0 240 162"/; + print $fh2 $line; + print $fh2 $new_formula_below; + } + elsif ($line =~ /<\/svg>/) { + # No banner for not-applicable / unknown + if ($file !~ /unknown|not-applicable/) { + print $fh2 $new_formula_banner; + print $fh2 $new_formula_text{$lc}; + } + print $fh2 $line; + } + else { + print $fh2 $line; + } + } + + close $fh; + close $fh2; + } } -exit(0); \ No newline at end of file +exit(0); From 3d9ad15d16f06af9718acc901aebf068ebf9763a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 17:35:25 +0100 Subject: [PATCH 04/13] critic --- scripts/images/gen_svg_images_for_nutriscore_new_formula.pl | 2 +- stop_words.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl index 84cfa8065cc1b..9f88a0e6968ee 100755 --- a/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl +++ b/scripts/images/gen_svg_images_for_nutriscore_new_formula.pl @@ -149,7 +149,7 @@ =head1 DESCRIPTION my $dir = "$www_root/images/attributes/src"; -my @files = <$dir/nutriscore-*.svg>; +my @files = glob "$dir/nutriscore-*.svg"; foreach my $lc ("en", "fr") { diff --git a/stop_words.txt b/stop_words.txt index b2c9efcea68c6..0fe86773ad054 100644 --- a/stop_words.txt +++ b/stop_words.txt @@ -101,6 +101,7 @@ gif glycérol gnumeric greated +grey GSDN gtin hardcoded @@ -225,6 +226,7 @@ subfield submodule submodules sucre +SVG tagid TAGID tagtype From 60db6bfc05c1f7a8df34c7d445d71b505d8080d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 18:07:40 +0100 Subject: [PATCH 05/13] hide nutriscore computation details in subpanel --- lib/ProductOpener/KnowledgePanels.pm | 3 + .../health/nutriscore/nutriscore_2023.tt.json | 57 ++---------------- .../nutriscore/nutriscore_details.tt.json | 58 +++++++++++++++++++ 3 files changed, 67 insertions(+), 51 deletions(-) create mode 100644 templates/api/knowledge-panels/health/nutriscore/nutriscore_details.tt.json diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index ba508c5e54879..7dd70b095462d 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -940,6 +940,9 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options create_panel_from_json_template("nutriscore_description", "api/knowledge-panels/health/nutriscore/nutriscore_description.tt.json", $panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref); + create_panel_from_json_template("nutriscore_details", + "api/knowledge-panels/health/nutriscore/nutriscore_details.tt.json", + $panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref); return; } diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json index ce640f0e47090..abc7e105e2668 100644 --- a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json @@ -17,20 +17,7 @@ "panel_element": { "panel_id": "nutriscore_description", }, - }, - // Display warnings - [% IF panel.nutriscore_warnings %] - [% FOREACH warning IN panel.nutriscore_warnings %] - { - "element_type": "text", - "text_element": { - "type": "warning", - "html": `[% warning %] - `, - } - }, - [% END %] - [% END %] + }, // Display actions if we are missing data to compute the Nutri-Score [% IF panel.nutriscore_unknown_reason %] { @@ -80,45 +67,13 @@ [% END %] ], }, - }, - { - "element_type": "text", - "text_element": { - "html": ` -[% IF product.nutriscore.2023.data.is_beverage %] -

[% lang('nutriscore_is_beverage') %]

-[% ELSE %] -

[% lang('nutriscore_is_not_beverage') %]

-[% END %] -[% IF product.nutriscore.2023.data.is_water %] -

[% lang('nutriscore_is_water') %]

-[% END %] -[% IF product.nutriscore.2023.data.is_fat_oil_nuts_seeds %] -

[% lang('nutriscore_is_fat_oil_nuts_seeds') %]

-[% END %] -[% IF product.nutriscore.2023.data.is_cheese %] -

[% lang('nutriscore_is_cheese') %]

-[% END %] -[% IF product.nutriscore.2023.data.is_red_meat_product %] -

[% lang('nutriscore_is_red_meat_product') %]

-[% END %] -

[% lang("nutriscore_count_proteins_reason_" _ product.nutriscore.2023.data.count_proteins_reason )%]

- -

- [% lang('nutriscore_score') %][% sep %]: [% product.nutriscore.2023.score %] - ([% product.nutriscore.2023.data.negative_points %] - [% product.nutriscore.2023.data.positive_points %]) -

-

[% lang('nutriscore_grade') %][% sep %]: [% product.nutriscore.2023.grade FILTER ucfirst %]

- `, - } }, + // Details of the computation of the Nutri-Score { - "element_type": "text", - "text_element": { - "html": ` -

[% lang('nutriscore_learn_more') %]

-` + "element_type": "panel", + "panel_element": { + "panel_id": "nutriscore_details", }, - }, + }, ] } diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_details.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_details.tt.json new file mode 100644 index 0000000000000..f0363e87a188e --- /dev/null +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_details.tt.json @@ -0,0 +1,58 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "title_element": { + "icon_url": "[% static_subdomain %]/images/icons/dist/info.svg", + "icon_size": "small", + "title": "[% lang("nutriscore_calculation_details") %]", + "type": "info", + }, + "elements": [ + // Display warnings + [% IF panel.nutriscore_warnings %] + [% FOREACH warning IN panel.nutriscore_warnings %] + { + "element_type": "text", + "text_element": { + "type": "warning", + "html": `[% warning %] + `, + } + }, + [% END %] + [% END %] + { + "element_type": "text", + "text_element": { + "html": ` +[% IF product.nutriscore.2023.data.is_beverage %] +

[% lang('nutriscore_is_beverage') %]

+[% ELSE %] +

[% lang('nutriscore_is_not_beverage') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_water %] +

[% lang('nutriscore_is_water') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_fat_oil_nuts_seeds %] +

[% lang('nutriscore_is_fat_oil_nuts_seeds') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_cheese %] +

[% lang('nutriscore_is_cheese') %]

+[% END %] +[% IF product.nutriscore.2023.data.is_red_meat_product %] +

[% lang('nutriscore_is_red_meat_product') %]

+[% END %] +

[% lang("nutriscore_count_proteins_reason_" _ product.nutriscore.2023.data.count_proteins_reason )%]

+ +

+ [% lang('nutriscore_score') %][% sep %]: [% product.nutriscore.2023.score %] + ([% product.nutriscore.2023.data.negative_points %] - [% product.nutriscore.2023.data.positive_points %]) +

+

[% lang('nutriscore_grade') %][% sep %]: [% product.nutriscore.2023.grade FILTER ucfirst %]

+ `, + } + }, + ] +} From 0bb2c470532bdd8f051a1c2829f43b2e21ae377b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 18:11:23 +0100 Subject: [PATCH 06/13] round to 2 decimal places max --- lib/ProductOpener/Nutriscore.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index a9e3237b9df42..637861f3d6c98 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -785,7 +785,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { push @{$nutriscore_data_ref->{components}{negative}}, { id => $nutrient, - value => $nutriscore_data_ref->{$nutrient}, + value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}), points => $points, max => $max, }; @@ -845,7 +845,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { push @{$nutriscore_data_ref->{components}{positive}}, { id => $nutrient, - value => $nutriscore_data_ref->{$nutrient}, + value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}, 2), points => $points, max => $max, }; From 72795f5dc32f5151233fa07f301a112f081855c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 18:13:03 +0100 Subject: [PATCH 07/13] round to 2 decimal places max --- lib/ProductOpener/Nutriscore.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index 637861f3d6c98..75f8d0de31c15 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -98,6 +98,8 @@ BEGIN { use vars @EXPORT_OK; +use ProductOpener::Numbers qw/:all/; + =head1 FUNCTIONS Note: a significantly different Nutri-Score algorithm has been published in 2022 and 2023 From 282ad127b3f5911e6f5c985b2a9e89803604f522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 26 Jan 2024 18:14:18 +0100 Subject: [PATCH 08/13] round to 2 decimal places max --- lib/ProductOpener/Nutriscore.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index 75f8d0de31c15..42ff16688a705 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -787,7 +787,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { push @{$nutriscore_data_ref->{components}{negative}}, { id => $nutrient, - value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}), + value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}, 2), points => $points, max => $max, }; From c5cc55f626127191bc1b2772e6e78d91631ca0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Mon, 29 Jan 2024 13:31:17 +0100 Subject: [PATCH 09/13] update tests --- .../get-existing-product.json | 10 ++-- .../get-fields-all-knowledge-panels.json | 10 ++-- .../api_v2_product_read/get-fields-all.json | 10 ++-- ...attribute-groups-all-knowledge-panels.json | 10 ++-- .../api_v2_product_read/get-fields-raw.json | 10 ++-- .../get-existing-product-gs1-ai-data-str.json | 10 ++-- .../get-existing-product-gs1-caret.json | 10 ++-- .../get-existing-product-gs1-data-uri.json | 10 ++-- .../get-existing-product-gs1-fnc1.json | 10 ++-- .../get-existing-product-gs1-gs.json | 10 ++-- .../get-existing-product.json | 10 ++-- .../get-fields-all-knowledge-panels.json | 10 ++-- .../api_v3_product_read/get-fields-all.json | 10 ++-- ...attribute-groups-all-knowledge-panels.json | 10 ++-- .../api_v3_product_read/get-fields-raw.json | 10 ++-- .../search_v1/search-no-filter.json | 46 +++++++++---------- ...ies-without-ingredients-from-palm-oil.json | 20 ++++---- ...rch-without-ingredients-from-palm-oil.json | 46 +++++++++---------- .../beverage-with-80-percent-milk.json | 2 +- .../nutriscore/breakfast-cereals.json | 2 +- .../cocoa-and-chocolate-powders.json | 2 +- .../dairy-drink-with-80-percent-milk.json | 2 +- ...-drink-with-less-than-80-percent-milk.json | 2 +- .../nutriscore/dairy-drinks-without-milk.json | 2 +- .../en-apple-estimated-nutrients.json | 2 +- .../nutriscore/en-cherry-tomatoes.json | 2 +- .../nutriscore/en-milk.json | 2 +- ...orange-juice-category-and-ingredients.json | 2 +- .../nutriscore/en-orange-juice-category.json | 2 +- ...n-soy-beans-processed-and-unprocessed.json | 2 +- .../en-sugar-estimated-nutrients.json | 2 +- .../nutriscore/en-sweeteners-erythritol.json | 4 +- .../nutriscore/en-sweeteners.json | 4 +- .../nutriscore/en-tofu.json | 2 +- .../nutriscore/en-vegetable-crisps.json | 2 +- .../flavored-spring-with-nutrition.json | 2 +- .../nutriscore/fr-ice-tea-with-sweetener.json | 4 +- .../nutriscore/fr-orange-nectar-0-fat.json | 2 +- .../fr-plant-beverages-soy-milk.json | 2 +- .../nutriscore/milk.json | 2 +- .../nutriscore/spring-water-no-nutrition.json | 12 ++--- 41 files changed, 162 insertions(+), 162 deletions(-) diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json index a8133f6d75a03..45acd62249170 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json @@ -886,21 +886,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -909,14 +909,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json index ae1ef1b5d4d12..57a2e70d655dd 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json @@ -2200,21 +2200,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -2223,14 +2223,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json index d7019f92814a8..2962e62ca74a5 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json @@ -886,21 +886,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -909,14 +909,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json index 373c180cb1c26..5cbadbb6a8603 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2848,21 +2848,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -2871,14 +2871,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json index d6618785c3c87..9e77fa4a224df 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json @@ -881,21 +881,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -904,14 +904,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json index 62a4aa3137207..421c497767122 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json index f7af1547ce1b7..96cd7bca84415 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json index f7af1547ce1b7..96cd7bca84415 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json index 62a4aa3137207..421c497767122 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json index f7af1547ce1b7..96cd7bca84415 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json index d096ff490256c..82028d3f859a7 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json index 618e224752c8f..dfe93f901ae8b 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json @@ -2202,21 +2202,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -2225,14 +2225,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json index 20d00854fa817..8a6a241be953e 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json @@ -888,21 +888,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -911,14 +911,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json index 0d5d3af564aaf..a18831f50d22e 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2850,21 +2850,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -2873,14 +2873,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json index c6c5b253e2968..3146dfae6c7f9 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json @@ -883,21 +883,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -906,14 +906,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/search_v1/search-no-filter.json b/tests/integration/expected_test_results/search_v1/search-no-filter.json index 02dd6df1018fc..64de0833b9627 100644 --- a/tests/integration/expected_test_results/search_v1/search-no-filter.json +++ b/tests/integration/expected_test_results/search_v1/search-no-filter.json @@ -691,21 +691,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -714,14 +714,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", @@ -2187,7 +2187,7 @@ "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.472333333333333 + "value" : 0.47 }, { "id" : "salt", @@ -2203,14 +2203,14 @@ "max" : 7, "points" : 1, "unit" : "g", - "value" : 2.84333333333333 + "value" : 2.84 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.866666666666667 + "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", @@ -2979,28 +2979,28 @@ "max" : 10, "points" : 2, "unit" : "kJ", - "value" : 754.666666666666 + "value" : 754.67 }, { "id" : "sugars", "max" : 15, "points" : 1, "unit" : "g", - "value" : 6.73333333333333 + "value" : 6.73 }, { "id" : "saturated_fat", "max" : 10, "points" : 8, "unit" : "g", - "value" : 8.23066666666666 + "value" : 8.23 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.00126666666666667 + "value" : 0 } ], "positive" : [ @@ -3009,7 +3009,7 @@ "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.866666666666667 + "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", @@ -3934,21 +3934,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -3957,14 +3957,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", @@ -4908,21 +4908,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -4931,14 +4931,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json index 8ef6dee983419..629dd90fed2e2 100644 --- a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json @@ -767,21 +767,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -790,14 +790,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", @@ -1741,21 +1741,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -1764,14 +1764,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json index 02dd6df1018fc..64de0833b9627 100644 --- a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json @@ -691,21 +691,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.2621875 + "value" : 7.26 }, { "id" : "saturated_fat", "max" : 10, "points" : 4, "unit" : "g", - "value" : 4.903125 + "value" : 4.9 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0496875 + "value" : 0.05 } ], "positive" : [ @@ -714,14 +714,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 1.974375 + "value" : 1.97 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.8125 + "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", @@ -2187,7 +2187,7 @@ "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.472333333333333 + "value" : 0.47 }, { "id" : "salt", @@ -2203,14 +2203,14 @@ "max" : 7, "points" : 1, "unit" : "g", - "value" : 2.84333333333333 + "value" : 2.84 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.866666666666667 + "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", @@ -2979,28 +2979,28 @@ "max" : 10, "points" : 2, "unit" : "kJ", - "value" : 754.666666666666 + "value" : 754.67 }, { "id" : "sugars", "max" : 15, "points" : 1, "unit" : "g", - "value" : 6.73333333333333 + "value" : 6.73 }, { "id" : "saturated_fat", "max" : 10, "points" : 8, "unit" : "g", - "value" : 8.23066666666666 + "value" : 8.23 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.00126666666666667 + "value" : 0 } ], "positive" : [ @@ -3009,7 +3009,7 @@ "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.866666666666667 + "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", @@ -3934,21 +3934,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -3957,14 +3957,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", @@ -4908,21 +4908,21 @@ "max" : 15, "points" : 2, "unit" : "g", - "value" : 7.575 + "value" : 7.58 }, { "id" : "saturated_fat", "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.01575 + "value" : 0.02 }, { "id" : "salt", "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0019 + "value" : 0 } ], "positive" : [ @@ -4931,14 +4931,14 @@ "max" : 7, "points" : 0, "unit" : "g", - "value" : 0.2025 + "value" : 0.2 }, { "id" : "fiber", "max" : 5, "points" : 0, "unit" : "g", - "value" : 0.975 + "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", diff --git a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json index c03005645605b..dd6524114509b 100644 --- a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json @@ -251,7 +251,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json index 80aa34cd0a817..4edcc6c4c8312 100644 --- a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json +++ b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json @@ -131,7 +131,7 @@ "max" : 20, "points" : 2, "unit" : "g", - "value" : 0.5525 + "value" : 0.55 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json index ca9c80744bfbf..a97b6174848a9 100644 --- a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json +++ b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json @@ -118,7 +118,7 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.1125 + "value" : 0.11 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json index 084bc7ab412f1..b31ae6e355feb 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json @@ -259,7 +259,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json index ee02a09983eea..f2bab8ea19513 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json @@ -255,7 +255,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json index 27cb3b844a9d2..596c46ba83ec1 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json @@ -248,7 +248,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json index 03d7a8d374c31..785a3898e8230 100644 --- a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json @@ -229,7 +229,7 @@ "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.021 + "value" : 0.02 }, { "id" : "salt", diff --git a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json index 7be0900fc1599..a51c22b827797 100644 --- a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json +++ b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json @@ -239,7 +239,7 @@ "max" : 10, "points" : 0, "unit" : "g", - "value" : 0.056 + "value" : 0.06 }, { "id" : "salt", diff --git a/tests/unit/expected_test_results/nutriscore/en-milk.json b/tests/unit/expected_test_results/nutriscore/en-milk.json index 3da4c26f852be..0ba28bbfca932 100644 --- a/tests/unit/expected_test_results/nutriscore/en-milk.json +++ b/tests/unit/expected_test_results/nutriscore/en-milk.json @@ -128,7 +128,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json index f93e3470954fe..fdd48d828cca2 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json @@ -287,7 +287,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json index 4c4a38b9779a4..1dbf1616edbec 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json @@ -142,7 +142,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json index f3447bf2f02b2..46988b5185433 100644 --- a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json +++ b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json @@ -269,7 +269,7 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json index 51bd2e9f16b06..c02b4cb71ccf4 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json @@ -229,7 +229,7 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.0054 + "value" : 0.01 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json index 8abfaf463422f..d2a6f7caea107 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json @@ -241,14 +241,14 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json index d1bbb920684fd..452fabf4a308a 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json @@ -240,14 +240,14 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", "max" : 4, "points" : 4, "unit" : null, - "value" : "presence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-tofu.json b/tests/unit/expected_test_results/nutriscore/en-tofu.json index 4a0acf8c4a2e4..b7ebc0a05d133 100644 --- a/tests/unit/expected_test_results/nutriscore/en-tofu.json +++ b/tests/unit/expected_test_results/nutriscore/en-tofu.json @@ -274,7 +274,7 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json index 31fc104262083..685025a730091 100644 --- a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json +++ b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json @@ -256,7 +256,7 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json index b95ec47b0f717..aa870853936d5 100644 --- a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json @@ -133,7 +133,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json index 40346ab74564c..e9dd996e456ac 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json +++ b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json @@ -479,14 +479,14 @@ "max" : 20, "points" : 0, "unit" : "g", - "value" : 0.025 + "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", "max" : 4, "points" : 4, "unit" : null, - "value" : "presence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json index 1454b6bbc0e12..3160fc11e895a 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json +++ b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json @@ -297,7 +297,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json index 219cda614d373..b852e433079d2 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json @@ -275,7 +275,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/milk.json b/tests/unit/expected_test_results/nutriscore/milk.json index f7e612c4e557a..2aae5655e3856 100644 --- a/tests/unit/expected_test_results/nutriscore/milk.json +++ b/tests/unit/expected_test_results/nutriscore/milk.json @@ -240,7 +240,7 @@ "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ diff --git a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json index f51009cab773e..405c474f73244 100644 --- a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json @@ -91,35 +91,35 @@ "max" : null, "points" : 0, "unit" : "kJ", - "value" : null + "value" : 0 }, { "id" : "sugars", "max" : null, "points" : 0, "unit" : "g", - "value" : null + "value" : 0 }, { "id" : "saturated_fat", "max" : null, "points" : 0, "unit" : "g", - "value" : null + "value" : 0 }, { "id" : "salt", "max" : null, "points" : 0, "unit" : "g", - "value" : null + "value" : 0 }, { "id" : "non_nutritive_sweeteners", "max" : 4, "points" : 0, "unit" : null, - "value" : "absence" + "value" : 0 } ], "positive" : [ @@ -128,7 +128,7 @@ "max" : null, "points" : 0, "unit" : "g", - "value" : null + "value" : 0 }, { "id" : "fiber", From 3eb81a869c91df77058720dfb094b17b0c084d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 31 Jan 2024 10:49:33 +0100 Subject: [PATCH 10/13] Update lib/ProductOpener/Food.pm Co-authored-by: Alex Garel --- lib/ProductOpener/Food.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProductOpener/Food.pm b/lib/ProductOpener/Food.pm index f399897e087b6..45cff8e0d794e 100644 --- a/lib/ProductOpener/Food.pm +++ b/lib/ProductOpener/Food.pm @@ -1613,7 +1613,7 @@ sub compute_nutriscore_data ($product_ref, $prepared, $nutriments_field, $versio # Add the fat and saturated fat / fat ratio $nutriscore_data_ref->{fat} = $nutriments_ref->{"fat" . $prepared . "_100g"}; $nutriscore_data_ref->{saturated_fat_ratio} - = round_to_max_decimal_places(1, saturated_fat_ratio($nutriments_ref, $prepared)); + = round_to_max_decimal_places(saturated_fat_ratio($nutriments_ref, $prepared), 1); # Compute the energy from saturates if (defined $nutriscore_data_ref->{saturated_fat}) { $nutriscore_data_ref->{energy_from_saturated_fat} = $nutriscore_data_ref->{saturated_fat} * 37; From 3391104a20b4471a6e9bdf91d565558127d84930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Mon, 5 Feb 2024 15:06:25 +0100 Subject: [PATCH 11/13] Update lib/ProductOpener/Nutriscore.pm Co-authored-by: Alex Garel --- lib/ProductOpener/Nutriscore.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index 42ff16688a705..5226556d1c4f1 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -740,6 +740,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { } } + # max number of squares in the gauge we will display to user for this nutrient $nutriscore_data_ref->{$nutrient . "_max"} = scalar @{$points_thresholds_2023{$nutrient_threshold_id}}; } From 59dc9620c649e8277fae5e43a7a11ec9024904f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Mon, 5 Feb 2024 16:09:19 +0100 Subject: [PATCH 12/13] update tests --- .../get-existing-product.json | 20 ++-- .../get-fields-all-knowledge-panels.json | 20 ++-- .../api_v2_product_read/get-fields-all.json | 20 ++-- ...attribute-groups-all-knowledge-panels.json | 20 ++-- .../api_v2_product_read/get-fields-raw.json | 20 ++-- ...uct-ingredients-text-without-language.json | 16 +-- .../get-existing-product-gs1-ai-data-str.json | 20 ++-- .../get-existing-product-gs1-caret.json | 20 ++-- .../get-existing-product-gs1-data-uri.json | 20 ++-- .../get-existing-product-gs1-fnc1.json | 20 ++-- .../get-existing-product-gs1-gs.json | 20 ++-- .../get-existing-product.json | 20 ++-- .../get-fields-all-knowledge-panels.json | 20 ++-- .../api_v3_product_read/get-fields-all.json | 20 ++-- ...attribute-groups-all-knowledge-panels.json | 20 ++-- .../api_v3_product_read/get-fields-raw.json | 20 ++-- .../test/products/3270190128403.json | 2 +- .../search_v1/search-no-filter.json | 98 +++++++++---------- ...ies-without-ingredients-from-palm-oil.json | 40 ++++---- ...rch-without-ingredients-from-palm-oil.json | 98 +++++++++---------- .../attributes/en-attributes.json | 18 ++-- .../attributes/en-nutriscore.json | 18 ++-- .../beverage-with-80-percent-milk.json | 23 ++--- .../nutriscore/breakfast-cereals.json | 18 ++-- .../cocoa-and-chocolate-powders.json | 20 ++-- .../nutriscore/colza-oil.json | 22 ++--- .../nutriscore/cookies.json | 18 ++-- .../dairy-drink-with-80-percent-milk.json | 23 ++--- ...-drink-with-less-than-80-percent-milk.json | 23 ++--- .../nutriscore/dairy-drinks-without-milk.json | 23 ++--- .../en-apple-estimated-nutrients.json | 20 ++-- .../nutriscore/en-avocado-oil.json | 38 +++---- .../nutriscore/en-cherry-tomatoes.json | 20 ++-- .../nutriscore/en-milk.json | 23 ++--- .../en-olive-oil-no-ingredients.json | 38 +++---- ...en-olive-oil-unrecognized-ingredients.json | 38 +++---- .../nutriscore/en-olive-oil.json | 38 +++---- ...orange-juice-category-and-ingredients.json | 23 ++--- .../nutriscore/en-orange-juice-category.json | 23 ++--- .../nutriscore/en-potatoes-category.json | 20 ++-- ...ategory-ingredients-with-lots-of-meat.json | 18 ++-- ...ous-category-ingredients-with-no-meat.json | 20 ++-- ...ory-ingredients-with-very-little-meat.json | 20 ++-- ...eat-ambiguous-category-no-ingredients.json | 20 ++-- .../en-red-meat-category-no-ingredients.json | 18 ++-- ...n-soy-beans-processed-and-unprocessed.json | 20 ++-- .../en-sugar-estimated-nutrients.json | 18 ++-- .../nutriscore/en-sweeteners-erythritol.json | 23 ++--- .../nutriscore/en-sweeteners.json | 21 ++-- .../nutriscore/en-tofu.json | 20 ++-- .../nutriscore/en-vegetable-crisps.json | 20 ++-- .../flavored-spring-with-nutrition.json | 23 ++--- .../nutriscore/fr-canned-green-beans.json | 20 ++-- .../nutriscore/fr-canned-pineapple.json | 20 ++-- .../nutriscore/fr-coconut-milk.json | 20 ++-- .../nutriscore/fr-gaspacho.json | 20 ++-- .../nutriscore/fr-green-beans-beverage.json | 20 ++-- .../nutriscore/fr-ice-tea-with-sweetener.json | 21 ++-- .../fr-mixed-oils-with-olive-oil.json | 22 ++--- .../nutriscore/fr-orange-nectar-0-fat.json | 23 ++--- .../fr-plant-beverages-soy-milk.json | 23 ++--- .../nutriscore/fr-rapeseed-oil.json | 22 ++--- .../nutriscore/milk.json | 23 ++--- .../nutriscore/mushrooms.json | 20 ++-- .../nutriscore/olive-oil.json | 28 +++--- .../nutriscore/spring-water-no-nutrition.json | 23 ++--- .../sunflower-oil-no-sugar-no-sat-fat.json | 2 +- .../nutriscore/sunflower-oil-no-sugar.json | 28 +++--- .../nutriscore/sunflower-oil.json | 28 +++--- .../nutriscore/walnut-oil.json | 28 +++--- 70 files changed, 828 insertions(+), 845 deletions(-) diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json index 45acd62249170..675c9cae2a4b6 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-existing-product.json @@ -876,29 +876,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -906,22 +906,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -934,15 +934,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json index 57a2e70d655dd..6471c8ee7c499 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all-knowledge-panels.json @@ -2190,29 +2190,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -2220,22 +2220,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -2248,15 +2248,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json index 2962e62ca74a5..36d1959d05ed8 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-all.json @@ -876,29 +876,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -906,22 +906,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -934,15 +934,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json index 5cbadbb6a8603..ac48de896087d 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2838,29 +2838,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -2868,22 +2868,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -2896,15 +2896,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json index 9e77fa4a224df..65b2023440678 100644 --- a/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v2_product_read/get-fields-raw.json @@ -871,29 +871,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -901,22 +901,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -929,15 +929,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json b/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json index d3bc1ee6c5a08..511a27cd8f75f 100644 --- a/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json +++ b/tests/integration/expected_test_results/api_v2_product_write/get-product-ingredients-text-without-language.json @@ -607,29 +607,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 645 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "g", "value" : 2.64 }, { "id" : "salt", - "max" : 20, "points" : 20, + "points_max" : 20, "unit" : "g", "value" : 24.54 } @@ -637,15 +637,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -658,14 +658,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_max" : 55, "negative_points" : 23, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], "positive_points" : 0, + "positive_points_max" : 10, "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "e", diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json index 421c497767122..6c06ea430e490 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-ai-data-str.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json index 96cd7bca84415..38e6c0ec611e8 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-caret.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json index 96cd7bca84415..38e6c0ec611e8 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-data-uri.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json index 421c497767122..6c06ea430e490 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-fnc1.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json index 96cd7bca84415..38e6c0ec611e8 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product-gs1-gs.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json index 82028d3f859a7..98883913d8d4f 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-existing-product.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json index dfe93f901ae8b..566cda59247b0 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all-knowledge-panels.json @@ -2192,29 +2192,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -2222,22 +2222,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -2250,15 +2250,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json index 8a6a241be953e..7a584db7fb6fc 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-all.json @@ -878,29 +878,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -908,22 +908,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -936,15 +936,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json index a18831f50d22e..07ec1d9fde32d 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-attribute-groups-all-knowledge-panels.json @@ -2840,29 +2840,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -2870,22 +2870,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -2898,15 +2898,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json index 3146dfae6c7f9..04888353c4117 100644 --- a/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json +++ b/tests/integration/expected_test_results/api_v3_product_read/get-fields-raw.json @@ -873,29 +873,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -903,22 +903,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -931,15 +931,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json index 05971f2e62499..dae10a57f3965 100644 --- a/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json +++ b/tests/integration/expected_test_results/convert_and_import_excel_file/test/products/3270190128403.json @@ -884,7 +884,7 @@ "proteins" : null, "salt" : null, "saturated_fat" : null, - "saturated_fat_ratio" : 1, + "saturated_fat_ratio" : 0, "sugars" : null }, "grade" : "unknown", diff --git a/tests/integration/expected_test_results/search_v1/search-no-filter.json b/tests/integration/expected_test_results/search_v1/search-no-filter.json index 64de0833b9627..2c8a6bdd10577 100644 --- a/tests/integration/expected_test_results/search_v1/search-no-filter.json +++ b/tests/integration/expected_test_results/search_v1/search-no-filter.json @@ -681,29 +681,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -711,22 +711,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -739,15 +739,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, @@ -2170,29 +2170,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 260 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.6 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.47 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.07 } @@ -2200,22 +2200,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 1, + "points_max" : 7, "unit" : "g", "value" : 2.84 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 66.7 } @@ -2228,15 +2228,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 3 + "positive_points" : 3, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, @@ -2976,29 +2976,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "kJ", "value" : 754.67 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 6.73 }, { "id" : "saturated_fat", - "max" : 10, "points" : 8, + "points_max" : 10, "unit" : "g", "value" : 8.23 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -3006,15 +3006,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 66.7 } @@ -3027,14 +3027,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 11, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 10 }, "grade" : "c", "nutrients_available" : 1, @@ -3924,29 +3924,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -3954,22 +3954,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -3982,15 +3982,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, @@ -4898,29 +4898,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -4928,22 +4928,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -4956,15 +4956,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json index 629dd90fed2e2..6f723772ea2e3 100644 --- a/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-tags-categories-without-ingredients-from-palm-oil.json @@ -757,29 +757,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -787,22 +787,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -815,15 +815,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, @@ -1731,29 +1731,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -1761,22 +1761,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -1789,15 +1789,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json index 64de0833b9627..2c8a6bdd10577 100644 --- a/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json +++ b/tests/integration/expected_test_results/search_v1/search-without-ingredients-from-palm-oil.json @@ -681,29 +681,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 558.75 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.26 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 4.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.05 } @@ -711,22 +711,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 1.97 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.81 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 62.5 } @@ -739,15 +739,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 7, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, @@ -2170,29 +2170,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 260 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.6 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.47 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.07 } @@ -2200,22 +2200,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 1, + "points_max" : 7, "unit" : "g", "value" : 2.84 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 66.7 } @@ -2228,15 +2228,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 3 + "positive_points" : 3, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, @@ -2976,29 +2976,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "kJ", "value" : 754.67 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 6.73 }, { "id" : "saturated_fat", - "max" : 10, "points" : 8, + "points_max" : 10, "unit" : "g", "value" : 8.23 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -3006,15 +3006,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.87 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 66.7 } @@ -3027,14 +3027,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 11, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 10 }, "grade" : "c", "nutrients_available" : 1, @@ -3924,29 +3924,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -3954,22 +3954,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -3982,15 +3982,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, @@ -4898,29 +4898,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 155.25 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 7.58 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -4928,22 +4928,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.97 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 75 } @@ -4956,15 +4956,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/attributes/en-attributes.json b/tests/unit/expected_test_results/attributes/en-attributes.json index c6815693304df..cad4e397c1638 100644 --- a/tests/unit/expected_test_results/attributes/en-attributes.json +++ b/tests/unit/expected_test_results/attributes/en-attributes.json @@ -1226,29 +1226,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "kJ", "value" : 800 }, { "id" : "sugars", - "max" : 15, "points" : 7, + "points_max" : 15, "unit" : "g", "value" : 25 }, { "id" : "saturated_fat", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "g", "value" : 4 }, { "id" : "salt", - "max" : 20, "points" : 1, + "points_max" : 20, "unit" : "g", "value" : 0.25 } @@ -1256,15 +1256,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 3 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 10.2 } @@ -1277,14 +1277,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 13, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 10 }, "grade" : "d", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/attributes/en-nutriscore.json b/tests/unit/expected_test_results/attributes/en-nutriscore.json index 46833f01142b8..4d63c031451a2 100644 --- a/tests/unit/expected_test_results/attributes/en-nutriscore.json +++ b/tests/unit/expected_test_results/attributes/en-nutriscore.json @@ -951,29 +951,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 7, + "points_max" : 10, "unit" : "kJ", "value" : 2591 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 5.1 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 9.7 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -981,15 +981,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 3, + "points_max" : 5, "unit" : "g", "value" : 5.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } @@ -1002,14 +1002,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 17, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 8 + "positive_points" : 8, + "positive_points_max" : 10 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json index dd6524114509b..ad90d0abb9999 100644 --- a/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/beverage-with-80-percent-milk.json @@ -220,36 +220,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3378 }, { "id" : "sugars", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "g", "value" : 20 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 5 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -257,22 +257,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 2 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -285,15 +285,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 24, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json index 4edcc6c4c8312..28af56b0f6b76 100644 --- a/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json +++ b/tests/unit/expected_test_results/nutriscore/breakfast-cereals.json @@ -107,29 +107,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 7, + "points_max" : 10, "unit" : "kJ", "value" : 2450 }, { "id" : "sugars", - "max" : 15, "points" : 8, + "points_max" : 15, "unit" : "g", "value" : 31 }, { "id" : "saturated_fat", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "g", "value" : 1.03 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.55 } @@ -137,15 +137,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 4, + "points_max" : 5, "unit" : "g", "value" : 6.9 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -158,14 +158,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 18, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 4 + "positive_points" : 4, + "positive_points_max" : 10 }, "grade" : "d", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json index a97b6174848a9..fa71e5e73f891 100644 --- a/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json +++ b/tests/unit/expected_test_results/nutriscore/cocoa-and-chocolate-powders.json @@ -94,29 +94,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 287 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 6.3 }, { "id" : "saturated_fat", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "g", "value" : 1.1 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.11 } @@ -124,22 +124,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 1, + "points_max" : 7, "unit" : "g", "value" : 3.8 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 1.9 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -152,15 +152,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 1 + "positive_points" : 1, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/colza-oil.json b/tests/unit/expected_test_results/nutriscore/colza-oil.json index 2d35f739ada46..279a7623e2347 100644 --- a/tests/unit/expected_test_results/nutriscore/colza-oil.json +++ b/tests/unit/expected_test_results/nutriscore/colza-oil.json @@ -110,29 +110,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "kJ", "value" : 259 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "%", - "value" : 1 + "value" : 7 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -140,22 +140,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -168,15 +168,15 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/cookies.json b/tests/unit/expected_test_results/nutriscore/cookies.json index 86e98f69ecd30..b0919736acfd5 100644 --- a/tests/unit/expected_test_results/nutriscore/cookies.json +++ b/tests/unit/expected_test_results/nutriscore/cookies.json @@ -100,29 +100,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3460 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "g", "value" : 15 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -130,15 +130,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -151,14 +151,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 20, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 10 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json index b31ae6e355feb..2c05ccb9aa8e4 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-80-percent-milk.json @@ -228,36 +228,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3378 }, { "id" : "sugars", - "max" : 10, "points" : 8, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 5 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -265,22 +265,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 2 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -293,15 +293,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 22, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json index f2bab8ea19513..5d0121f0c46af 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drink-with-less-than-80-percent-milk.json @@ -224,36 +224,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3378 }, { "id" : "sugars", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "g", "value" : 20 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 5 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -261,22 +261,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 2 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -289,15 +289,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 24, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json index 596c46ba83ec1..34d02aa6b9103 100644 --- a/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json +++ b/tests/unit/expected_test_results/nutriscore/dairy-drinks-without-milk.json @@ -217,36 +217,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3378 }, { "id" : "sugars", - "max" : 10, "points" : 8, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 5 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -254,22 +254,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 2 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -282,15 +282,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 22, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json index 785a3898e8230..af814a16084aa 100644 --- a/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-apple-estimated-nutrients.json @@ -212,29 +212,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 207 }, { "id" : "sugars", - "max" : 15, "points" : 3, + "points_max" : 15, "unit" : "g", "value" : 10.1 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.02 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -242,22 +242,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.27 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 1.3 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } @@ -270,15 +270,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 3, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json index 06a665b9a9786..2713b01ebda96 100644 --- a/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json +++ b/tests/unit/expected_test_results/nutriscore/en-avocado-oil.json @@ -176,79 +176,71 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 606.8 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 2, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 17.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } ], "positive" : [ - { - "id" : "proteins", - "max" : 7, - "points" : 0, - "unit" : "g", - "value" : 0 - }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } ] }, - "count_proteins" : 1, - "count_proteins_reason" : "negative_points_less_than_7", + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 5, - "positive_max" : 17, + "negative_points" : 7, + "negative_points_max" : 55, "positive_nutrients" : [ - "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 10 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 0 + "score" : 2 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json index a51c22b827797..4ae0430fee62e 100644 --- a/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json +++ b/tests/unit/expected_test_results/nutriscore/en-cherry-tomatoes.json @@ -222,29 +222,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 81 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 2.48 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.06 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -252,22 +252,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.86 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 1.2 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } @@ -280,15 +280,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 0, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-milk.json b/tests/unit/expected_test_results/nutriscore/en-milk.json index 0ba28bbfca932..999986e5aca08 100644 --- a/tests/unit/expected_test_results/nutriscore/en-milk.json +++ b/tests/unit/expected_test_results/nutriscore/en-milk.json @@ -97,36 +97,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 195 }, { "id" : "sugars", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "g", "value" : 4.8 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 1 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.1 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -134,22 +134,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 3.3 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -162,15 +162,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 6, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json index b7cf02f0c92b8..1943eba21b550 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil-no-ingredients.json @@ -113,79 +113,71 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 629 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 2, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 18.7 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } ], "positive" : [ - { - "id" : "proteins", - "max" : 7, - "points" : 0, - "unit" : "g", - "value" : 0 - }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } ] }, - "count_proteins" : 1, - "count_proteins_reason" : "negative_points_less_than_7", + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 5, - "positive_max" : 17, + "negative_points" : 7, + "negative_points_max" : 55, "positive_nutrients" : [ - "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 10 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 0 + "score" : 2 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json index cddf1da0a8b36..7c2aa519ffc30 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil-unrecognized-ingredients.json @@ -180,79 +180,71 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 629 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 2, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 18.7 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } ], "positive" : [ - { - "id" : "proteins", - "max" : 7, - "points" : 0, - "unit" : "g", - "value" : 0 - }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } ] }, - "count_proteins" : 1, - "count_proteins_reason" : "negative_points_less_than_7", + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 5, - "positive_max" : 17, + "negative_points" : 7, + "negative_points_max" : 55, "positive_nutrients" : [ - "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 10 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 0 + "score" : 2 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-olive-oil.json b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json index 155812ba87752..94d428af2bef9 100644 --- a/tests/unit/expected_test_results/nutriscore/en-olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/en-olive-oil.json @@ -225,79 +225,71 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 629 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 2, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 18.7 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } ], "positive" : [ - { - "id" : "proteins", - "max" : 7, - "points" : 0, - "unit" : "g", - "value" : 0 - }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } ] }, - "count_proteins" : 1, - "count_proteins_reason" : "negative_points_less_than_7", + "count_proteins" : 0, + "count_proteins_reason" : "negative_points_greater_than_or_equal_to_7", "is_beverage" : 0, "is_cheese" : 0, "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 5, - "positive_max" : 17, + "negative_points" : 7, + "negative_points_max" : 55, "positive_nutrients" : [ - "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 10 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 0 + "score" : 2 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json index fdd48d828cca2..75435384d671e 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category-and-ingredients.json @@ -256,36 +256,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 182 }, { "id" : "sugars", - "max" : 10, "points" : 7, + "points_max" : 10, "unit" : "g", "value" : 8.9 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.5 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -293,22 +293,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 2, + "points_max" : 6, "unit" : "%", "value" : 50 } @@ -321,15 +321,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 12, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json index 1dbf1616edbec..1a7b6d1b2580d 100644 --- a/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-orange-juice-category.json @@ -111,36 +111,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 182 }, { "id" : "sugars", - "max" : 10, "points" : 7, + "points_max" : 10, "unit" : "g", "value" : 8.9 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.5 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -148,22 +148,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 6, + "points_max" : 6, "unit" : "%", "value" : 100 } @@ -176,15 +176,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 12, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 6 + "positive_points" : 6, + "positive_points_max" : 18 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json b/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json index a847131e93ba8..315dfcd9e88ac 100644 --- a/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json +++ b/tests/unit/expected_test_results/nutriscore/en-potatoes-category.json @@ -109,29 +109,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 182 }, { "id" : "sugars", - "max" : 15, "points" : 2, + "points_max" : 15, "unit" : "g", "value" : 8.9 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.5 } @@ -139,22 +139,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.2 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -167,15 +167,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 4, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json index 75ab4bd70f883..e5bb881903d1c 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-lots-of-meat.json @@ -269,29 +269,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -299,22 +299,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 2, + "points_max" : 7, "unit" : "g", "value" : 50 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -327,15 +327,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_max" : 55, "negative_points" : 9, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], "positive_points" : 2, + "positive_points_max" : 17, "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "c", diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json index ac34497e42ead..8e46cea9a9e93 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-no-meat.json @@ -251,29 +251,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -281,22 +281,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 50 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -309,15 +309,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 9, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json index 8d90388cf3277..9cef2ba1b2bbc 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-ingredients-with-very-little-meat.json @@ -295,29 +295,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -325,22 +325,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 50 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -353,15 +353,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 9, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json index ceceae41b6b8d..79dd39025de82 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-ambiguous-category-no-ingredients.json @@ -98,29 +98,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -128,22 +128,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 50 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -156,15 +156,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 9, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json b/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json index 49e0274f3f9ea..7304fc4335a11 100644 --- a/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json +++ b/tests/unit/expected_test_results/nutriscore/en-red-meat-category-no-ingredients.json @@ -107,29 +107,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -137,22 +137,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 2, + "points_max" : 7, "unit" : "g", "value" : 50 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -165,15 +165,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 1, "is_water" : 0, - "negative_max" : 55, "negative_points" : 9, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], "positive_points" : 2, + "positive_points_max" : 17, "proteins_points_limited_reason" : "red_meat_product" }, "grade" : "c", diff --git a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json index 46988b5185433..f08d830ea29fa 100644 --- a/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json +++ b/tests/unit/expected_test_results/nutriscore/en-soy-beans-processed-and-unprocessed.json @@ -245,29 +245,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 1.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 } @@ -275,22 +275,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 20 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 1, + "points_max" : 5, "unit" : "%", "value" : 55 } @@ -303,15 +303,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 0, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 8 + "positive_points" : 8, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json index c02b4cb71ccf4..cfe51d49eb1e9 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json +++ b/tests/unit/expected_test_results/nutriscore/en-sugar-estimated-nutrients.json @@ -205,29 +205,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 1700 }, { "id" : "sugars", - "max" : 15, "points" : 15, + "points_max" : 15, "unit" : "g", "value" : 99.8 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.01 } @@ -235,15 +235,15 @@ "positive" : [ { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -256,14 +256,14 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 20, - "positive_max" : 10, + "negative_points_max" : 55, "positive_nutrients" : [ "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 10 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json index d2a6f7caea107..47381d3383f6e 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners-erythritol.json @@ -217,36 +217,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "g", "value" : 4.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -254,22 +254,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 4, + "points_max" : 6, "unit" : "%", "value" : 70.5 } @@ -282,15 +282,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 4, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 4 + "positive_points" : 4, + "positive_points_max" : 18 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json index 452fabf4a308a..3e81b943b67a7 100644 --- a/tests/unit/expected_test_results/nutriscore/en-sweeteners.json +++ b/tests/unit/expected_test_results/nutriscore/en-sweeteners.json @@ -216,36 +216,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "g", "value" : 4.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 4, + "points_max" : null, "unit" : null, "value" : 0 } @@ -253,22 +253,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 4, + "points_max" : 6, "unit" : "%", "value" : 70.5 } @@ -281,15 +281,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 8, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], "positive_points" : 4, + "positive_points_max" : 18, "with_non_nutritive_sweeteners" : 1 }, "grade" : "c", diff --git a/tests/unit/expected_test_results/nutriscore/en-tofu.json b/tests/unit/expected_test_results/nutriscore/en-tofu.json index b7ebc0a05d133..c6b61fa15d00d 100644 --- a/tests/unit/expected_test_results/nutriscore/en-tofu.json +++ b/tests/unit/expected_test_results/nutriscore/en-tofu.json @@ -250,29 +250,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 1.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 } @@ -280,22 +280,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 20 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -308,15 +308,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 0, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json index 685025a730091..7f57216664ccb 100644 --- a/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json +++ b/tests/unit/expected_test_results/nutriscore/en-vegetable-crisps.json @@ -232,29 +232,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 1.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 } @@ -262,22 +262,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 20 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -290,15 +290,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 0, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json index aa870853936d5..ee006bbe3129a 100644 --- a/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/flavored-spring-with-nutrition.json @@ -102,36 +102,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 9, + "points_max" : 10, "unit" : "kJ", "value" : 378 }, { "id" : "sugars", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "g", "value" : 3 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -139,22 +139,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -167,15 +167,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 11, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json b/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json index ba9ced1c9b366..392acf5523d88 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json +++ b/tests/unit/expected_test_results/nutriscore/fr-canned-green-beans.json @@ -267,29 +267,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 315 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 3.6 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.1 }, { "id" : "salt", - "max" : 20, "points" : 5, + "points_max" : 20, "unit" : "g", "value" : 1.2 } @@ -297,22 +297,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 2, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 3, + "points_max" : 5, "unit" : "g", "value" : 5.3 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 1, + "points_max" : 5, "unit" : "%", "value" : 50 } @@ -325,15 +325,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 6, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 6 + "positive_points" : 6, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json b/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json index 8dd974a3062f3..118ee9bb731c2 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json +++ b/tests/unit/expected_test_results/nutriscore/fr-canned-pineapple.json @@ -194,29 +194,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 315 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 3.6 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.1 }, { "id" : "salt", - "max" : 20, "points" : 5, + "points_max" : 20, "unit" : "g", "value" : 1.2 } @@ -224,22 +224,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 2, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 3, + "points_max" : 5, "unit" : "g", "value" : 5.3 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 10 } @@ -252,15 +252,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 6, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json index 1c3b8e8791489..eec7b532d155e 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-coconut-milk.json @@ -223,29 +223,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 178 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.6 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 } @@ -253,22 +253,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 1, + "points_max" : 7, "unit" : "g", "value" : 3.9 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 1, + "points_max" : 5, "unit" : "%", "value" : 60 } @@ -281,15 +281,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 0, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json index 33b857b43927c..4f4e4ed83f99c 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json +++ b/tests/unit/expected_test_results/nutriscore/fr-gaspacho.json @@ -339,29 +339,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 148 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 3 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.2 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.5 } @@ -369,22 +369,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.9 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 1.1 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 95 } @@ -397,15 +397,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json b/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json index 018459bcdb178..6ce963889d5e6 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json +++ b/tests/unit/expected_test_results/nutriscore/fr-green-beans-beverage.json @@ -237,29 +237,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "kJ", "value" : 315 }, { "id" : "sugars", - "max" : 15, "points" : 1, + "points_max" : 15, "unit" : "g", "value" : 3.6 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.1 }, { "id" : "salt", - "max" : 20, "points" : 3, + "points_max" : 20, "unit" : "g", "value" : 0.8 } @@ -267,22 +267,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 2, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 3, + "points_max" : 5, "unit" : "g", "value" : 5.3 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 10 } @@ -295,15 +295,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 4, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json index e9dd996e456ac..3e83251508d67 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json +++ b/tests/unit/expected_test_results/nutriscore/fr-ice-tea-with-sweetener.json @@ -455,36 +455,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 82 }, { "id" : "sugars", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "g", "value" : 4.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 4, + "points_max" : null, "unit" : null, "value" : 0 } @@ -492,22 +492,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0.1 } @@ -520,15 +520,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 8, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], "positive_points" : 0, + "positive_points_max" : 18, "with_non_nutritive_sweeteners" : 1 }, "grade" : "d", diff --git a/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json index 1e1eb47148828..5a08dfe722c47 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/fr-mixed-oils-with-olive-oil.json @@ -288,29 +288,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 362.6 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 9.8 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -318,22 +318,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -346,15 +346,15 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 3, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json index 3160fc11e895a..8243779d8e64f 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json +++ b/tests/unit/expected_test_results/nutriscore/fr-orange-nectar-0-fat.json @@ -266,36 +266,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 5, + "points_max" : 10, "unit" : "kJ", "value" : 250 }, { "id" : "sugars", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "g", "value" : 12 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : 20, "points" : 2, + "points_max" : 20, "unit" : "g", "value" : 0.5 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -303,22 +303,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0.5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 2, + "points_max" : 6, "unit" : "%", "value" : 57 } @@ -331,15 +331,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 17, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 2 + "positive_points" : 2, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json index b852e433079d2..04b594ad72c06 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json +++ b/tests/unit/expected_test_results/nutriscore/fr-plant-beverages-soy-milk.json @@ -244,36 +244,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 178 }, { "id" : "sugars", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.5 }, { "id" : "saturated_fat", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "g", "value" : 0.6 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0.03 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -281,22 +281,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 3.9 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0.5 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 8 } @@ -309,15 +309,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 3, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json index 179261ecade5c..1414d3a043d3e 100644 --- a/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json +++ b/tests/unit/expected_test_results/nutriscore/fr-rapeseed-oil.json @@ -222,29 +222,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 2, + "points_max" : 10, "unit" : "kJ", "value" : 270.1 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, "points" : 0, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 7.9 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -252,22 +252,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -280,15 +280,15 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 2, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/milk.json b/tests/unit/expected_test_results/nutriscore/milk.json index 2aae5655e3856..6103f75ba0f5a 100644 --- a/tests/unit/expected_test_results/nutriscore/milk.json +++ b/tests/unit/expected_test_results/nutriscore/milk.json @@ -209,36 +209,36 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 10, + "points_max" : 10, "unit" : "kJ", "value" : 3378 }, { "id" : "sugars", - "max" : 10, "points" : 8, + "points_max" : 10, "unit" : "g", "value" : 10 }, { "id" : "saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "g", "value" : 5 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -246,22 +246,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 7, + "points_max" : 7, "unit" : "g", "value" : 5 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 2 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -274,15 +274,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 54, "negative_points" : 22, - "positive_max" : 18, + "negative_points_max" : 50, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 18 }, "grade" : "e", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/mushrooms.json b/tests/unit/expected_test_results/nutriscore/mushrooms.json index fd1be798b1e68..2c2770a5b2e94 100644 --- a/tests/unit/expected_test_results/nutriscore/mushrooms.json +++ b/tests/unit/expected_test_results/nutriscore/mushrooms.json @@ -178,29 +178,29 @@ "negative" : [ { "id" : "energy", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "kJ", "value" : 667 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 1.1 }, { "id" : "saturated_fat", - "max" : 10, "points" : 1, + "points_max" : 10, "unit" : "g", "value" : 1.2 }, { "id" : "salt", - "max" : 20, "points" : 4, + "points_max" : 20, "unit" : "g", "value" : 1 } @@ -208,22 +208,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 2.4 }, { "id" : "fiber", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "g", "value" : 10.9 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 2, + "points_max" : 5, "unit" : "%", "value" : 69 } @@ -236,15 +236,15 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, "negative_points" : 6, - "positive_max" : 17, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 7 + "positive_points" : 7, + "positive_points_max" : 17 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/olive-oil.json b/tests/unit/expected_test_results/nutriscore/olive-oil.json index 7c12f5fc93000..49add1281252f 100644 --- a/tests/unit/expected_test_results/nutriscore/olive-oil.json +++ b/tests/unit/expected_test_results/nutriscore/olive-oil.json @@ -113,29 +113,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 4, + "points_max" : 10, "unit" : "kJ", "value" : 518 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 1, + "points_max" : 10, "unit" : "%", - "value" : 0 + "value" : 15.2 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -143,22 +143,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 5, + "points_max" : 5, "unit" : "%", "value" : 100 } @@ -171,21 +171,21 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 4, - "positive_max" : 17, + "negative_points" : 5, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 5 + "positive_points" : 5, + "positive_points_max" : 17 }, "grade" : "b", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : -1 + "score" : 0 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json index 405c474f73244..60a2389f02da1 100644 --- a/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json +++ b/tests/unit/expected_test_results/nutriscore/spring-water-no-nutrition.json @@ -88,36 +88,36 @@ "negative" : [ { "id" : "energy", - "max" : null, "points" : 0, + "points_max" : null, "unit" : "kJ", "value" : 0 }, { "id" : "sugars", - "max" : null, "points" : 0, + "points_max" : null, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat", - "max" : null, "points" : 0, + "points_max" : null, "unit" : "g", "value" : 0 }, { "id" : "salt", - "max" : null, "points" : 0, + "points_max" : null, "unit" : "g", "value" : 0 }, { "id" : "non_nutritive_sweeteners", - "max" : 4, "points" : 0, + "points_max" : null, "unit" : null, "value" : 0 } @@ -125,22 +125,22 @@ "positive" : [ { "id" : "proteins", - "max" : null, "points" : 0, + "points_max" : null, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 6, "points" : 0, + "points_max" : 6, "unit" : "%", "value" : 0 } @@ -153,15 +153,16 @@ "is_fat_oil_nuts_seeds" : 0, "is_red_meat_product" : 0, "is_water" : "1", - "negative_max" : 4, "negative_points" : 0, - "positive_max" : 11, + "negative_points_max" : 0, + "non_nutritive_sweeteners_max" : 4, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 11 }, "grade" : "a", "nutrients_available" : 1, diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json index dd03ba1753f5d..725e04ec91610 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar-no-sat-fat.json @@ -99,7 +99,7 @@ "proteins" : 0, "salt" : 0, "saturated_fat" : null, - "saturated_fat_ratio" : 1, + "saturated_fat_ratio" : 0, "sugars" : 0 }, "grade" : "unknown", diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json index 881fad74688f5..3715b3d2a7e6e 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil-no-sugar.json @@ -111,29 +111,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 370 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 1, + "points_max" : 10, "unit" : "%", - "value" : 1 + "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -141,22 +141,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -169,21 +169,21 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 3, - "positive_max" : 17, + "negative_points" : 4, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 3 + "score" : 4 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json index 4c86672f51320..cdfb257a4260e 100644 --- a/tests/unit/expected_test_results/nutriscore/sunflower-oil.json +++ b/tests/unit/expected_test_results/nutriscore/sunflower-oil.json @@ -111,29 +111,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 370 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 1, + "points_max" : 10, "unit" : "%", - "value" : 1 + "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -141,22 +141,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -169,21 +169,21 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 3, - "positive_max" : 17, + "negative_points" : 4, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 3 + "score" : 4 } }, "nutriscore_2021_tags" : [ diff --git a/tests/unit/expected_test_results/nutriscore/walnut-oil.json b/tests/unit/expected_test_results/nutriscore/walnut-oil.json index 828d950e7c2bb..28d3b853630c6 100644 --- a/tests/unit/expected_test_results/nutriscore/walnut-oil.json +++ b/tests/unit/expected_test_results/nutriscore/walnut-oil.json @@ -113,29 +113,29 @@ "negative" : [ { "id" : "energy_from_saturated_fat", - "max" : 10, "points" : 3, + "points_max" : 10, "unit" : "kJ", "value" : 370 }, { "id" : "sugars", - "max" : 15, "points" : 0, + "points_max" : 15, "unit" : "g", "value" : 0 }, { "id" : "saturated_fat_ratio", - "max" : 10, - "points" : 0, + "points" : 1, + "points_max" : 10, "unit" : "%", - "value" : 1 + "value" : 10 }, { "id" : "salt", - "max" : 20, "points" : 0, + "points_max" : 20, "unit" : "g", "value" : 0 } @@ -143,22 +143,22 @@ "positive" : [ { "id" : "proteins", - "max" : 7, "points" : 0, + "points_max" : 7, "unit" : "g", "value" : 0 }, { "id" : "fiber", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "g", "value" : 0 }, { "id" : "fruits_vegetables_legumes", - "max" : 5, "points" : 0, + "points_max" : 5, "unit" : "%", "value" : 0 } @@ -171,21 +171,21 @@ "is_fat_oil_nuts_seeds" : 1, "is_red_meat_product" : 0, "is_water" : 0, - "negative_max" : 55, - "negative_points" : 3, - "positive_max" : 17, + "negative_points" : 4, + "negative_points_max" : 55, "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ], - "positive_points" : 0 + "positive_points" : 0, + "positive_points_max" : 17 }, "grade" : "c", "nutrients_available" : 1, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, - "score" : 3 + "score" : 4 } }, "nutriscore_2021_tags" : [ From 9b032bf37aece510281110ff632f250b66c5af53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Mon, 5 Feb 2024 16:43:57 +0100 Subject: [PATCH 13/13] update tests --- lib/ProductOpener/KnowledgePanels.pm | 8 +++++--- lib/ProductOpener/Nutriscore.pm | 16 ++++++++-------- .../health/nutriscore/nutriscore_2023.tt.json | 4 ++-- .../nutriscore/nutriscore_component.tt.json | 4 ++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index 7dd70b095462d..66285776c00b9 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -909,8 +909,10 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options if ($panel_data_ref->{nutriscore_unknown_reason_short}) { $panel_data_ref->{subtitle} = $panel_data_ref->{nutriscore_unknown_reason_short}; } - $panel_data_ref->{subtitle} = lang_in_other_lc($target_lc, - "attribute_nutriscore_" . $panel_data_ref->{nutriscore_grade} . "_description_short"); + else { + $panel_data_ref->{subtitle} = lang_in_other_lc($target_lc, + "attribute_nutriscore_" . $panel_data_ref->{nutriscore_grade} . "_description_short"); + } } # Nutri-Score sub-panels for each positive or negative component @@ -924,7 +926,7 @@ sub create_nutriscore_2023_panel ($product_ref, $target_lc, $target_cc, $options "value" => $component_ref->{value}, "unit" => $component_ref->{unit}, "points" => $component_ref->{points}, - "max" => $component_ref->{max}, + "points_max" => $component_ref->{points_max}, }; create_panel_from_json_template( "nutriscore_component_" . $component_ref->{id}, diff --git a/lib/ProductOpener/Nutriscore.pm b/lib/ProductOpener/Nutriscore.pm index 5226556d1c4f1..095fa2e77e289 100644 --- a/lib/ProductOpener/Nutriscore.pm +++ b/lib/ProductOpener/Nutriscore.pm @@ -741,7 +741,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { } # max number of squares in the gauge we will display to user for this nutrient - $nutriscore_data_ref->{$nutrient . "_max"} = scalar @{$points_thresholds_2023{$nutrient_threshold_id}}; + $nutriscore_data_ref->{$nutrient . "_points_max"} = scalar @{$points_thresholds_2023{$nutrient_threshold_id}}; } # For red meat products, the number of maximum protein points is set at 2 points @@ -784,16 +784,16 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { foreach my $nutrient (@$negative_components) { my $points = ($nutriscore_data_ref->{$nutrient . "_points"} || 0); - my $max = $nutriscore_data_ref->{$nutrient . "_max"}; + my $points_max = $nutriscore_data_ref->{$nutrient . "_points_max"}; push @{$nutriscore_data_ref->{components}{negative}}, { id => $nutrient, value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}, 2), points => $points, - max => $max, + points_max => $points_max, }; $nutriscore_data_ref->{negative_points} += $points; - $nutriscore_data_ref->{negative_max} += $max; + $nutriscore_data_ref->{negative_points_max} += $points_max; } # positive points @@ -844,16 +844,16 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { foreach my $nutrient (@{$nutriscore_data_ref->{positive_nutrients}}) { my $points = ($nutriscore_data_ref->{$nutrient . "_points"} || 0); - my $max = $nutriscore_data_ref->{$nutrient . "_max"}; + my $points_max = $nutriscore_data_ref->{$nutrient . "_points_max"}; push @{$nutriscore_data_ref->{components}{positive}}, { id => $nutrient, value => round_to_max_decimal_places($nutriscore_data_ref->{$nutrient}, 2), points => $points, - max => $max, + points_max => $points_max, }; $nutriscore_data_ref->{positive_points} += $points; - $nutriscore_data_ref->{positive_max} += $max; + $nutriscore_data_ref->{positive_points_max} += $points_max; } # Add units for the retained positive and negative components @@ -869,7 +869,7 @@ sub compute_nutriscore_score_2023 ($nutriscore_data_ref) { { delete $nutriscore_data_ref->{$key}; delete $nutriscore_data_ref->{$key . "_points"}; - delete $nutriscore_data_ref->{$key . "_max"}; + delete $nutriscore_data_ref->{$key . "_points_max"}; } } diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json index abc7e105e2668..3f5d06bfaf086 100644 --- a/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_2023.tt.json @@ -41,7 +41,7 @@ { "element_type": "panel_group", "panel_group_element": { - "title": "[% lang('nutriscore_negative_points') %][% sep %]: [% product.nutriscore.2023.data.negative_points %]/[% product.nutriscore.2023.data.negative_max %]", + "title": "[% lang('nutriscore_negative_points') %][% sep %]: [% product.nutriscore.2023.data.negative_points %]/[% product.nutriscore.2023.data.negative_points_max %]", "evaluation": "bad", "icon_url": "[% static_subdomain %]/images/icons/dist/circle-minus.svg", "icon_size": "small", @@ -56,7 +56,7 @@ { "element_type": "panel_group", "panel_group_element": { - "title": "[% lang('nutriscore_positive_points') %][% sep %]: [% product.nutriscore.2023.data.positive_points %]/[% product.nutriscore.2023.data.positive_max %]", + "title": "[% lang('nutriscore_positive_points') %][% sep %]: [% product.nutriscore.2023.data.positive_points %]/[% product.nutriscore.2023.data.positive_points_max %]", "evaluation": "good", "icon_url": "[% static_subdomain %]/images/icons/dist/circle-plus.svg", "icon_size": "small", diff --git a/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json index 15aa538e2a837..4b33521da5f22 100644 --- a/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json +++ b/templates/api/knowledge-panels/health/nutriscore/nutriscore_component.tt.json @@ -5,9 +5,9 @@ ], "size": "small", "title_element": { - "icon_url": "[% static_subdomain %]/images/attributes/dist/points-[% panel.type %]-[% panel.points %]-[% panel.max %].svg", + "icon_url": "[% static_subdomain %]/images/attributes/dist/points-[% panel.type %]-[% panel.points %]-[% panel.points_max %].svg", "title": "[% lang("nutriscore_component_" _ panel.id) %]", - "subtitle": "[% panel.points %]/[% panel.max %] points ([% panel.value %][% panel.unit %])", + "subtitle": "[% panel.points %]/[% panel.points_max %] points ([% panel.value %][% panel.unit %])", }, "elements": [