Open teolemon opened 2 years ago
Hi @teolemon I would like to work on this filter issue. Could you give some more description?
I've added a quick visual mockup, but it seems stores is not yet supported by the API https://world.openfoodfacts.org/api/v0/product/4027013050033.json?fields=product_name,brands,ingredients_text,countries_tags,images,stores https://robotoff.openfoodfacts.org/api/v1/questions/random?count=10&lang=en&insight_types=label&stores_tags=auchan https://robotoff.openfoodfacts.org/api/v1/questions/random?count=10&lang=en&insight_types=label&stores=Auchan
Hi. I have one question in general about Hunger games, not particularly about this issue.
If I have understood Hunger games correctly almost all the functionality is done by API. Is there anywhere we use the database, I understand that Open Food Facts uses MongoDB for the backend.
I wanted to understand when we use API and when do we use the database? Or do we use only API?
Also, is there documentation to understand the APIs better?
Hi @teolemon
Since I was working with robotoff APIs earlier, I have an idea of how to proceed.
but it seems stores is not yet supported by the API
What did you mean by not supported by API?
I cannot continue with the task?
To answer your first question, hungergame is a vueJS app so it runs fully on client-side. Then the only way to access data from servers is the API.
About your second question, in this game robotoff is the API we call the get a list of questions. For now, this API does not allows to get only question about products in a given store
The parameters you can pass in the API request are here: https://github.com/openfoodfacts/robotoff/blob/5b9252d298bda2b56fdd530aee50e13112f13912/robotoff/app/api.py#L915-L928
And stores_tags
is not used, so the two following lines are the same for the API
And
stores_tags
is not used, so the two following lines are the same for the API
This means, that we want to sort by store
by can't use the existing API directly?
So I need to write a function in JavaScript to sort by store
?
robotoff.openfoodfacts.org/api/v1/questions/random?count=10&lang=en&insight_types=label
In the API response, I didn't find the store names?
Hey @alexfauquette
Do I get the store list from this API here? https://world.openfoodfacts.org/stores.json
Hi @alexfauquette
I was going through the code, the data in the this.questionBuffer
is so:
{
"barcode": "8717825668590",
"type": "add-binary",
"value": "Non-EU Agriculture",
"question": "Does the product have this label?",
"insight_id": "9abf8aae-11d0-461c-be0a-1a035682b68c",
"insight_type": "label",
"value_tag": "en:non-eu-agriculture",
"source_image_url": "https://static.openfoodfacts.org/images/products/871/782/566/8590/1.400.jpg"
}
I can filter data in this.questionBuffer
, or maybe call another API that returns stores, and match with barcode (depends on data returned by the other API).
I have understood the problem. The thing is I am not able to figure out where to get the store_tags
to start with filtering?
As said previously, the API is not ready and without it, you can not solve this issue. Either you like python and add filtering by the store on robotoff API, or you just wait for it to be added by the team.
I do not know any other solutions. Stores are accessible in openfoodfact API, questions are from robotoff API. And trying to make a join between two APIs is clearly a bad idea
What
Mockup
Part of
234