Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: new Product.categories_tags array field #192

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

raphodn
Copy link
Member

@raphodn raphodn commented Feb 5, 2024

What

New Product.categories_tags field.

  • use PostgreSQL Array field type
  • add to schema (will be returned by the API)
  • add to OFF sync

Why ?

Will be useful for searching/filtering/comparing in the frontend

Extra info

@raphodn raphodn force-pushed the raphodn/product-categories-tags-array-field branch 2 times, most recently from b81ad2f to 51a84ea Compare February 9, 2024 16:05
@raphodn raphodn marked this pull request as ready for review February 9, 2024 16:05
@raphodn raphodn requested a review from raphael0202 February 9, 2024 16:05
@@ -38,6 +38,7 @@ def init_sentry(sentry_dsn: str | None, integrations: list[Integration] | None =
"product_name",
"product_quantity",
"product_quantity_unit",
"categories_tags",
Copy link
Member Author

@raphodn raphodn Feb 9, 2024

Choose a reason for hiding this comment

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

@raphael0202 need your input : I added the field in the OFF sync, but i was wondering if we should get the raw data or filter it a bit (for instance only keep the en: categories ?

example : https://world.openfoodfacts.org/api/v2/product/8001505005592.json

"categories_tags":["en:breakfasts","en:spreads","en:sweet-spreads","fr:pates-a-tartiner","en:hazelnut-spreads","en:chocolate-spreads","en:cocoa-and-hazelnuts-spreads"]

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I missed this comment. I think we can add all categories, some categories don't start with en: and are however valid categories with respect to the category taxonomy.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, but what is the default behavior ? If there is an english translation, is the category stored as en: by default ? Or can there be both en & non en categories ?

@raphodn raphodn force-pushed the raphodn/product-categories-tags-array-field branch from 51a84ea to d470e66 Compare February 9, 2024 16:12
@raphodn raphodn force-pushed the raphodn/product-categories-tags-array-field branch from d470e66 to 4bcf817 Compare February 15, 2024 09:30
@raphodn raphodn merged commit e9d73ae into main Feb 15, 2024
5 checks passed
@raphodn raphodn deleted the raphodn/product-categories-tags-array-field branch February 15, 2024 10:15
@raphodn raphodn linked an issue Feb 15, 2024 that may be closed by this pull request
This was referenced Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store & sync the product categories from OFF
2 participants