About the data
Credits
- Contains data from Open Food Facts, available under the Open Database License.
- Generic nutrition values come from USDA FoodData Central, which is in the public domain (CC0).
What we changed in the Open Food Facts data
We start from the Open Food Facts English product file, en.openfoodfacts.org.products.csv.gz, and keep a smaller table. The only changes are:
- We keep products tagged as seen in Canada or the United States, and drop the rest.
- We keep the barcode, name, brand, pack size, serving size and five values per 100 g or 100 ml (energy, protein, carbohydrate, fat, fibre).
- Barcodes are tidied to one length; a missing or impossible number becomes empty, never zero; text is cleaned of control characters.
- We add no data of our own to this table.
The exact method is the code below, which you can read and run against the file above to get the same table (the Open Food Facts file changes daily, so the result matches the day you start from).
- offrows.py (what happens to each row)
- nutrition.py (the barcode rule)
- offimport.py (reading the file and loading the table)
- import_off.py (the command that runs it)