@infoods/tagnames

Food Component Identifiers (Tagnames) by International Network of Food Data Systems (INFOODS).

Usage no npm install needed!

<script type="module">
  import infoodsTagnames from 'https://cdn.skypack.dev/@infoods/tagnames';
</script>

README

Food Component Identifiers (Tagnames) by International Network of Food Data Systems (INFOODS).

const tagnames = require('@infoods/tagnames');
// tagnames.corpus: Map {code => {code, name, synonyms, unit, tables, comments, examples}}
// tagnames.load(): true (corpus loaded)
// tagnames.sql([table], [options]): sql commands
// tagnames.csv(): path to csv file
// tagnames(<query>)
// -> [{code, name, synonyms, unit, tables, comments, examples}] for matched tagnames


tagnames.load();
/* load corpus first */

tagnames('vitamin c');
tagnames('c-vitamin');
// [
//   {
//     code: 'VITC',     
//     name: 'vitamin C',
//     synonyms: 'ascorbic acid; ascorbate (Note that these terms are not true synonyms but are often found in food tables to refer to vitamin C.)',
//     unit: 'mg',
//     tables: 'USDA 401, SFK, MW, ETH, IND, NE, EA, PRC, DAN',
//     comments: 'L-ascorbic acid plus L- dehydroascorbic acid.',
//     examples: ''
//   },
//   ...
// ]


tagnames('what is butyric acid?');
tagnames('c4:0 stands for?');
// [  
//   {
//     code: 'F4D0F',
//     name: 'fatty acid 4:0; expressed per quantity of total fatty acids',
//     synonyms: 'butyric acid; tetranoic acid',
//     unit: 'g/100 g fatty acid',
//     tables: 'MW, FRN, DAN, SWD',
//     comments: '',
//     examples: ''
//   },
//   ...
// ]

You can ask about composition of 528 key foods in India here: ifct2017.github.io.
Food composition values were measured by National Institute of Nutrition, Hyderabad.