Nutrients and units
Every nutrient and its integer unit: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms.
Every amount in the database and in op results is an integer in its nutrient's base unit, never a float, so sums stay exact and rounding happens once, for display. A missing key means unknown, not zero. Results also carry totals_display in kcal and grams for people.
- Energy in millikilocalories (
mkcal): 1 kcal = 1,000 mkcal. - Macros and most minerals in milligrams (
mg): 1 g = 1,000 mg. - Vitamins labels give in µg (A, D, B12, folate) in micrograms (
ug).
One egg, stored → displayed
{ "energy": 143000, "protein": 12560, "fat": 9510, "sodium": 142, "vitamin_d": 2}
{ "energy": { "value": 143, "unit": "kcal" }, "protein": { "value": 12.6, "unit": "g" }, "fat": { "value": 9.5, "unit": "g" }, "sodium": { "value": 142, "unit": "mg" }, "vitamin_d": { "value": 2, "unit": "µg" }}Every nutrient
The first panel every meal reply and day total shows is marked core. New nutrients are added as new keys; a key's unit never changes.
| Key | Stored as | Core |
|---|---|---|
| energy | mkcal (millikilocalories) | core |
| protein | mg (milligrams) | core |
| carbs | mg (milligrams) | core |
| fat | mg (milligrams) | core |
| saturated_fat | mg (milligrams) | core |
| trans_fat | mg (milligrams) | |
| fiber | mg (milligrams) | core |
| sugar | mg (milligrams) | core |
| added_sugar | mg (milligrams) | core |
| sodium | mg (milligrams) | core |
| cholesterol | mg (milligrams) | |
| potassium | mg (milligrams) | |
| calcium | mg (milligrams) | |
| iron | mg (milligrams) | |
| magnesium | mg (milligrams) | |
| zinc | mg (milligrams) | |
| vitamin_c | mg (milligrams) | |
| vitamin_a | ug (micrograms) | |
| vitamin_d | ug (micrograms) | |
| vitamin_b12 | ug (micrograms) | |
| folate | ug (micrograms) | |
| caffeine | mg (milligrams) |
Converting
- From a label: kcal × 1,000 → mkcal; g × 1,000 → mg; mg as is; µg as is (mg × 1,000 for a vitamin stored in µg).
- For display: mkcal ÷ 1,000 → kcal; mg ÷ 1,000 → g for macros; sodium, potassium, calcium, cholesterol, caffeine and magnesium stay in mg.
- Nutrients from a photo are estimates from the matched food and the portion; a barcoded product uses its label; your edits override both.