usda-nutrient-database 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -3
- data/db/migrate/1_create_usda_food_groups.rb +1 -1
- data/db/migrate/4_create_usda_nutrients.rb +1 -1
- data/lib/tasks/usda_nutrient_database.rake +1 -1
- data/lib/usda-nutrient-database.rb +1 -0
- data/lib/usda_nutrient_database/engine.rb +6 -0
- data/lib/usda_nutrient_database/nutrient.rb +1 -0
- data/lib/usda_nutrient_database/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b5a0b3447d833e6c29476c14ec6412732351f22
|
4
|
+
data.tar.gz: 3e08d047a6997358351a37f17181bd7552fa0c37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 899ea32be0548efc1a3102c465eb1493604512e515f8dc38f169ea9bde12599940d09766bcee3f9648c7ee250135a91908284130c7805a183134ad4e2e6663e9
|
7
|
+
data.tar.gz: d9ffd8fb8cca6e0079e88dc667bd780c9aa691852fdd943036bf981feb9a6d63e5f46dc70334ab1adcf64b8303ada07b32c8cf5b48eb7300c0feef56c335502c
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# USDA Nutrient Database
|
2
2
|
|
3
|
-
|
3
|
+
The USDA nutrition database is a great source of nutrition information. However,
|
4
|
+
the data formatting options (plain text ASCII files or MS-Access) leave a little
|
5
|
+
to be desired.
|
6
|
+
|
7
|
+
This is a simple gem to import the database into your ruby application.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -16,9 +20,26 @@ Or install it yourself as:
|
|
16
20
|
|
17
21
|
$ gem install usda-nutrient-database
|
18
22
|
|
23
|
+
If you're using rails then copy the migrations across:
|
24
|
+
```
|
25
|
+
rake usda_nutrient_database_engine:install:migrations
|
26
|
+
```
|
27
|
+
|
19
28
|
## Usage
|
20
29
|
|
21
|
-
|
30
|
+
Import the latest data with the import task:
|
31
|
+
```
|
32
|
+
rake usda:import
|
33
|
+
```
|
34
|
+
This is going to take a while. 20+ minutes on my 2.66 GHz i7 macbook pro
|
35
|
+
|
36
|
+
Use the models to query and profit:
|
37
|
+
```
|
38
|
+
UsdaNutrientDatabase::FoodGroup
|
39
|
+
UsdaNutrientDatabase::Food
|
40
|
+
UsedNutrientDatabase::Nutrient
|
41
|
+
UsdaNutrientDatabase::FoodsNutrient
|
42
|
+
```
|
22
43
|
|
23
44
|
## Contributing
|
24
45
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateUsdaFoodGroups < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :usda_food_groups, id: :code do |t|
|
3
|
+
create_table :usda_food_groups, id: false, primary_key: :code do |t|
|
4
4
|
t.string :code, null: false, index: true, uniq: true
|
5
5
|
t.string :description, null: false
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateUsdaNutrients < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :usda_nutrients, id: false, primary_key: :nutrient_number do |t|
|
4
4
|
t.string :nutrient_number, null: false, index: true
|
5
5
|
t.string :units, null: false
|
6
6
|
t.string :tagname
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usda-nutrient-database
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Beedle
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/tasks/usda_nutrient_database.rake
|
200
200
|
- lib/usda-nutrient-database.rb
|
201
201
|
- lib/usda_nutrient_database/configuration.rb
|
202
|
+
- lib/usda_nutrient_database/engine.rb
|
202
203
|
- lib/usda_nutrient_database/food.rb
|
203
204
|
- lib/usda_nutrient_database/food_group.rb
|
204
205
|
- lib/usda_nutrient_database/foods_nutrient.rb
|