Skip to main content

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.txt at the project root (one-line file containing the key).
  1. Sync environment & run tests (project uses uv for environment management):
uv sync
uv run pytest
  1. 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
  1. 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: Foundation and Category: Legumes and Legume Products.
  • Ensure api.txt exists in the project root before running main.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.csv for 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 data
  • legus_cleaned.csv — cleaned dataset output
  • src/legume_nutrient_dashboard/streamlit_app.py — Streamlit dashboard

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

legume_nutrient_dashboard-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

legume_nutrient_dashboard-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file legume_nutrient_dashboard-0.1.1.tar.gz.

File metadata

File hashes

Hashes for legume_nutrient_dashboard-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3def583db98731b7b02cb5fe48d6726aa1f51039a247bc26f0787ab2c231250
MD5 52e0b7acb7143999c0faac219904d9d8
BLAKE2b-256 94d3e57130ee3b8d14936776d72bf49c89df33b3c4c67581f2f6c80db419159e

See more details on using hashes here.

File details

Details for the file legume_nutrient_dashboard-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for legume_nutrient_dashboard-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5ce421e899fd7700f77dc4b2e27523c0562b0d7086c68dd0c205bcb6731e38
MD5 86073e131c43413e512116efce36ff85
BLAKE2b-256 9346199eaaa6ac6fd649078e36cb302fd826c335d81ec194427d84b1367a328b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page