Skip to content

Instantly share code, notes, and snippets.

@sumit-158
Last active September 16, 2022 09:42
Show Gist options
  • Save sumit-158/dd9fd3b6337fda5b95e882160bf4ea16 to your computer and use it in GitHub Desktop.
Save sumit-158/dd9fd3b6337fda5b95e882160bf4ea16 to your computer and use it in GitHub Desktop.

Google Summer of Code 2022 with OpenFoodFacts - Work Product Submission

This work Product is a summary of the work I did for OpenFoodFacts during Google Summer of Codes

Project Description

What are facets-knowledge-panels?

It is a REST API (built using FastAPI). It computes data that is useful for contributors looking at a particular subset of the database and helping them improve quality.

Why facets-knowledge-panels?

  • Provides applications with a set of informative or actionable items which are contextual to a specific facet.
  • The primary goal is to allow high-level contributions by users who may be interested in a particular subset of the database, like a particular food category or a brand, a location, etc...
  • We reuse the knowledge panel format, which was initially conceived for the mobile application, which removes the need for the application to change as the server-side code change, or to implement specific business logic.
  • Getting knowledge panels in the native language.

What it does ?

  • Currently, the API returns couples of knowledge panel like hunger-game, Lastedits, Data-quality, and wiki-data so, basically, it takes facets(filtering way in OpenFoodFacts like category, brand, etc) as input then search for the relevant data and return the knowledge panels.

Contributions

My initial project was not this, it was community-portal. so, I spend my first few weeks on this project(community-portal) but sadly, we have to change the scope of the project and shrink it to this current project(facet-knowledge-panels) because the initial project goal was too ambitious and there was a high risk of finishing that in GSoC timeline (of course for the newbie like me :-) ) as also this was connected to the heart of empowering contributors that's why we decided to change the scope of the project. Taking about the current project as I already gave an overview of what is the project all about but lets me take you into deep dive into it what work I had done.

Taking about the current project. l.e., facets-knowledge-panels is about making an API that gives user knowledge-panels based on different fields like hunger-games,wiki-data, and many more. This is done through fetching data from different OpenFoodFacts APIs and creating systematic results in form of a JSON. I also develop translation features (based on internalizations and localizations) with the help of gettext and Crowdin server. Also, Implemented test suites for all the different features with the help of pytest and monkey-patching. Here is the list of PRs with short descriptions.

  • Setup the base of project As the name says I started the project by initializing the base code for the project based on fastapi
  • Api point for KP Created an empty knowledge panel and API endpoints
  • Update Readme This was to add a readme for the project on how to develop the project locally with the help of docker or venv.
  • feat: Adding a knowledge panel for Hunger Games This was for adding hunger game knowledge panel also added its tests.
  • feat: Adding a Knowledge Panel for data-quality This was for adding a knowledge panel for data quality and adding its tests(monkey patching)
  • Added last_edits_kp This pull request was to add a knowledge panel for last-edits (its basically the last edits, editor name, and edited time of products on OFF) and also its tests.
  • feat: Initialize Internationalization Its helps in the translations of the knowledge panel in the native language which takes crowdin server, this was done with the help of gettext.
  • feat: Wikidata knowledge panel This was for adding wiki data, its returns different kinds of an entity based on the facet and value provided by the user, entities are the links like image link of the product in wikidata, its label, description, Openstreetmap relations, and others.

some useful links

Future Work

The project still has three open issues, along with enhancements to the work I've done. Apart from this,I would love to work on further enhancing the project.

Contributing to OpenFoodFacts has been amazing and I will be continuing my contribution to this Organization.

Acknowledgements

I would like to thank my mentors, the OpenFoodFacts community, and Google for giving me an enriching experience this summer. I am extremely thankful for the opportunity to participate in this program and enhance my programming skills while creating the Facets knowledge panels project.

Special thanks to my mentors Alex Garel and Pierre Slamich for supporting me throughout the whole summer :-)

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