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 the Eco-Score by country API #190

Open
1 task done
Tracked by #218
teolemon opened this issue Jul 20, 2021 · 3 comments
Open
1 task done
Tracked by #218

Add the Eco-Score by country API #190

teolemon opened this issue Jul 20, 2021 · 3 comments

Comments

@teolemon
Copy link
Member

teolemon commented Jul 20, 2021

What

Add this chunk of documentation as a comment

You need to ensure the country your users are in:

- Asking them explicitly at startup, and storing the value
- Geofencing your app to just one country
- Using the phones or the IP address (using eg GeoIP) to infer a country

You need to serve the matching Eco-Score value
You can ask for a country specific Eco-Score
If your users are outside France, you need to clearly display the experimental disclaimer at least once.

Potential block

@monsieurtanuki
Copy link
Contributor

This is more or less what I've understood:

  • on the backend specific ecoscore grades are computed for the following countries: fr/be/nl/es/de/it
  • for the moment from flutter we can query ProductField.ECOSCORE_GRADE, ProductField.ECOSCORE_SCORE and ProductField.ECOSCORE_DATA
  • in the query we're able to specify an optional country

I guess this issue should be fixed rather on the backend every time there's a query about a ProductField.ECOSCORE_... field:

  • if the country is not specified, return null
  • if the country is not fr/be/nl/es/de/it, return null
  • else return the country related ecoscore data

Am I missing something?

@teolemon
Copy link
Member Author

teolemon commented Oct 6, 2021

@monsieurtanuki
Copy link
Contributor

@teolemon I still cannot picture the whole thing.

For instance, let's start from
https://world.openfoodfacts.org/api/v0/product/8076809572569.json?fields=nutriscore_score,nutriscore_grade,ecoscore_score,ecoscore_grade

  1. in this case, whose country are those grades computed for?
  2. I got the same result ({"ecoscore_grade":"d","ecoscore_score":39,"nutriscore_grade":"d","nutriscore_score":17}) after replacing world. with fr., es., it., be., de. and nl. - am I just unlucky or is the URL wrong? Btw same result with pt., which is not in the OP country list.
  3. If I try to replace the field names like ecoscore_grade_nl, there's not matching output for this particular field

In short, it looks like we have nutriscore and ecoscore fields computed only one way, with no way to specify a country.

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

No branches or pull requests

2 participants