openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
657 stars 385 forks source link

Unable to find new packager codes with API #4405

Open A1CY0N opened 4 years ago

A1CY0N commented 4 years ago

What

Reproduction steps

Steps to reproduce the behavior:

  1. Go to https://world.openfoodfacts.org/product/6842420174016/chocolat
  2. The packaging code is EMB 07113Y
  3. Go to https://world.openfoodfacts.org/packager-codes or http://world.openfoodfacts.org/packager-codes.json
  4. EMB 07113Y packaging code doesn't exist

Number of products impacted

I have noticed this on several recently added products

Part of

svensven commented 4 years ago

on the web site, it's probably not in the first 10000 results, and just on another page. it shows up for https://world.openfoodfacts.org/packager-codes?filter=7113 (or even https://world.openfoodfacts.org/packager-codes?filter=emb ). can't speak for the api/python library though.

A1CY0N commented 4 years ago

Indeed, it seems that the python library should only get the first 10000 results. The filter option is very interesting but I don't think it's implemented in the library.

Unfortunately, the filter option is not available on the api : https://world.openfoodfacts.org/packager-codes.json?filter=emb

svensven commented 4 years ago

I had look through the server code, and it looks like adding a json=anything parameter is an alternative to the .json extension.

https://github.com/openfoodfacts/openfoodfacts-server/blob/08a94fc4d9d4a0f47a258da2faca79b39cadf7be/lib/ProductOpener/Display.pm#L585-L588

And https://world.openfoodfacts.org/packager-codes?filter=emb&json=1 does indeed seem to do the trick.

github-actions[bot] commented 8 months ago

This issue has been open 90 days with no activity. Can you give it a little love by linking it to a parent issue, adding relevant labels and projets, creating a mockup if applicable, adding code pointers from https://github.com/openfoodfacts/openfoodfacts-server/blob/main/.github/labeler.yml, giving it a priority, editing the original issue to have a more comprehensive description… Thank you very much for your contribution to 🍊 Open Food Facts