https://github.com/mfdeux/fooddata
Download, build, and query the USDA food database
https://github.com/mfdeux/fooddata
data-science database food python sqlite usda
Last synced: about 2 months ago
JSON representation
Download, build, and query the USDA food database
- Host: GitHub
- URL: https://github.com/mfdeux/fooddata
- Owner: mfdeux
- License: mit
- Created: 2020-08-04T00:04:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-04T00:53:29.000Z (almost 6 years ago)
- Last Synced: 2025-12-16T08:22:35.739Z (6 months ago)
- Topics: data-science, database, food, python, sqlite, usda
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# fooddata
Download, build, and query the USDA food database.
Do you know what you are putting in your body?
## Installation
```shell script
$ pip install fooddata --upgrade
```
## Usage
```shell script
$ fooddata build
```
```shell script
$ fooddata query "SELECT * from foods WHERE category_id IS NOT NULL LIMIT 100;" --json | jq .
```
```shell script
$ fooddata query "SELECT * from foods WHERE category_id IS NOT NULL LIMIT 100;" --json > output2.json
```
```shell script
$ 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:
```shell script
$ fooddata build
```
## Note
The data comes from the USDA website:
[https://fdc.nal.usda.gov/download-datasets.html](https://fdc.nal.usda.gov/download-datasets.html)