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

Start of Product Attributes implementation, #4105 #4113

Merged
merged 4 commits into from Sep 6, 2020

Conversation

stephanegigandet
Copy link
Contributor

For more background and details, please see #4105 and https://wiki.openfoodfacts.org/Product_Attributes

This is the start of the implementation of product attributes, that will be used by the new Flutter app and the personal search project.

This is an alpha phase. We will incrementally code and deploy the attributes. A lot of things may change as we add new attributes and use them in the new app (and possibly as a new function to personalize search results on the web site as well). To retrieve the attributes, they need to be explicitly requested (&fields=attributes_en) so it will not confuse existing apps.

Sample output:

https://fr.openfoodfacts.dev/api/v0/produit/3700214614266/chocolat-noir-perou-90-fruite-et-boise-alter-eco?fields=product_name,code,attributes_en

{
product: {
product_name: "Chocolat noir Pérou 90% fruité et boisé",
code: "3700214614266",
attributes_en: [
{
id: "labels",
name: "Labels",
attributes: [
{
status: "known",
id: "labels_organic",
description_short: "Promotes ecological sustainability and biodiversity.",
title: "Organic product",
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.",
name: "Organic product",
match: 100
},
{
status: "known",
description_short: "Fair trade products help producers in developping countries.",
id: "labels_fair_trade",
title: "Fair trade product",
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.",
name: "Fair trade product",
match: 100
}
]
}
]
},
code: "3700214614266",
status: 1,
status_verbose: "product found"
}

@stephanegigandet stephanegigandet requested a review from a team August 31, 2020 19:26
@stephanegigandet
Copy link
Contributor Author

Added Nutri-Score product attribute:

{
name: "Nutritional quality",
attributes: [
{
description: "",
id: "nutriscore",
title: "Nutri-Score D",
match: 30,
status: "known",
name: "",
description_short: "Poor nutritional quality"
}
],
id: "nutritional_quality"
},

@sonarcloud
Copy link

sonarcloud bot commented Sep 1, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@stephanegigandet
Copy link
Contributor Author

Added NOVA attribute:

{
name: "Food processing",
attributes: [
{
name: "NOVA group",
match: 50,
title: "NOVA 3",
status: "known",
description: "",
description_short: "Processed foods",
id: "nova"
}
],
id: "processing"
},

@teolemon
Copy link
Member

teolemon commented Sep 2, 2020

It would be good in the future to split translations apart, otherwise LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
personal search https://wiki.openfoodfacts.org/Project:Personalized_Search product attributes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants