我正在使用USDA API处理数据可视化应用。我正在拉食物并提取营养素,其中通常有90-150种不同的值。我希望获得一系列不同的营养成分,但我不确定每组中的内容会随着ID的跳跃而变化。
例如,我不确定Minerals是否应使用ID 301-317
或[301, 303, ... 312, 315, 317]
。
是否有一个位置包含所有这些营养素和ID用英语写的?我已经在nutrient list/search下载中查看了full USDA ACCESS database和PDF说明,但无法找到我正在寻找的内容。
编辑:我可以使用他们的小组来处理总结,但不幸的是,在一些营养素组中有重复的数据。例如,我相信有单独的异黄酮领域和总异黄酮'领域,总结将重复计算。
答案 0 :(得分:1)
如果您在USDA网站上下载了supporting data zip file,则可以找到一个名为“营养.csv”的csv文件。在其中,您将找到所有营养素编号及其关联名称。
csv文件的片段:
"id","name","unit_name","nutrient_nbr","rank"
"1002","Nitrogen","G","202","500"
"1003","Protein","G","203","600"
"1004","Total lipid (fat)","G","204","800"
"1005","Carbohydrate, by difference","G","205","1110"
"1007","Ash","G","207","1000"
"1008","Energy","KCAL","208","300"
"1009","Starch","G","209","2200"
"1010","Sucrose","G","210","1600"
"1011","Glucose (dextrose)","G","211","1700"
"1012","Fructose","G","212","1800"
答案 1 :(得分:0)
您可以在美国农业部的SR28参考指南here,第16页上查看所有营养信息。
我使用usda-sqlite将数据处理成SQLite。然后将其上传到https://sqliteonline.com/并运行自定义SQL命令。
SELECT * FROM nutrient;
- 打印出所有潜在的营养素&他们的数据。耶!SELECT Count(*) FROM food;
- 8789 SELECT Count(*) FROM food where food_group_id !=300 and food_group_id !=3500
- 8257 - 排除所有婴儿食品和美洲原住民食物SELECT id FROM food;
- [[food.id]] SELECT id,long_desc FROM food;
- [[food.id,food.long_desc]] SELECT id,name FROM nutrient;
- [[nutrient.id,nutrient.name]] SELECT count(*),food_group.name FROM food inner join food_group on food.food_group_id=food_group.id group by food_group_id;
- 每个食物组中所有食物的数量每种食物的份量,如果有的话
SELECT
food.id,
food.long_desc,
gm_weight
FROM food
INNER JOIN weight ON weight.food_id=food.id
where weight.description=='serving';
每100克食物的营养素含量
SELECT
food.id,
nutrient.name,
nutrition.amount
FROM nutrition
INNER JOIN food ON nutrition.food_id=food.id
INNER JOIN nutrient ON nutrition.nutrient_id=nutrient.id;
您可以将此数据导出到JSON并进行进一步处理,例如索引。
示例:导出到JSON后(使用左上角的按钮),最后一个示例为每个匹配WHERE子句的食物返回一个[food.id,nutrient.id,nutrition.amount]
数组。您可能希望对此进行索引以加快搜索速度并减少文件大小(否则这些数组中会有大量重复food.id
数据)。执行此操作后,我的JSON从大约10MB减少到7.0MB。
let b = Amt.reduce((total, curr) => {
const foodId = curr[0];
const nutrientId = curr[1];
const amt = curr[2];
const foodIsNew = !(foodId in total);
if (foodIsNew) total[foodId] = {};
total[foodId][nutrientId] = amt;
return total;
}, {})
console.log(JSON.stringify(b)); //note this add " characters to the beginning and end when printing to the console
看起来可用的SQL已经过时,与FDA API上的可用内容相比。我编写了一个脚本来插入API并获取所有营养素名称并将它们全部推送到一个对象中。这是结果:
{
"203": "Protein",
"204": "Total lipid (fat)",
"205": "Carbohydrate, by difference",
"207": "Ash",
"208": "Energy",
"209": "Starch",
"210": "Sucrose",
"211": "Glucose (dextrose)",
"212": "Fructose",
"213": "Lactose",
"214": "Maltose",
"221": "Alcohol, ethyl",
"255": "Water",
"257": "Adjusted Protein",
"262": "Caffeine",
"263": "Theobromine",
"268": "Energy",
"269": "Sugars, total",
"287": "Galactose",
"291": "Fiber, total dietary",
"301": "Calcium, Ca",
"303": "Iron, Fe",
"304": "Magnesium, Mg",
"305": "Phosphorus, P",
"306": "Potassium, K",
"307": "Sodium, Na",
"309": "Zinc, Zn",
"312": "Copper, Cu",
"313": "Fluoride, F",
"315": "Manganese, Mn",
"317": "Selenium, Se",
"318": "Vitamin A, IU",
"319": "Retinol",
"320": "Vitamin A, RAE",
"321": "Carotene, beta",
"322": "Carotene, alpha",
"323": "Vitamin E",
"324": "Vitamin D",
"325": "Vitamin D2",
"326": "Vitamin D3",
"328": "Vitamin D (D2 + D3)",
"334": "Cryptoxanthin, beta",
"337": "Lycopene",
"338": "Lutein + zeaxanthin",
"341": "Tocopherol, beta",
"342": "Tocopherol, gamma",
"343": "Tocopherol, delta",
"401": "Vitamin C",
"404": "Thiamin",
"405": "Riboflavin",
"406": "Niacin",
"410": "Pantothenic acid",
"415": "Vitamin B-6",
"417": "Folate, total",
"418": "Vitamin B-12",
"421": "Choline, total",
"430": "Vitamin K (phylloquinone)",
"431": "Folic acid",
"432": "Folate, food",
"435": "Folate, DFE",
"454": "Betaine",
"501": "Tryptophan",
"502": "Threonine",
"503": "Isoleucine",
"504": "Leucine",
"505": "Lysine",
"506": "Methionine",
"507": "Cystine",
"508": "Phenylalanine",
"509": "Tyrosine",
"510": "Valine",
"511": "Arginine",
"512": "Histidine",
"513": "Alanine",
"514": "Aspartic acid",
"515": "Glutamic acid",
"516": "Glycine",
"517": "Proline",
"518": "Serine",
"521": "Hydroxyproline",
"573": "Vitamin E, added",
"578": "Vitamin B-12, added",
"601": "Cholesterol",
"605": "Trans Fat",
"606": "Saturated Fat",
"607": "4:0",
"608": "6:0",
"609": "8:0",
"610": "10:0",
"611": "12:0",
"612": "14:0",
"613": "16:0",
"614": "18:0",
"615": "20:0",
"617": "18:1 undifferentiated",
"618": "18:2 undifferentiated",
"619": "18:3 undifferentiated",
"620": "20:4 undifferentiated",
"621": "DHA",
"624": "22:0",
"625": "14:1",
"626": "16:1 undifferentiated",
"627": "18:4",
"628": "20:1",
"629": "EPA",
"630": "22:1 undifferentiated",
"631": "DPA",
"636": "Phytosterols",
"638": "Stigmasterol",
"639": "Campesterol",
"641": "Beta-sitosterol",
"645": "Monounsaturated Fat",
"646": "Polyunsaturated Fat",
"652": "15:0",
"653": "17:0",
"654": "24:0",
"662": "16:1 t",
"663": "18:1 t",
"664": "22:1 t",
"665": "18:2 t not further defined",
"666": "18:2 i",
"669": "18:2 t,t",
"670": "18:2 CLAs",
"671": "24:1 c",
"672": "20:2 n-6 c,c",
"673": "16:1 c",
"674": "18:1 c",
"675": "18:2 n-6 c,c",
"676": "22:1 c",
"685": "18:3 n-6 c,c,c",
"687": "17:1",
"689": "20:3 undifferentiated",
"693": "Fatty acids, total trans-monoenoic",
"696": "13:0",
"697": "15:1",
"710": "Daidzein",
"711": "Genistein",
"712": "Glycitein",
"713": "Total isoflavones",
"714": "Biochanin A",
"715": "Formononetin",
"716": "Coumestrol",
"731": "Cyanidin",
"734": "Proanthocyanidin dimers",
"735": "Proanthocyanidin trimers",
"736": "Proanthocyanidin 4-6mers",
"737": "Proanthocyanidin 7-10mers",
"738": "Proanthocyanidin polymers (>10mers)",
"740": "Petunidin",
"741": "Delphinidin",
"742": "Malvidin",
"743": "Pelargonidin",
"745": "Peonidin",
"749": "(+)-Catechin",
"750": "(-)-Epigallocatechin",
"751": "(-)-Epicatechin",
"752": "(-)-Epicatechin 3-gallate",
"753": "(-)-Epigallocatechin 3-gallate",
"758": "Eriodictyol",
"759": "Hesperetin",
"762": "Naringenin",
"770": "Apigenin",
"773": "Luteolin",
"785": "Isorhamnetin",
"786": "Kaempferol",
"788": "Myricetin",
"789": "Quercetin",
"794": "(+)-Gallocatechin",
"851": "ALA",
"853": "20:3 n-6",
"855": "20:4 n-6",
"856": "18:3i",
"857": "21:5",
"858": "22:4"
}