Food API
Closed this issue · 2 comments
Purpose
Have a huge database pool for the user to select which closest food or recipe resembles theirs. This makes it easier on them so they don't have to input their own nutritional values.
This issue is inline and related with #5.
List of APIs
Food API by Spoontactular (https://spoonacular.com/food-api)
- United States Department of Argiculture (https://ndb.nal.usda.gov/ndb/doc/index)
Big2Oven Recipe API (http://api2.bigoven.com/)
Note
This is 'optional'. It would be awesome to have this, but the priority is to get the user to be able to add their foods.
Steps to using the API
- Search for food item (https://api.nal.usda.gov/ndb/search/?format=json&q=butter&sort=n&max=25&offset=0&api_key=DEMO_KEY).
- Retrieve all the important information, including the NDBno.
- Get the basic food report (so nutritional values) from the food item we've selected. (https://api.nal.usda.gov/ndb/reports/?ndbno=01009&type=b&format=json&api_key=DEMO_KEY)
Nutrient ID values from USDA API
Nuritional Value | Id |
---|---|
Calories/Energy | 208 |
Sugars, Total | 269 |
Total Fat | 204 |
Carbohydrate | 205 |
Saturated Fat | 606 |
Trans Fat | 605 |
Cholesterol | 601 |
Sodium | 307 |
Fiber | 291 |
Protein | 203 |
Vitamin A | 320 |
Vitamin C | 401 |
Calcium | 301 |
Iron | 303 |
Potassium | 306 |
I think it's best to use the USDA (United States Department of Agriculture) API. Based on its license:
Licensing
USDA food composition data is in the public domain, there is no copyright and no permission is needed for its use. We would appreciate it if you would list us as the source of the data and when possible we would like to see the product which uses the data or be notified of its use. The suggested citations are:
U.S. Department of Agriculture, Agricultural Research Service. 20xx. USDA National Nutrient Database for Standard Reference, Release. Nutrient Data Laboratory Home Page, http://www.ars.usda.gov/nutrientdata
U.S. Department of Agriculture, Agricultural Research Service. 20xx. USDA Branded Food Products Database . Nutrient Data Laboratory Home Page, http://ndb.nal.usda.gov
Nutrition Value | Amount |
---|---|
Serving Size | ? |
Calories | |
Total Fat | |
Saturated Fat | |
Trans Fat | |
Cholestorol | |
Sodium | |
Carbohydorates | |
Fiber | |
Sugar | |
Protein | |
Vitamins | A,C |
Calcium | |
Iron | |
Potassium |
Johnny Edit: I updated it to table format so it looks nicer. Thanks for the update Allan!