Skip to content

nvif1989/compositions

Repository files navigation

Detailed nutrient composition of 592 key foods in India.

This is part of package nvif1989.
Source: Nutritive Value of Indian Foods 1989.

const compositions = require('@nvif1989/compositions');
// compositions.corpus: Map {code => {code, name, scie, lang, grup, tags, ...}}
// compositions.load(): Promise (corpus loaded)
// compositions.sql([table], [options]): Promise (sql commands)
// compositions.csv(): path to csv file
// compositions(<query>)
// -> [{code, name, scie, lang, grup, tags, ...}] for matched foods


async function main() {
await compositions.load();
/* load corpus first */

// NOTE: grup is wrong, curd is wrong
compositions('pine apple');
compositions('ananas comosus');
compositions('sapuri');
compositions('294');
// [
//   {
//     code: '294',
//     name: 'PINE APPLE',
//     scie: 'Ananas comosus',    lang: 'B. Anarash; G., H., Kan., Mar., P. Ananas; Mal. Kayitha chakka; O. Sapuri Anasianas; Tam. Anasi pazham; Tel. Anasa Pandu',
//     grup: 'Cereal grains and products',
//     tags: 'vegetarian eggetarian fishetarian veg',
//     enerc: 46,
//     water: 87.8,
//     ...
//   }
// ]

compositions('tell me about khoa.');
// [
//   {
//     code: '430',
//     name: 'KHOA (skimmed buffalo milk)',
//     scie: '',
//     lang: 'B., H., Kan., Mal., P., Tel. Khoa; O. Kua; Tam. Thirattu pal',
//     grup: 'Milk and Milk products',
//     tags: 'vegetarian eggetarian fishetarian veg',
//     enerc: 206,
//     water: 46.1,
//     ...
//   },
//   {
//     code: '429',
//     name: 'KHOA (whole buffalo milk)',
//     scie: '',
//     lang: '',
//     grup: 'Milk and Milk products',
//     tags: 'vegetarian eggetarian fishetarian veg',
//     enerc: 421,
//     water: 30.6,
//     ...
//   },
//   {
//     code: '431',
//     name: "KHOA (whole cow's milk)",
//     scie: '',
//     lang: 'B. Makhantana doodh; Kash Gurus; Mal. Padakalanya pal, O. Sarakadha dudha; Tam. Kudaintha pal; Tel. Venna theesina palu',
//     grup: 'Milk and Milk products',
//     tags: 'vegetarian eggetarian fishetarian veg',
//     enerc: 413,
//     water: 25.2,
//     ...
//   }
// ]
}
main();

nvif1989

You can ask about composition of 592 key foods in India here: nvif1989.github.io.
Food composition values were measured by National Institute of Nutrition, Hyderabad.
Take a peek at the raw data here: CSV.