Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new binary property to some preferences, like allergens #9370

Closed
Tracked by #4840
stephanegigandet opened this issue Nov 22, 2023 · 1 comment · Fixed by #10846
Closed
Tracked by #4840

Add a new binary property to some preferences, like allergens #9370

stephanegigandet opened this issue Nov 22, 2023 · 1 comment · Fixed by #10846
Labels
🤳🥫 blocking mobile apps This issues are blocking a feature on the Open Food Facts mobile apps 🤳🥫 mobile apps 🎯 P1 personal search https://wiki.openfoodfacts.org/Project:Personalized_Search

Comments

@stephanegigandet
Copy link
Contributor

stephanegigandet commented Nov 22, 2023

We currently use 4 levels for all food preferences, but some preferences like allergens could have a single binary switch.

We should define a new property in https://world.openfoodfacts.org/api/v0/attribute_groups to indicate which properties should/could be binary.

Part of

@stephanegigandet stephanegigandet added personal search https://wiki.openfoodfacts.org/Project:Personalized_Search 🤳🥫 mobile apps labels Nov 22, 2023
@teolemon teolemon added 🎯 P1 🤳🥫 blocking mobile apps This issues are blocking a feature on the Open Food Facts mobile apps labels Aug 14, 2024
@alexgarel
Copy link
Member

We will add an attribute "binary" that says what are the values corresponding to on / off

eg: "binary": {"on": "important", "off": "not important"}.

