Git Product home page Git Product logo

Comments (8)

teolemon avatar teolemon commented on May 26, 2024

@CloCkWeRX this is a topic I'd like to get moving asap, can you create a list of categories with strong correlations ?
and possibly for each category, an ordered list of frequency, possibly with the country (I think packaging sometimes changes from country to country)

from openfoodfacts-ai.

teolemon avatar teolemon commented on May 26, 2024
en:eggs
associated_packagings:en en:Cardboard to recycle

or perhaps easier, a collaborative spreadsheet that we can iterate on ?

from openfoodfacts-ai.

teolemon avatar teolemon commented on May 26, 2024

https://world.openfoodfacts.org/category/eggs/packaging

from openfoodfacts-ai.

CloCkWeRX avatar CloCkWeRX commented on May 26, 2024

Pipeline I'm setting up for this:

For each category
 data = fetch https://world.openfoodfacts.org/state/packaging-code-completed/category/(categoryname).json
 packaging = data.jsonpath('$.products..packaging_tags.*') # Produces something like below


 packaging_counts = {}
 packaging.each {|pkg| packaging_counts[pkg] += 1 }

image

which is a bit easier than doing it all manually.

What's best, ruby/python/perl/node; assuming this would run periodically?

from openfoodfacts-ai.

CloCkWeRX avatar CloCkWeRX commented on May 26, 2024

https://github.com/CloCkWeRX/openfoodfacts-packaging-from-category - python 2.7 version, simple command line tool that spits out JSON. It only goes into the first page of results right now.

image

from openfoodfacts-ai.

CloCkWeRX avatar CloCkWeRX commented on May 26, 2024

Okay, few more tweaks, handles pagination (stops after 3 pages), world or country, etc.

Now just need to generate the most popular categories and generate a bunch of static JSON :)

image

May need to let you specific "skip anything < X occurences" or "maximum products" as arguments.

from openfoodfacts-ai.

CloCkWeRX avatar CloCkWeRX commented on May 26, 2024

@raphael0202 - python isn't my default language, if you have some time would you mind looking over https://github.com/CloCkWeRX/openfoodfacts-packaging-from-category and suggesting if there are better or more idiomatic ways to structure this?

In my head, this is somewhat of a static JSON generator (just push all the results to git/easy to expose via a static web server for openfoodfacts-server to do browser queries to; or curl into elasticsearch); though could probably also publish things into an sqlite DB or other datastore (more like robotoff)

from openfoodfacts-ai.

teolemon avatar teolemon commented on May 26, 2024

@stephanegigandet

from openfoodfacts-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.