Calories food packs: open data

The Calories app can download a food database for your country, so packaged products are searchable and scannable offline. Each one is built from open data and is itself open data.

Licence

Each food pack is made available under the Open Database License (ODbL) 1.0. Its individual contents are under the Database Contents License (DbCL) 1.0. Every pack carries this notice inside it.

Sources

How the packs are made

For each country, the builder keeps the products sold there that have a valid barcode, a name, energy, protein, fat and carbohydrate, and plausible values. Every product someone has scanned is kept, and the rest of the pack, up to 250,000 products, holds the most recently updated ones (in the United States, USDA records first). Each product gets an emoji from its category or name, and its name and brands are indexed for search. A pack ships only after it passes checks on its size, its counts and known products.

Packs are rebuilt from the current export when the app is released. The app downloads only your country's pack, and only when you ask for it.

Get the databases

The builder below reproduces every pack from the public Open Food Facts export. It is a Swift package: with Swift 6.2 or later on macOS, run, in the unpacked archive, swift run --package-path tools/FoodCatalog food-catalog packs build --work-dir <dir> --output-dir <dir> and it downloads the sources, builds the packs as SQLite files and checks them.

Builder source