美国农业部成分API中的所有营养成分是什么?
我正在使用。我正在提取食物和营养素,其中通常有90-150个不同的值。我想得到不同营养组的总和,但不确定当ID跳跃时每个组中会有什么 例如,我不确定矿物是否应该使用ID美国农业部成分API中的所有营养成分是什么?,api,Api,我正在使用。我正在提取食物和营养素,其中通常有90-150个不同的值。我想得到不同营养组的总和,但不确定当ID跳跃时每个组中会有什么 例如,我不确定矿物是否应该使用ID301-317或[301,303,…312,315,317] 有没有一个地方用英语列出了所有这些营养素和ID?我已经检查了下载中的文档和PDF说明,但没有找到我要找的内容 编辑:我可以使用他们的分组来处理汇总,但不幸的是,在一些营养组中有重复的数据。例如,我认为有单独的异黄酮字段和“总异黄酮”字段,求和将双重计算。您可以在美国农
301-317
或[301,303,…312,315,317]
有没有一个地方用英语列出了所有这些营养素和ID?我已经检查了下载中的文档和PDF说明,但没有找到我要找的内容
编辑:我可以使用他们的分组来处理汇总,但不幸的是,在一些营养组中有重复的数据。例如,我认为有单独的异黄酮字段和“总异黄酮”字段,求和将双重计算。您可以在美国农业部SR28参考指南第16页上看到所有营养信息 我曾经将数据处理成SQLite。然后将其上载到并运行自定义SQL命令 SQL
从营养素中选择*代码>-打印出所有潜在营养素及其数据。耶李>
从食物中选择Count(*)代码>-8789
-8257-不包括所有婴儿食品和美洲土著食品从食物组id所在的食物中选择计数(*)=300和食物组id=3500
从食物中选择id代码>-[[food.id]]
从食物中选择id、long\u desc代码>-[[food.id,food.long\u desc]]
从中选择id、name代码>-[[nutrient.id,nutrient.name]]
选择count(*),food_group.name FROM food internal join food_group on food.food_group id=food_group.id按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
更新
与FDA API上的可用SQL相比,可用SQL似乎已经过时。我编写了一个脚本,插入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"
}
如果你在美国农业部网站上下载,你可以找到一个名为“nutrient.csv”的csv文件。在中,您将找到所有营养素id及其相关名称
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"
似乎每种营养素都有一个独特的名称。为什么你不能处理它们?请提供一个你想要接收的JSON数据的例子。我已经检查了几个食物条目,我看到这个列表已经增加了。但找不到任何包含当前代码完整列表的文档。