Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🌿 Personal Health Insight Engine

A polished, interactive Streamlit dashboard for exploring sleep health and lifestyle data. Upload the Kaggle Sleep Health & Lifestyle Dataset (or any compatible CSV) and get instant visualizations, evidence-backed insights, and AI-powered interpretations — all in your browser.

Built as a portfolio/recruitment project demonstrating clean architecture, typed Python, Plotly interactivity, and Anthropic API integration.


Screenshot placeholder


Features

  • CSV upload with validation — friendly error messages if required columns are missing
  • Summary metrics — average sleep, stress, daily steps, and disorder prevalence at a glance
  • Three interactive Plotly charts
    • Stress vs Sleep Quality scatter with OLS trendline and BMI colour coding
    • Average Sleep Duration by BMI Category (bar)
    • Pearson correlation heatmap for all numeric features
  • Evidence-backed insight cards — each card plugs in real computed values (Pearson r, quartile means, intervention group %)
  • AI "Ask the Data" box — powered by Claude, streamed in real time, with a compact dataset summary injected as context

Tech Stack

Layer Tool
UI Streamlit
Charts Plotly Express
Data pandas, numpy, scipy
AI Anthropic Python SDK (Claude)

Setup

Requires uv.

1. Clone and sync

git clone <repo-url>
cd health_insights
uv sync          # creates .venv and installs all pinned deps

2. Configure the API key

mkdir -p .streamlit
echo 'ANTHROPIC_API_KEY = "sk-ant-..."' > .streamlit/secrets.toml

The AI box is silently disabled if the key is absent — the rest of the app works without it.

3. Run

uv run streamlit run app.py

Then upload Sleep_health_and_lifestyle_dataset.csv (or any CSV with the required columns).

uv run automatically uses the isolated .venv — no source .venv/bin/activate needed.

Required columns

Sleep Duration, Quality of Sleep, Physical Activity Level,
Stress Level, BMI Category, Heart Rate, Daily Steps, Sleep Disorder

Dataset

Sleep Health and Lifestyle Dataset — Kaggle, by Laksika Tharmalingam. 374 synthetic records covering sleep metrics, lifestyle factors, and cardiovascular health indicators.

Project Structure

health_insights/
├── app.py               # Streamlit UI — imports → config → upload → metrics → charts → AI
├── utils.py             # Pure functions: loading, stats, insight maths, chart builders
├── pyproject.toml       # uv project manifest and dependency list
├── uv.lock              # pinned lockfile (commit this)
├── requirements.txt     # pip fallback
└── README.md

utils.py contains zero Streamlit calls and is independently testable.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages