Coder Social home page Coder Social logo

usda-nutrient-database's Introduction

Stories in Ready Code Climate Build Status Coverage Status Dependency Status Gem Version Gitter chat

USDA Nutrient Database

The USDA nutrition database is a great source of nutrition information. However, the data formatting options (plain text ASCII files or MS-Access) leave a little to be desired.

This is a simple gem to import the database into your ruby application.

Using the USDA Nutrient Database REST API instead

Even after importing this data, keeping it up to date and adding/maintaining additional logic such as full text search, weight conversion, etc is a pain. As an alternative I have put together a small RESTful web service to do this for you. You can find the docs at http://docs.usdanutrientservice.apiary.io/

Installation

Add this line to your application's Gemfile:

gem 'usda-nutrient-database'

And then execute:

$ bundle

Or install it yourself as:

$ gem install usda-nutrient-database

If you're using rails then copy the migrations across:

rake usda_nutrient_database_engine:install:migrations

Usage

Import the latest data with the import task:

rake usda:import

This is going to take a while. 60+ minutes on my 2.66 GHz i7 macbook pro. You ca also import individual tables using the other import tasks. To see the available tasks:

rake -T usda

Use the models to query and profit:

UsdaNutrientDatabase::FoodGroup
UsdaNutrientDatabase::Food
UsdaNutrientDatabase::Nutrient
UsdaNutrientDatabase::FoodsNutrient
UsdaNutrientDatabase::Weight
UsdaNutrientDatabase::SourceCode

Issues

If you find a bug then add it to the issues here on github. Ideally with a pull request to fix it, or at least with a failing test. When you report a bug, number 1 rule is: don't be a dick.

Any feature requests/ideas can also go in the issues list.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors

Many thanks to the following contributers:

Versioning

This gem follows Semantic Versioning

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.