Code Monkey home page Code Monkey logo

nutrientkit's Introduction

Carthage compatible

NutrientKit

Search over 200,000 food and nutrient reports provided by the USDA.

Food Search Food Reports
Food Search Food Report

Usage

NutrientKit (NutrientKit.framework) integrates with the USDA National Nutrient Database for Standard Reference via the USDA NDB API. Food composition data is in the public domain, there is no copyright and no permission is needed for its use.

To use NutrientKit in your app, you'll need to sign up for a Data.gov API key.

Nutrient Store

First, create a NutrientStore with your API key:

let nutrientStore = NutrientStore(apiKey: "YOUR_API_KEY")

Search

A search request sends keyword queries and returns lists of foods which contain one or more of the keywords in the food description, scientific name, or commerical name fields.

let query = "Cheddar cheese"
    
nutrientStore.search(withQuery: query, dataSource: . standardReference) { page, error in
	// Reload the list of search items.
}

NDB API Search Documentation

Food Reports

A food report is a list of nutrients and their values in various portions for a specific food.

let ndbno = "01009" // Cheese, cheddar

nutrientStore.basicReport(forNDBno: ndbno) { report, error in
    // Present the food report.
}

NDB API Food Report V2 Documentation

Example

A simple example project is provided in the NutrientKitExample directory.

Installation

Add:

github "bfahey/NutrientKit"

To your Cartfile.

Acknowledgements

  • US Department of Agriculture, Agricultural Research Service, Nutrient Data Laboratory. USDA National Nutrient Database for Standard Reference, Release 28. Version Current: September 2015, slightly revised May 2016. Nutrient Data Laboratory Home Page

  • U.S. Department of Agriculture, Agricultural Research Service. USDA Branded Food Products Database. Nutrient Data Laboratory Home Page

nutrientkit's People

Contributors

bfahey avatar

Stargazers

JillShu avatar Evan Conkle avatar Ufuk Ayyıldız avatar Brue avatar

Watchers

 avatar JillShu avatar Ufuk Ayyıldız avatar

Forkers

agent001

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.