Interactive dashboard for analyzing legume nutrient data from USDA FoodData Central
Project description
Legume Nutrient Dashboard
The Legume Nutrient Dashboard is an interactive Streamlit app created for a STAT 386 final project. It collects Foundation-food data from the USDA FoodData Central API (category: "Legumes and Legume Products"), extracts and cleans nutrient information, and provides interactive visualizations for exploration.
Quickstart
Prerequisites:
- A working Python environment (see
pyproject.toml/myenv). - A USDA API key saved in a file named
api.txtat the project root (one-line file containing the key).
- Sync environment & run tests (project uses
uvfor environment management):
uv sync
uv run pytest
- Generate the cleaned dataset
The main script fetches data from the USDA API, extracts nutrients, and writes legus_cleaned.csv.
uv run python main.py
- Launch the Streamlit dashboard
uv run streamlit run src/legume_nutrient_dashboard/streamlit_app.py
Important: Always run from the project root directory so the app can locate legus_cleaned.csv.
Notes
- The pipeline filters for Data Type:
Foundationand Category:Legumes and Legume Products. - Ensure
api.txtexists in the project root before runningmain.py.
Dashboard Features
- Legume Selector: pick a legume category from the sidebar to filter results.
- Radar Chart: compares average nutrient content across groups (e.g., Protein, Fat, Carbs, Starch, and selected minerals).
- Correlation Heatmap: interactive Plotly heatmap showing nutrient correlations across the dataset.
- Dataset Preview: table view of the cleaned
legus_cleaned.csvfor inspection.
Technologies Used
- Python: 3.11+ (project environment in
myenv) - Streamlit: dashboard UI
- pandas: data manipulation
- requests: USDA API calls
- regex: nutrient and category extraction
- seaborn / matplotlib: static charts
- plotly: interactive visualizations
- uv: environment & dependency management
Files of interest
main.py— main pipeline to fetch, clean, and save datalegus_cleaned.csv— cleaned dataset outputsrc/legume_nutrient_dashboard/streamlit_app.py— Streamlit dashboard
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file legume_nutrient_dashboard-0.1.1.tar.gz.
File metadata
- Download URL: legume_nutrient_dashboard-0.1.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3def583db98731b7b02cb5fe48d6726aa1f51039a247bc26f0787ab2c231250
|
|
| MD5 |
52e0b7acb7143999c0faac219904d9d8
|
|
| BLAKE2b-256 |
94d3e57130ee3b8d14936776d72bf49c89df33b3c4c67581f2f6c80db419159e
|
File details
Details for the file legume_nutrient_dashboard-0.1.1-py3-none-any.whl.
File metadata
- Download URL: legume_nutrient_dashboard-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b5ce421e899fd7700f77dc4b2e27523c0562b0d7086c68dd0c205bcb6731e38
|
|
| MD5 |
86073e131c43413e512116efce36ff85
|
|
| BLAKE2b-256 |
9346199eaaa6ac6fd649078e36cb302fd826c335d81ec194427d84b1367a328b
|