/fooddata

Download, build, and query the USDA food database

Primary LanguagePythonMIT LicenseMIT

fooddata

Download, build, and query the USDA food database.

Do you know what you are putting in your body?

Installation

$ pip install fooddata --upgrade

Usage

$ fooddata build
$ fooddata query "SELECT * from foods WHERE category_id IS NOT NULL LIMIT 100;" --json | jq .
$ fooddata query "SELECT * from foods WHERE category_id IS NOT NULL LIMIT 100;" --json > output2.json
$ fooddata query "SELECT * from food_nutrients_v WHERE food_type IS NOT NULL AND food_category IS NOT NULL LIMIT 1000;" --json | jq .

Update Database

To update the database, just run the first command again:

$ fooddata build

Note

The data comes from the USDA website: https://fdc.nal.usda.gov/download-datasets.html