# Back to Gym: packaged foods Packaged foods sold in India, the United States and the United Kingdom, with their label's values per 100 g, as the Back to Gym iPhone app's barcode scanner looks them up. Made from Open Food Facts by `build_packaged_foods.py` in this folder. Offered at [backtogym.app/data](https://backtogym.app/data); questions to support@backtogym.app. Contains data from [Open Food Facts](https://world.openfoodfacts.org), available under the [Open Database License (ODbL) 1.0](https://opendatacommons.org/licenses/odbl/1-0/). © Open Food Facts contributors. Individual product values are under the [Database Contents License (DbCL) 1.0](https://opendatacommons.org/licenses/dbcl/1-0/). These files are a Derivative Database of Open Food Facts and are offered under the same licence (`LICENSE.md`). The app's other food lists (dishes, basics and drinks built from USDA FoodData Central and UK CoFID values) are separate databases, not made from Open Food Facts, and aren't here. ## The files | File | Country | Products | Export | | --- | --- | --- | --- | | `packaged-in.json` | India | 9,443 | 2026-11-05 | | `packaged-us.json` | United States | 95,357 | 2026-11-05 | | `packaged-gb.json` | United Kingdom | 69,312 | 2026-11-05 | Each has a build report (`packaged--report.md`) with the counts and why the rest were left out. Keys in each product: `b` barcode without leading zeros, `n` name, `br` brand, `q` pack size as printed, `pk` pack grams, `s` serving grams, `k` kcal, `p` protein, `c` carbohydrate, `f` fat, `fi` fibre and `a` alcohol per 100 g, `d` the pack's mark (`vg` vegan, `v` vegetarian, `nv` non-vegetarian). ## What's kept From Open Food Facts' CSV export, products sold in the country with: - a retail barcode (8, 12, 13 or 14 digits, not an in-store code starting with 2), stored without leading zeros; - a name, and energy, protein, carbohydrate and fat per 100 g, in range and adding up to within a quarter (or 25 kcal) of 4 kcal a gram of protein and carbohydrate, 9 of fat and 7 of alcohol; - no data-quality error flagged by Open Food Facts; - for the United States and the United Kingdom, a scan by an Open Food Facts user in that country in 2023 or later (the export's popularity tags). Those countries list hundreds of thousands of products; scans are what people buy. India keeps every complete product. Where a barcode is there twice, the edit made last is kept. Values are as contributors typed them from the label, rounded to 0.1 g; US and Indian labels count fibre in carbohydrate, UK labels don't. They are estimates, and can be wrong or out of date. ## Rebuilding Open Food Facts publishes a new export every night, so a rebuild gives different files: new products, corrections, removals. ```bash curl -sLO https://static.openfoodfacts.org/data/en.openfoodfacts.org.products.csv.gz # about 1.5 GB python3 -I build_packaged_foods.py --export en.openfoodfacts.org.products.csv.gz # all three countries, one pass python3 -I build_packaged_foods.py --check # checks the files are well formed ``` Plain Python 3.11 or later; nothing to install.