NNutriTrace

USDA FOODDATA CENTRAL / FOUNDATION FOODS

A public dataset should arrive with receipts.

A reproducible pipeline that pins the source, enforces contracts, builds analytical tables, and publishes the evidence.

0120

Foundation foods

021,852

Nutrient observations

03181

Referenced nutrients

045

Published Parquet layers

QUALITY CONTRACT

Nothing passes silently.

Primary keys, foreign keys, nulls, units, ranges, and evidence coverage are tested before an analytical artifact is trusted.

Data quality checks
StatusContractObservedExpected
passfood rows present20> 0
passobservation rows present1852> 0
passfood primary key unique00 duplicates
passobservation primary key unique00 duplicates
passrequired food values complete00 nulls
passdescriptions non-blank00 blank values
passfood foreign keys valid00 orphan observations
warnnutrient foreign keys valid10 orphan nutrients
passcategory foreign keys valid00 orphan categories
passamounts non-negative00 negative values
warnamount completeness disclosed10 null amounts
passnutrient units recognized00 unsupported units
passper-100g macro ranges plausible00 values above 100 g/100 g
passenergy range plausible00 values above 1,000 kcal/100 g
passevery food has nutrient evidence00 foods without observations

CORE NUTRIENT COVERAGE

Missingness is visible.

Completeness is reported, never imputed. A blank analytical value remains an explicit absence.

energy kcal20/20

100.0% complete

protein g20/20

100.0% complete

fat g20/20

100.0% complete

carbohydrate g20/20

100.0% complete

fiber g11/20

55.0% complete

total sugars g16/20

80.0% complete

calcium mg20/20

100.0% complete

iron mg20/20

100.0% complete

potassium mg20/20

100.0% complete

sodium mg19/20

95.0% complete

DATA LINEAGE

One source. Four useful layers.

  1. 01
    Acquire

    Pinned USDA archive + SHA-256 verification

  2. 02
    Validate

    Typed schemas + relational quality gates

  3. 03
    Transform

    Dimensions, long fact, and wide nutrition profile

  4. 04
    Serve

    Compressed Parquet + indexed DuckDB + this report

QUERYABLE EVIDENCE

From raw tables to an answer.

The wide table stays convenient for analysis while the long fact preserves nutrient-level lineage.

SELECT
  description,
  category,
  protein_g,
  energy_kcal,
  fiber_g
FROM food_nutrition_wide
WHERE protein_g IS NOT NULL
ORDER BY protein_g DESC
LIMIT 6;
Foods with the highest protein in the committed sample
FDC IDFoodCategoryProteinEnergyFiber
331960Chicken, broiler or fryers, breast, skinless, boneless, meat only, cooked, braisedPoultry Products32.1 g166.0 kcal— g
325036Cheese, parmesan, gratedDairy and Egg Products29.6 g421.0 kcal— g
328637Cheese, cheddarDairy and Egg Products23.3 g408.0 kcal— g
323294Nuts, almonds, dry roasted, with salt addedNut and Seed Products20.4 g620.0 kcal11.0 g
334194Fish, tuna, light, canned in water, drained solidsFinfish and Shellfish Products19.0 g90.0 kcal— g
333374Fish, haddock, rawFinfish and Shellfish Products16.3 g74.0 kcal— g

REPRODUCE IT

Clone. Run one command.
Get the same validated layer.

uv sync --frozen
uv run food-pipeline run
Open repository ↗