| --- |
| pretty_name: NutrientsDB Sample Data |
| language: |
| - en |
| tags: |
| - nutrition |
| - food-composition |
| - nutrient-database |
| - json |
| --- |
| |
| # NutrientsDB Sample Data |
|
|
| A small, representative sample from [NutrientsDB](https://www.nutrientsdb.com/), the global |
| food composition database for developers, researchers, and AI builders. |
|
|
| The full database has **2.9M+ food entries** across **86 nutrient fields**, normalized to |
| standard units and deduplicated across 180+ countries. This repo contains a tiny slice so |
| you can inspect the shape of the data before getting the full dataset. |
|
|
| ## What's here |
|
|
| | File | Description | |
| | --- | --- | |
| | [`sample.json`](sample.json) | 1,000 food entries with the complete 86-field nutrient schema | |
|
|
| This mirrors the free 1,000-food sample available at [nutrientsdb.com](https://www.nutrientsdb.com/). |
|
|
| Github: https://github.com/colinearstudio/nutrientsdb-sample |
| Hf: https://huggingface.co/datasets/colinearstudio/nutrientsdb |
|
|
| ## Working with the data |
|
|
| The data is plain JSON, so it loads in any language with no database server required. |
|
|
| ```python |
| import json |
| |
| with open("sample.json") as f: |
| foods = json.load(f) |
| |
| for food in foods: |
| n = food["nutrients"] |
| print(food["name"], n["energy_kcal"], "kcal") |
| ``` |
|
|
| ## Data schema |
|
|
| Each record has a stable `public_id`, a human-readable `name`, and a `nutrients` object. |
| All 86 nutrient keys are present on every entry. Values are numbers, or `null` when a |
| source does not report that nutrient. |
|
|
| ```json |
| { |
| "public_id": 2923506, |
| "name": "Turkey, drumstick, from whole bird, meat only, raw", |
| "nutrients": { |
| "energy_kcal": 109.0, |
| "protein_g": 23.66, |
| "fat_g": 1.48, |
| "carbs_g": 0.14, |
| "vitamin_b12_ug": 0.63, |
| "potassium_mg": 242.0 |
| } |
| } |
| ``` |
|
|
| All values are per 100 g of the food, the standard basis for food composition data. |
|
|
| ## Units |
|
|
| The unit is encoded as a suffix on each field name. |
|
|
| | Suffix | Unit | |
| | --- | --- | |
| | `_g` | grams (g) | |
| | `_mg` | milligrams (mg) | |
| | `_ug` | micrograms (mcg) | |
| | `_kcal` | kilocalories (kcal) | |
|
|
| ### Energy and macronutrients |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `energy_kcal` | kcal | Total food energy | |
| | `protein_g` | g | Total protein | |
| | `fat_g` | g | Total fat (lipids) | |
| | `carbs_g` | g | Total carbohydrate | |
| | `fiber_g` | g | Dietary fiber | |
| | `starch_g` | g | Starch | |
| | `water_g` | g | Water content | |
| | `alcohol_g` | g | Alcohol (ethanol) | |
|
|
| ### Carbohydrates and sugars |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `sugar_g` | g | Total sugars | |
| | `sugar_added_g` | g | Added sugars | |
| | `glucose_g` | g | Glucose (dextrose) | |
| | `fructose_g` | g | Fructose | |
| | `galactose_g` | g | Galactose | |
| | `sucrose_g` | g | Sucrose | |
| | `lactose_g` | g | Lactose | |
| | `maltose_g` | g | Maltose | |
|
|
| ### Fats and fatty acids |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `saturated_fat_g` | g | Total saturated fat | |
| | `monounsaturated_fat_g` | g | Total monounsaturated fat | |
| | `polyunsaturated_fat_g` | g | Total polyunsaturated fat | |
| | `trans_fat_g` | g | Trans fat | |
| | `cholesterol_mg` | mg | Cholesterol | |
| | `fatty_acid_4_0_g` | g | Butyric acid (4:0) | |
| | `fatty_acid_16_0_g` | g | Palmitic acid (16:0) | |
| | `fatty_acid_18_0_g` | g | Stearic acid (18:0) | |
| | `fatty_acid_18_1_g` | g | Oleic acid (18:1) | |
| | `fatty_acid_18_2_n6_g` | g | Linoleic acid (18:2 n-6) | |
| | `fatty_acid_18_3_n3_g` | g | Alpha-linolenic acid, ALA (18:3 n-3) | |
| | `fatty_acid_20_5_n3_g` | g | Eicosapentaenoic acid, EPA (20:5 n-3) | |
| | `fatty_acid_22_6_n3_g` | g | Docosahexaenoic acid, DHA (22:6 n-3) | |
|
|
| ### Minerals |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `calcium_mg` | mg | Calcium | |
| | `iron_mg` | mg | Iron | |
| | `magnesium_mg` | mg | Magnesium | |
| | `phosphorus_mg` | mg | Phosphorus | |
| | `potassium_mg` | mg | Potassium | |
| | `sodium_mg` | mg | Sodium | |
| | `chloride_mg` | mg | Chloride | |
| | `zinc_mg` | mg | Zinc | |
| | `copper_mg` | mg | Copper | |
| | `manganese_mg` | mg | Manganese | |
| | `selenium_ug` | mcg | Selenium | |
| | `iodine_ug` | mcg | Iodine | |
| | `fluoride_ug` | mcg | Fluoride | |
| | `chromium_mg` | mg | Chromium | |
| | `molybdenum_ug` | mcg | Molybdenum | |
| | `phytate_mg` | mg | Phytate (phytic acid) | |
|
|
| ### Vitamins |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `vitamin_a_rae_ug` | mcg | Vitamin A (retinol activity equivalents) | |
| | `thiamin_mg` | mg | Vitamin B1 (thiamin) | |
| | `riboflavin_mg` | mg | Vitamin B2 (riboflavin) | |
| | `niacin_mg` | mg | Vitamin B3 (niacin) | |
| | `niacin_equivalents_mg` | mg | Niacin equivalents (NE) | |
| | `pantothenic_acid_mg` | mg | Vitamin B5 (pantothenic acid) | |
| | `vitamin_b6_mg` | mg | Vitamin B6 | |
| | `biotin_ug` | mcg | Vitamin B7 (biotin) | |
| | `folate_ug` | mcg | Folate (B9) | |
| | `vitamin_b12_ug` | mcg | Vitamin B12 | |
| | `vitamin_c_mg` | mg | Vitamin C (ascorbic acid) | |
| | `vitamin_d_ug` | mcg | Vitamin D | |
| | `vitamin_e_mg` | mg | Vitamin E (alpha-tocopherol) | |
| | `vitamin_k_ug` | mcg | Vitamin K | |
| | `choline_mg` | mg | Choline | |
|
|
| ### Carotenoids |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `alpha_carotene_ug` | mcg | Alpha-carotene | |
| | `beta_carotene_ug` | mcg | Beta-carotene | |
| | `beta_cryptoxanthin_ug` | mcg | Beta-cryptoxanthin | |
| | `lutein_zeaxanthin_ug` | mcg | Lutein and zeaxanthin | |
| | `lycopene_ug` | mcg | Lycopene | |
|
|
| ### Amino acids |
|
|
| All amino acids are reported in grams. |
|
|
| | Field | Description | Field | Description | |
| | --- | --- | --- | --- | |
| | `histidine_g` | Histidine | `alanine_g` | Alanine | |
| | `isoleucine_g` | Isoleucine | `arginine_g` | Arginine | |
| | `leucine_g` | Leucine | `aspartic_acid_g` | Aspartic acid | |
| | `lysine_g` | Lysine | `cystine_g` | Cystine | |
| | `methionine_g` | Methionine | `glutamic_acid_g` | Glutamic acid | |
| | `phenylalanine_g` | Phenylalanine | `glycine_g` | Glycine | |
| | `threonine_g` | Threonine | `proline_g` | Proline | |
| | `tryptophan_g` | Tryptophan | `hydroxyproline_g` | Hydroxyproline | |
| | `valine_g` | Valine | `serine_g` | Serine | |
| | `tyrosine_g` | Tyrosine | | | |
|
|
| ### Other compounds |
|
|
| | Field | Unit | Description | |
| | --- | --- | --- | |
| | `caffeine_mg` | mg | Caffeine | |
| | `theobromine_mg` | mg | Theobromine | |
|
|