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.0.tar.gz (2.3 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.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for legume_nutrient_dashboard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54213b37564431e6b8b70dc807e3b4378c9a2b7dcc9f70003a4bceaeeb916f18
MD5 65df9e6a560ba25f6811f5d076b4f845
BLAKE2b-256 61d70775464f2685a59178cae705189930cb83ebb0fd6667e521b673e1d637d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for legume_nutrient_dashboard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce92f98308e4e4842042584c1859c25b1163bcfb9486d8edbe3cad91bb826a42
MD5 d4ac21f6f70989f9fd0a679093f06931
BLAKE2b-256 fc29c5187c2bcc1119528c91c3ce1c343149156f9a800cbc535e96e747693421

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