Skip to content

Commit

Permalink
fix: switch main nutriscore version to 2023 (#11134)
Browse files Browse the repository at this point in the history
This switches the nutriscore version used for the nutriscore facet to be
2023.
Nutri-Score will need to be recomputed once this is deployed.
  • Loading branch information
stephanegigandet authored Dec 16, 2024
1 parent e1a7800 commit 6a0400f
Show file tree
Hide file tree
Showing 158 changed files with 4,830 additions and 2,106 deletions.
4 changes: 2 additions & 2 deletions lib/ProductOpener/Food.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ sub set_fields_comparing_nutriscore_versions ($product_ref, $version1, $version2
return;
}

=head2 compute_nutriscore( $product_ref )
=head2 compute_nutriscore( $product_ref, $current_version = "2023" )
Determines if we have enough data to compute the Nutri-Score (category + nutrition facts),
and if the Nutri-Score is applicable to the product the category.
Expand All @@ -2110,7 +2110,7 @@ Populates the data structure needed to compute the Nutri-Score and computes it.
=cut

sub compute_nutriscore ($product_ref, $current_version = "2021") {
sub compute_nutriscore ($product_ref, $current_version = "2023") {

# Initialize values

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Display the link to the new Nutri-Score computation page
// on mobile: keep the /nutriscore-v2 link until the app can handle the new URLs
"html": `
<p>&rarr; <a href="[% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutri-score[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
<p>&rarr; <a href="[% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutriscore[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
`
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,8 @@
"nova-group" : 4,
"nova-group_100g" : 4,
"nova-group_serving" : 4,
"nutrition-score-fr" : 3,
"nutrition-score-fr_100g" : 3,
"nutrition-score-fr" : 7,
"nutrition-score-fr_100g" : 7,
"proteins" : 4.5,
"proteins_100g" : 4.5,
"proteins_serving" : 0.45,
Expand Down Expand Up @@ -1070,43 +1070,87 @@
"c"
],
"nutriscore_data" : {
"energy" : 400,
"energy_points" : 1,
"energy_value" : 400,
"fiber" : 2,
"fiber_points" : 2,
"fiber_value" : 2,
"fruits_vegetables_nuts_colza_walnut_olive_oils" : 58.3333333333333,
"fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 1,
"fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 58.3,
"components" : {
"negative" : [
{
"id" : "energy",
"points" : 1,
"points_max" : 10,
"unit" : "kJ",
"value" : 400
},
{
"id" : "sugars",
"points" : 3,
"points_max" : 15,
"unit" : "g",
"value" : 12.5
},
{
"id" : "saturated_fat",
"points" : 5,
"points_max" : 10,
"unit" : "g",
"value" : 5.6
},
{
"id" : "salt",
"points" : 0,
"points_max" : 20,
"unit" : "g",
"value" : 0.05
}
],
"positive" : [
{
"id" : "proteins",
"points" : 1,
"points_max" : 7,
"unit" : "g",
"value" : 4.5
},
{
"id" : "fiber",
"points" : 0,
"points_max" : 5,
"unit" : "g",
"value" : 2
},
{
"id" : "fruits_vegetables_legumes",
"points" : 1,
"points_max" : 5,
"unit" : "%",
"value" : 58.3
}
]
},
"count_proteins" : 1,
"count_proteins_reason" : "negative_points_less_than_11",
"grade" : "c",
"is_beverage" : 0,
"is_cheese" : 0,
"is_fat" : 0,
"is_fat_oil_nuts_seeds" : 0,
"is_red_meat_product" : 0,
"is_water" : 0,
"negative_points" : 8,
"positive_points" : 5,
"proteins" : 4.5,
"proteins_points" : 2,
"proteins_value" : 4.5,
"saturated_fat" : 5.6,
"saturated_fat_points" : 5,
"saturated_fat_value" : 5.6,
"score" : 3,
"sodium" : 20.08,
"sodium_points" : 0,
"sodium_value" : 20.1,
"sugars" : 12.5,
"sugars_points" : 2,
"sugars_value" : 12.5
"negative_points" : 9,
"negative_points_max" : 55,
"positive_nutrients" : [
"proteins",
"fiber",
"fruits_vegetables_legumes"
],
"positive_points" : 2,
"positive_points_max" : 17,
"score" : 7
},
"nutriscore_grade" : "c",
"nutriscore_score" : 3,
"nutriscore_score_opposite" : -3,
"nutriscore_score" : 7,
"nutriscore_score_opposite" : -7,
"nutriscore_tags" : [
"c"
],
"nutriscore_version" : "2021",
"nutriscore_version" : "2023",
"nutrition_data" : "on",
"nutrition_data_per" : "100g",
"nutrition_data_prepared_per" : "100g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2851,8 +2851,8 @@
"nova-group" : 4,
"nova-group_100g" : 4,
"nova-group_serving" : 4,
"nutrition-score-fr" : 3,
"nutrition-score-fr_100g" : 3,
"nutrition-score-fr" : 7,
"nutrition-score-fr_100g" : 7,
"proteins" : 4.5,
"proteins_100g" : 4.5,
"proteins_serving" : 0.45,
Expand Down Expand Up @@ -3006,43 +3006,87 @@
"c"
],
"nutriscore_data" : {
"energy" : 400,
"energy_points" : 1,
"energy_value" : 400,
"fiber" : 2,
"fiber_points" : 2,
"fiber_value" : 2,
"fruits_vegetables_nuts_colza_walnut_olive_oils" : 58.3333333333333,
"fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 1,
"fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 58.3,
"components" : {
"negative" : [
{
"id" : "energy",
"points" : 1,
"points_max" : 10,
"unit" : "kJ",
"value" : 400
},
{
"id" : "sugars",
"points" : 3,
"points_max" : 15,
"unit" : "g",
"value" : 12.5
},
{
"id" : "saturated_fat",
"points" : 5,
"points_max" : 10,
"unit" : "g",
"value" : 5.6
},
{
"id" : "salt",
"points" : 0,
"points_max" : 20,
"unit" : "g",
"value" : 0.05
}
],
"positive" : [
{
"id" : "proteins",
"points" : 1,
"points_max" : 7,
"unit" : "g",
"value" : 4.5
},
{
"id" : "fiber",
"points" : 0,
"points_max" : 5,
"unit" : "g",
"value" : 2
},
{
"id" : "fruits_vegetables_legumes",
"points" : 1,
"points_max" : 5,
"unit" : "%",
"value" : 58.3
}
]
},
"count_proteins" : 1,
"count_proteins_reason" : "negative_points_less_than_11",
"grade" : "c",
"is_beverage" : 0,
"is_cheese" : 0,
"is_fat" : 0,
"is_fat_oil_nuts_seeds" : 0,
"is_red_meat_product" : 0,
"is_water" : 0,
"negative_points" : 8,
"positive_points" : 5,
"proteins" : 4.5,
"proteins_points" : 2,
"proteins_value" : 4.5,
"saturated_fat" : 5.6,
"saturated_fat_points" : 5,
"saturated_fat_value" : 5.6,
"score" : 3,
"sodium" : 20.08,
"sodium_points" : 0,
"sodium_value" : 20.1,
"sugars" : 12.5,
"sugars_points" : 2,
"sugars_value" : 12.5
"negative_points" : 9,
"negative_points_max" : 55,
"positive_nutrients" : [
"proteins",
"fiber",
"fruits_vegetables_legumes"
],
"positive_points" : 2,
"positive_points_max" : 17,
"score" : 7
},
"nutriscore_grade" : "c",
"nutriscore_score" : 3,
"nutriscore_score_opposite" : -3,
"nutriscore_score" : 7,
"nutriscore_score_opposite" : -7,
"nutriscore_tags" : [
"c"
],
"nutriscore_version" : "2021",
"nutriscore_version" : "2023",
"nutrition_data" : "on",
"nutrition_data_per" : "100g",
"nutrition_data_prepared_per" : "100g",
Expand Down
Loading

0 comments on commit 6a0400f

Please sign in to comment.