Skip to content
Project 5 of OC Python Developer Path (Python 3 / pandas & pymysql libraries, MySQL, Open Food Facts API) - Jan-Feb 2018
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
classes
images
CSV_database_builder.py
JSON_API_extractor.py
PB_constants.py
PB_tkinter.py
PurBeurre.py
README.md
requirements.txt

README.md

Pur Beurre

This repository contains the Python scripts and additional files of my 4th project for the Python Developer Path in OpenClassrooms.

This application is based on the Open Food Facts database and uses its API (not really, in fact).

The aim of Pur Beurre

Pur Beurre is a fictive start up whose offer a very simple application that allows a consumer to obtain, for a chosen product, a healthier alternative.

How to use Pur Beurre

Choose one of this two options on the Home page :

  1. 'Je souhaite trouver un substitut à un aliment' [ Find a susbstitute ]
  2. 'Je souhaite revoir les substituts que j'ai enregistré' [ Show saved substitutes ]

Option 1: Find a substitute

First, choose a category of products. Second, choose a product in this category.

Pur Beurre will propose you a healthier alternative to this product (with some details).

Then, you can choose to save this result (the sustitute with the selected product).

Option 2: Show previous searches

Show recently saved substitutes, ordered by date (from the youngest to the oldest).

Files structure

JSON_API_extractor.py contains a demo of data recovery via Open Food Facts API in JSON format. A limited number of requests is done to estimate the duration of recovering the entire french data. The aim is to show this approach is not appropriate because the recovery of the french database would take some hours.

CSV_database_builder.py uses the CSV file, downloaded from Open Food Facts, containing the entire french data. The data are parsed using dataframes of the pandas library, then stored in a MySQL database, using pymysql library.

Download the french Open Food Facts database as a CSV file (more than 1.4 Go) : download CSV file

PurBeurre.py is the main script of the application, using the previously created MySQL database.

Note : PB_tkinter.py will offer a graphic interface to the application (in progress).

Data Model of the MySQL database :

Data Model

The Trello dashboard used for this project :

Trello dashboard

You can’t perform that action at this time.