Food Data Sources
Virium's food database is built from two public sources:
- USDA FoodData Central — U.S. Department of Agriculture, public domain (CC0 1.0).
- Open Food Facts — openfoodfacts.org, under the Open Database License (ODbL) 1.0. Individual contents are under the Database Contents License.
How Virium alters the Open Food Facts data
As ODbL section 4.6 requires, this is the method used to build Virium's databases from the Open Food Facts CSV export. Virium adds no products or values of its own.
Dropped: any product where
- the barcode, with every non-digit and leading zero removed (the normalized barcode), is shorter than 6 or longer than 14 digits;
- the normalized barcode is a store-local code: shorter than 8 digits; 8 digits starting with
2; 12 or 13 digits starting with2; or 12 digits starting with4; product_name, energy, or any of protein, carbohydrate and fat is missing;- protein, carbohydrate, fat or fiber is below 0 or above 100 g per 100 g, or energy is below 0 or above 902 kcal per 100 g;
- the stated energy differs from the energy its macronutrients imply (4 kcal/g protein, 4 kcal/g non-fiber carbohydrate, 2 kcal/g fiber, 9 kcal/g fat) by more than 40 kcal and by more than 20%;
- an earlier product has the same normalized barcode. The order is USDA FoodData Central, then Open Food Facts products sold in the United States or Canada, then all other Open Food Facts products; within one group, the first in the export is kept.
Split: a kept product whose countries_tags include en:united-states or en:canada goes to the main database, searchable by name and barcode. Every other kept product goes to a barcode-only database.
Changed:
- Only these fields are kept: product name, the first brand in
brands, the normalized barcode, energy, protein, carbohydrate, fat and fiber per 100 g, and one serving (serving_sizeas its label,serving_quantityas its grams). - Energy is
energy-kcal_100g, orenergy_100g÷ 4.184 when that is empty. - An empty fiber value is stored as 0.
- The serving is kept only when its quantity is above 0 and its label is not empty.
- Each product's identifier is 100,000,000,000,000 plus its normalized barcode.
Stored: main-database products share a SQLite table with the USDA foods, with a source column and a full-text index over name and brand. Barcode-only products go in a table of the same shape in a separate SQLite file, indexed by barcode.
Questions: support@virium.app. To fix a wrong value, correct it on openfoodfacts.org; Virium picks it up at its next rebuild.