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 an Eco-Score helper #191

Open
Tracked by #218
teolemon opened this issue Jul 20, 2021 · 6 comments
Open
Tracked by #218

Add an Eco-Score helper #191

teolemon opened this issue Jul 20, 2021 · 6 comments

Comments

@teolemon
Copy link
Member

teolemon commented Jul 20, 2021

What

image
I specced a system to help 3rd party apps ask for relevant Eco-Score data. How about creating the logic within openfoodfacts-dart so that it can be reused easily ?

Eco-Score for 3rd party apps

A similar system for Eco-Score, and another one for Ingredient related analysis (NOVA, allergens, gluten…) would unlock more reuses, and more data for Open Food Facts

Will unlock

@monsieurtanuki
Copy link
Contributor

My suggestion would be to:

  1. create an enum with all the possible message cases (ProductImprovement?)
  2. for each message case, provide a (default) message in English
  3. add a method in Product that returns a List<ProductImprovement>
  4. the developer would then be able to ignore those possible improvements (same as today), to display them with the default English message, or to localize them according to their own user target and their own UI/UX

Same method for #193 of course.

@teolemon Does that make sense?

@teolemon
Copy link
Member Author

That looks like a rather good plan. I would also try to mutualize translations, or possibly move them to something on the server (a file the plugin could query ?)

@monsieurtanuki monsieurtanuki self-assigned this Aug 20, 2021
@monsieurtanuki
Copy link
Contributor

@teolemon Are you sure about the 'en:labels-to-be-completed' string?
In the unit tests I could not find a product with something similar. I found something like that for product.statesTags:

  • en:to-be-completed
  • en:nutrition-facts-completed
  • en:ingredients-completed
  • en:expiration-date-completed
  • en:packaging-code-to-be-completed
  • en:characteristics-to-be-completed
  • en:origins-to-be-completed
  • en:categories-completed
  • en:brands-completed
  • en:packaging-completed
  • en:quantity-completed
  • en:product-name-completed
  • en:photos-to-be-validated
  • en:packaging-photo-to-be-selected
  • en:nutrition-photo-selected
  • en:ingredients-photo-selected
  • en:front-photo-selected
  • en:photos-uploaded

monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Aug 20, 2021
…vements

Impacted files:
* `api_getProduct_test.dart`: added checks for `getProductImprovements`
* `Product.dart`: create `enum ProductImprovement` and `Product.getProductImprovements()`
@stephanegigandet
Copy link
Contributor

There's no label to be completed state because some products don't have labels.

monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Sep 2, 2021
@monsieurtanuki
Copy link
Contributor

@stephanegigandet I've just removed ProductImprovement.LABELS_TO_BE_COMPLETED from #217.

monsieurtanuki added a commit that referenced this issue Sep 16, 2021
feature/#191 - added and computed possible product improvements
@monsieurtanuki
Copy link
Contributor

Product improvements are now computed in product.getProductImprovements() (#217).
Beyond the enum values, I don't know how the translations are supposed to be integrated, and how.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants