openfoodfacts / openfoodfacts-dart

Open Food Facts API Wrapper
https://pub.dev/packages/openfoodfacts
Apache License 2.0
167 stars 67 forks source link

Add a "flavor"/"server type" to products #972

Closed monsieurtanuki closed 2 months ago

monsieurtanuki commented 2 months ago

Why - Problem description

In order to manage off, obf, opf and opff at the same time, we need some additional data. Each product, each barcode should be associated with a flavor.

What - Proposed solution

Make flavor a new product field. That flavor may be provided by the server in a near future, but regardless, we get it from the server we're extracting the data from:

Additional questions

cf. https://github.com/openfoodfacts/smooth-app/issues/4540

monsieurtanuki commented 2 months ago
  • We already have Flavor (off, obf, opf, opff and off-pro) for Prices and ServerType (off, obf, opf and opff) for Robotoff. Which one should we use for our Products? Or should we just stick to a mere String for more flexibility?
  • As the field is supposed to be populated directly by the server in the future, what json tag would it be? flavor, source?

@teolemon Those are blocking questions. Any answer would help solve the issue, and tons of related issues in Smoothie.

stephanegigandet commented 2 months ago

@monsieurtanuki please use the "product_type" field instead, with values "food", "beauty", "petfood" and "product". This is the field that will be added in the OFF database and API.

stephanegigandet commented 2 months ago

flavors may go away, it's better to use product_type

raphodn commented 2 months ago

Ok good to know !

In https://github.com/openfoodfacts/open-prices I currently store it under Product.source.

Also to note that we should update the openfoodfacts-python package : https://github.com/openfoodfacts/openfoodfacts-python/blob/8d1013a01c8fa674c1c84fd1729b73c621b5edd3/openfoodfacts/types.py#L11 to also store/return these values (food, beauty, petfood, product) somehow :)

teolemon commented 2 months ago