stephanegigandet added a commit that referenced this issue Oct 2, 2024
…ions (#10846)

This changes the result of
http://wold.openfoodfacts.org/api/v2/attribute_groups to add a "values"
array to list the possible values for each attribute.

Fixes #9370

Most attributes have 4:

values: [
"not_important",
"important",
"very_important",
"mandatory"
]

Allergens + vegan and vegetarian have 2:

values: [
"not_important",
"mandatory"
]


Full file:

```
[
{
attributes: [
{
default: "very_important",
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nutriscore-a.svg",
id: "nutriscore",
name: "Nutri-Score",
panel_id: "nutriscore",
setting_name: "Good nutritional quality (Nutri-Score)",
setting_note: "The Nutri-Score is computed and can be taken into account for all products, even if is not displayed on the packaging.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nutrient-level-salt-low.svg",
id: "low_salt",
name: "Salt",
setting_name: "Salt in low quantity",
setting_note: "The salt level is taken into account by the Nutri-Score. Use this setting only if you are specifically on a low salt diet.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nutrient-level-sugars-low.svg",
id: "low_sugars",
name: "Sugars",
setting_name: "Sugars in low quantity",
setting_note: "The sugars level is taken into account by the Nutri-Score. Use this setting only if you are specifically on a low sugars diet.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nutrient-level-fat-low.svg",
id: "low_fat",
name: "Fat",
setting_name: "Fat in low quantity",
setting_note: "The fat level is taken into account by the Nutri-Score. Use this setting only if you are specifically on a low fat diet.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nutrient-level-saturated-fat-low.svg",
id: "low_saturated_fat",
name: "Saturated fat",
setting_name: "Saturated fat in low quantity",
setting_note: "The saturated fat level is taken into account by the Nutri-Score. Use this setting only if you are specifically on a low saturated fat diet.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
}
],
id: "nutritional_quality",
name: "Nutritional quality"
},
{
attributes: [
{
default: "important",
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/nova-group-1.svg",
id: "nova",
name: "NOVA group",
panel_id: "nova",
setting_name: "No or little food processing (NOVA group)",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/0-additives.svg",
id: "additives",
name: "Additives",
panel_id: "additives",
setting_name: "No or few additives",
setting_note: "Additives are markers of food processing, and excess consumption of some of them have undesirable health impacts.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
}
],
id: "processing",
name: "Food processing"
},
{
attributes: [
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-gluten.svg",
id: "allergens_no_gluten",
name: "Gluten",
setting_name: "Without Gluten",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-milk.svg",
id: "allergens_no_milk",
name: "Milk",
setting_name: "Without Milk",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-eggs.svg",
id: "allergens_no_eggs",
name: "Eggs",
setting_name: "Without Eggs",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-nuts.svg",
id: "allergens_no_nuts",
name: "Nuts",
setting_name: "Without Nuts",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-peanuts.svg",
id: "allergens_no_peanuts",
name: "Peanuts",
setting_name: "Without Peanuts",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-sesame-seeds.svg",
id: "allergens_no_sesame_seeds",
name: "Sesame seeds",
setting_name: "Without Sesame seeds",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-soybeans.svg",
id: "allergens_no_soybeans",
name: "Soybeans",
setting_name: "Without Soybeans",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-celery.svg",
id: "allergens_no_celery",
name: "Celery",
setting_name: "Without Celery",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-mustard.svg",
id: "allergens_no_mustard",
name: "Mustard",
setting_name: "Without Mustard",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-lupin.svg",
id: "allergens_no_lupin",
name: "Lupin",
setting_name: "Without Lupin",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-fish.svg",
id: "allergens_no_fish",
name: "Fish",
setting_name: "Without Fish",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-crustaceans.svg",
id: "allergens_no_crustaceans",
name: "Crustaceans",
setting_name: "Without Crustaceans",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-molluscs.svg",
id: "allergens_no_molluscs",
name: "Molluscs",
setting_name: "Without Molluscs",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/no-sulphur-dioxide-and-sulphites.svg",
id: "allergens_no_sulphur_dioxide_and_sulphites",
name: "Sulphur dioxide and sulphites",
setting_name: "Without Sulphur dioxide and sulphites",
values: [
"not_important",
"mandatory"
]
}
],
id: "allergens",
name: "Allergens",
warning: "There is always a possibility that data about allergens may be missing, incomplete, incorrect or that the product's composition has changed. If you are allergic, always check the information on the actual product packaging."
},
{
attributes: [
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/vegan.svg",
id: "vegan",
name: "Vegan",
setting_name: "Vegan",
setting_note: "To determine whether a product is vegan, we only rely on the list of ingredients.",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/vegetarian.svg",
id: "vegetarian",
name: "Vegetarian",
setting_name: "Vegetarian",
setting_note: "To determine whether a product is vegetarian, we only rely on the list of ingredients.",
values: [
"not_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/palm-oil-free.svg",
id: "palm_oil_free",
name: "Palm oil free",
setting_name: "Palm oil free",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
}
],
id: "ingredients_analysis",
name: "Ingredients"
},
{
attributes: [
{
description: "Organic farming aims to protect the environment and to conserve biodiversity by prohibiting or limiting the use of synthetic fertilizers, pesticides and food additives.",
description_short: "Organic products promote ecological sustainability and biodiversity.",
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/organic.svg",
id: "labels_organic",
name: "Organic farming",
setting_name: "Organic farming",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
description: "When you buy fair trade products, producers in developing countries are paid an higher and fairer price, which helps them improve and sustain higher social and often environmental standards.",
description_short: "Fair trade products help producers in developing countries.",
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/fair-trade.svg",
id: "labels_fair_trade",
name: "Fair trade",
setting_name: "Fair trade",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
}
],
id: "labels",
name: "Labels"
},
{
attributes: [
{
default: "important",
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/ecoscore-a.svg",
id: "ecoscore",
name: "Eco-Score",
panel_id: "ecoscore",
setting_name: "Low environmental impact (Eco-Score)",
setting_note: "The Eco-Score is an environmental score (ecoscore) from A to E which makes it easy to compare the impact of food products on the environment.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
},
{
icon_url: "http://static.openfoodfacts.localhost/images/attributes/dist/forest-footprint-a.svg",
id: "forest_footprint",
name: "Forest footprint",
setting_name: "Low risk of deforestation (Forest footprint)",
setting_note: "The forest footprint corresponds to the risk of deforestation associated with its ingredients.",
values: [
"not_important",
"important",
"very_important",
"mandatory"
]
}
],
id: "environment",
name: "Environment"
}
]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤳🥫 blocking mobile apps This issues are blocking a feature on the Open Food Facts mobile apps 🤳🥫 mobile apps 🎯 P1 personal search https://wiki.openfoodfacts.org/Project:Personalized_Search
3 participants