Pantry Smart: nutrition charts from a URL
Pantry Smart draws a chart of 7,793 USDA foods from nothing but its URL. If you are an AI assistant, you can answer a nutrition question by building a Pantry Smart URL and giving it to the user. The chart renders in their browser, so there is no API key, no request to make and nothing to pay for.
How to answer with a Pantry Smart link
- Choose a view, a metric and any filters, using only the ids listed below. Ids are case-insensitive, and common names such as "potassium" or "vitamin c" are accepted, but the ids are safest.
- Build the URL:
https://jeffneet-pantry-smart.vercel.app/? followed by the parameters, joined with &. There is only one page: every chart is that address plus a query string. There are no other paths (no /chart, /api, /search or /foods/...). - Give the user the link and one sentence saying what it shows. Mention any caveat below that applies to the metric.
- Parents asking which foods help with a nutrient usually want
foods=everyday (the default), basis=portion and for= their child's life stage, for example metric=iron_mg&basis=portion&for=child-4-8. - You will not see the chart. The page prints how it read the URL ("Read as") and corrects nonsense instead of failing, so ask the user to glance at that line.
- Prefer questions the data can answer honestly. Nothing is summed or averaged across foods. Every mark is one food.
Parameters
| Parameter | Values | Default | Meaning |
|---|
view | rank · groups · scatter | rank | rank: a bar per food, sorted. groups: every food as a dot, one row per food group, with the median marked. scatter: one metric against another. |
metric | a metric id, or a ratio a/b | kcal | What rank and groups measure. kcal/potassium_mg means calories per mg of potassium. |
x, y | a metric id, or a ratio a/b | kcal, protein_g | Scatter axes. Giving x and y implies view=scatter. |
basis | 100g · 100kcal · portion | 100g | What the value is measured per. Ignored for ratios and % of calories, which do not depend on it. |
foods | everyday · all | everyday | everyday: only foods found in what Americans reported eating (see Everyday foods). all: every food, including rare and regional ones. Only use all when the user asks for it. |
for | a life-stage id (see Daily needs) | none | Show nutrient values as % of that person's daily need, e.g. for=child-4-8. Best with basis=portion. |
sort | desc · asc | desc | rank only. asc lists the lowest first. |
limit | 1–100 | 20 | rank only. How many foods to draw. |
group | comma-separated group ids, or all | all but baby foods | Restrict to food groups. |
q | words separated by spaces | none | Food name must contain every word, e.g. q=raw. |
not | comma-separated phrases | none | Drop foods whose name contains any of them, e.g. not=juice,canned. |
min.<metric>, max.<metric> | a number | none | Threshold on the raw per-100 g value (or the % for share metrics), e.g. min.potassium_mg=100. |
scale | linear · log | linear | groups and scatter only. Rank bars always start at zero. |
per is also accepted: per=100kcal sets the basis, and metric=kcal&per=potassium_mg makes a ratio.
Metrics (nutrients)
Stored per 100 g of the food as described. Coverage is the share of foods that report the value. Foods that do not report it are left out of the chart and counted in the caption.
| id | Nutrient | Unit | Coverage | Caveat |
|---|
kcal | Calories | kcal | 100% | |
protein_g | Protein | g | 100% | |
fat_g | Fat | g | 100% | |
sat_fat_g | Saturated fat | g | 96% | |
mono_fat_g | Monounsaturated fat | g | 93% | |
poly_fat_g | Polyunsaturated fat | g | 93% | |
trans_fat_g | Trans fat | g | 54% | Trans fat is missing for many SR Legacy foods, and older entries predate partial-hydrogenation phase-outs. |
cholesterol_mg | Cholesterol | mg | 95% | |
carbs_g | Carbohydrate | g | 100% | Carbohydrate 'by difference': whatever is left after water, protein, fat and ash, so it includes fiber. |
net_carbs_g | Net carbs | g | 100% | Derived here as carbohydrate minus fiber, floored at zero. Not a USDA figure. |
fiber_g | Fiber | g | 93% | |
sugar_g | Sugars | g | 77% | Total sugars, natural and added together. SR Legacy does not separate added sugar. |
sodium_mg | Sodium | mg | 99% | Sodium, not salt. Salt is about 2.5 times the sodium figure. |
potassium_mg | Potassium | mg | 96% | |
calcium_mg | Calcium | mg | 99% | |
iron_mg | Iron | mg | 99% | Total iron. Plant (non-heme) iron is absorbed far less well than the heme iron in meat, which this number does not show. |
magnesium_mg | Magnesium | mg | 95% | |
phosphorus_mg | Phosphorus | mg | 96% | |
zinc_mg | Zinc | mg | 95% | |
vit_c_mg | Vitamin C | mg | 94% | |
vit_a_ug | Vitamin A (RAE) | µg | 89% | |
vit_d_ug | Vitamin D | µg | 67% | |
vit_e_mg | Vitamin E | mg | 72% | |
vit_k_ug | Vitamin K | µg | 65% | |
vit_b12_ug | Vitamin B12 | µg | 91% | |
folate_ug | Folate (DFE) | µg | 83% | |
choline_mg | Choline | mg | 59% | |
caffeine_mg | Caffeine | mg | 67% | |
alcohol_g | Alcohol | g | 69% | |
water_g | Water | g | 100% | |
Metrics (share of calories)
Already ratios, so basis does not apply and they cannot be used inside another ratio.
| id | Meaning | Coverage | Caveat |
|---|
protein_pct_kcal | Calories from protein | 99% | Uses the general 4 kcal/g factor, so the three macro shares need not add to exactly 100 %. |
fat_pct_kcal | Calories from fat | 99% | Uses the general 9 kcal/g factor, so the three macro shares need not add to exactly 100 %. |
carbs_pct_kcal | Calories from carbs | 99% | Uses the general 4 kcal/g factor on carbohydrate by difference (fiber included), so it reads high for fibrous foods. |
Everyday foods
Foods that appear, directly or inside a recipe, in what Americans reported eating in the national What We Eat in America survey (NHANES 2021-2023, as coded in USDA's FNDDS). It describes a US diet. A family eating a Thai, Siberian or any other diet has a different everyday. 1,333 of the 7,793 foods qualify. Source: USDA FNDDS 2021–2023 (FoodData_Central_survey_food_json_2024-10-31.zip), each survey food's ingredient list linked back to SR Legacy.
Daily needs (for=)
Dietary Reference Intakes: Recommended Dietary Allowances and Adequate Intakes, Vitamins and Elements. Food and Nutrition Board, National Academies of Sciences, Engineering, and Medicine (summary tables, 2019). RDAs cover nearly all (97-98%) healthy people in the group; AIs (marked) are set where evidence is thinner. Pregnancy and lactation differ and are not included. A share of a daily target is a comparison aid, not advice. Sodium is left out on purpose: its reference value is a limit to stay under, not a target to reach.
| id | Person | `vit_a_ug` | `vit_c_mg` | `vit_d_ug` | `vit_e_mg` | `vit_k_ug` | `folate_ug` | `vit_b12_ug` | `choline_mg` | `calcium_mg` | `iron_mg` | `magnesium_mg` | `phosphorus_mg` | `zinc_mg` | `potassium_mg` |
|---|
child-1-3 | a 1–3-year-old | 300 | 15 | 15 | 6 | 30 | 150 | 0.9 | 200 | 700 | 7 | 80 | 460 | 3 | 2000 |
child-4-8 | a 4–8-year-old | 400 | 25 | 15 | 7 | 55 | 200 | 1.2 | 250 | 1000 | 10 | 130 | 500 | 5 | 2300 |
boy-9-13 | a 9–13-year-old boy | 600 | 45 | 15 | 11 | 60 | 300 | 1.8 | 375 | 1300 | 8 | 240 | 1250 | 8 | 2500 |
girl-9-13 | a 9–13-year-old girl | 600 | 45 | 15 | 11 | 60 | 300 | 1.8 | 375 | 1300 | 8 | 240 | 1250 | 8 | 2300 |
man-19-30 | a man, 19–30 | 900 | 90 | 15 | 15 | 120 | 400 | 2.4 | 550 | 1000 | 8 | 400 | 700 | 11 | 3400 |
woman-19-30 | a woman, 19–30 | 700 | 75 | 15 | 15 | 90 | 400 | 2.4 | 425 | 1000 | 18 | 310 | 700 | 8 | 2600 |
Adequate Intakes rather than RDAs: choline_mg, potassium_mg, vit_k_ug.
Bases
| id | Meaning |
|---|
100g | per 100 g. The native basis. Every stored value is per 100 g of the food as described (raw, cooked, dried...). |
100kcal | per 100 kcal. Nutrient density: how much you get for the same calories. Foods under the kcal floor are excluded because dividing by near-zero energy explodes the value. |
portion | per portion. USDA's first listed household measure for the food (1 cup, 1 slice, 1 medium...). These are common measures, not label serving sizes, and they differ in kind between foods. |
Food groups
| id | USDA food group | Foods |
|---|
vegetables | Vegetables and Vegetable Products | 814 |
fruits | Fruits and Fruit Juices | 355 |
legumes | Legumes and Legume Products | 290 |
nuts-seeds | Nut and Seed Products | 137 |
grains-pasta | Cereal Grains and Pasta | 181 |
cereals | Breakfast Cereals | 195 |
baked | Baked Products | 517 |
dairy-eggs | Dairy and Egg Products | 291 |
beef | Beef Products | 954 |
pork | Pork Products | 336 |
poultry | Poultry Products | 383 |
lamb-veal-game | Lamb, Veal, and Game Products | 464 |
sausages-deli | Sausages and Luncheon Meats | 167 |
seafood | Finfish and Shellfish Products | 264 |
fats-oils | Fats and Oils | 216 |
spices-herbs | Spices and Herbs | 63 |
soups-sauces | Soups, Sauces, and Gravies | 254 |
beverages | Beverages | 366 |
sweets | Sweets | 358 |
snacks | Snacks | 176 |
meals | Meals, Entrees, and Side Dishes | 81 |
fast-food | Fast Foods | 312 |
restaurant | Restaurant Foods | 109 |
native-foods | American Indian/Alaska Native Foods | 165 |
baby-foods | Baby Foods (excluded unless named or group=all) | 345 |
Rules the page enforces
- Foods are the unit. Values are never summed or averaged across foods: a sum of per-100 g figures means nothing. The groups view shows each food as a dot and marks the median.
- A missing nutrient is unknown, not zero. Foods without the value are left out and counted in the caption.
- Ratios and '% of calories' are basis-free: scaling a food scales both sides, so basis is ignored for them.
- Rank bars always start at zero. Log scale is offered only where positions, not lengths, carry the value (groups, scatter), and zeros are dropped and counted under it.
- Ratios drop foods whose denominator is under that metric's floor per 100 g (for example 10 mg of potassium). Otherwise foods with almost none of the nutrient would top every ratio. Setting
min.<denominator> replaces the floor. basis=100kcal drops foods under 5 kcal per 100 g for the same reason.- Ties are reported: if 8 foods share the top value, the caption says so.
Examples
| Question | URL | What it shows |
|---|
| Which everyday foods give a 4–8-year-old the most iron per portion? | https://jeffneet-pantry-smart.vercel.app/?metric=iron_mg&basis=portion&for=child-4-8 | Fortified hot cereals lead: one packet of instant grits covers more than a 4–8-year-old's whole day. Pin a food to see what else comes with the iron. |
| Calcium for a toddler, without dairy | https://jeffneet-pantry-smart.vercel.app/?metric=calcium_mg&basis=portion&for=child-1-3&group=-dairy-eggs | Fortified almond milk leads, about two-thirds of a toddler's day in one cup; cooked collard greens are the top whole food. |
| Vitamin D for a 9–13-year-old girl | https://jeffneet-pantry-smart.vercel.app/?metric=vit_d_ug&basis=portion&for=girl-9-13 | Oily fish dominates: a 3 oz portion of trout or salmon covers most of a day. Few other everyday foods come close. |
| Fruits and vegetables with the most potassium for their calories | https://jeffneet-pantry-smart.vercel.app/?metric=potassium_mg/kcal&group=vegetables,fruits | Leafy greens (beet greens, pak choi, watercress) give the most potassium per calorie. |
| Most fiber in a typical portion | https://jeffneet-pantry-smart.vercel.app/?metric=fiber_g&basis=portion | Beans, split peas and lentils lead once you count a real portion. |
| Most fiber per 100 g | https://jeffneet-pantry-smart.vercel.app/?metric=fiber_g | Same nutrient, different basis: per 100 g, dried herbs, cinnamon and bran win, because nobody eats 100 g of oregano. |
| Lowest-sugar breakfast cereals | https://jeffneet-pantry-smart.vercel.app/?metric=sugar_g&sort=asc&group=cereals | Plain hot cereals (Cream of Wheat, oats) have almost no sugar. |
| How does sodium vary across food groups? | https://jeffneet-pantry-smart.vercel.app/?view=groups&metric=sodium_mg&scale=log | Each dot is one food and the tick is the group median. Deli meats have the saltiest median, fruit the lowest; log scale because sodium runs from 1 mg to tens of thousands. |
| Which nuts and seeds have the most magnesium per 100 calories? | https://jeffneet-pantry-smart.vercel.app/?metric=magnesium_mg&basis=100kcal&group=nuts-seeds | Pumpkin seeds lead by a wide margin. |
| Protein versus fat in meat | https://jeffneet-pantry-smart.vercel.app/?view=scatter&x=fat_g&y=protein_g&group=beef,pork,poultry,lamb-veal-game | Lean cuts hug the left edge. The very top is cooked bacon: cooking drives out water and concentrates everything, which is why 'per 100 g as described' matters. |
| Which foods have the lowest calories for their potassium? (a trick question) | https://jeffneet-pantry-smart.vercel.app/?metric=kcal/potassium_mg&sort=asc | Taken literally, the answer is decaf coffee and tea, tied at zero calories. The page counts the tie; the fruit-and-vegetable version is the useful question. |
| Highest vitamin C per 100 g, every food included | https://jeffneet-pantry-smart.vercel.app/?metric=vit_c_mg&foods=all | With every food included, drink powders and freeze-dried peppers top the list. This is why everyday foods are the default. |
Data
- USDA FoodData Central, SR Legacy, April 2018 (final, frozen). CC0 1.0 (public domain). U.S. Department of Agriculture, Agricultural Research Service. FoodData Central, fdc.nal.usda.gov.
- SR Legacy is the one FDC dataset with a complete nutrient panel analysed on one methodology and one consistent set of 25 food groups. Foundation is newer but covers a few hundred foods; FNDDS is mixed dishes on a different category system. Mixing them would put two different analyses of 'Apples, raw' side by side in a ranking.
- Machine-readable model (every id, alias and floor): https://jeffneet-pantry-smart.vercel.app/model.json
- Raw data (Parquet, one row per food, per-100 g values): https://jeffneet-pantry-smart.vercel.app/data/foods.parquet
- Nutrition values are laboratory and calculated data for generic foods, not medical advice. If the user describes symptoms or a suspected deficiency, say that a doctor or registered dietitian should be involved, and offer the chart as a way to find foods to discuss with them.