Rwanda Health Analytics Dashboard built with Flask and MySQL
# Health Analytics Dashboard
A Flask + MySQL web application that analyzes outpatient health visits and drug stock data using a relational database and server-side analytics.
This project demonstrates data modeling, SQL analytics, backend development, and data quality management.
## Project Overview
The dashboard provides two main analytical views:
### 1. Outpatient Visits
- Total number of visits
- Average payment amount
- Most common reasons for visit
- Insurance type summary
- Detailed visit-level table
### 2. Drug Stock
- Total stock items
- Stock quantity by drug category
- Low-stock monitoring table (sorted ascending)
## Tech Stack
Python (Flask)
MySQL
PyMySQL
Jinja2 (HTML templating)
SQL(aggregation, grouping, filtering)
## Project Structure
Rwanda_health_Dashboard/
│ app.py
│ README.md
│ requirements.txt
│ .gitignore
├─templates/
│ ├─base.html
│ ├─home.html
│ ├─visits.html
│ └─stock.html
├─sql/
│ └─setup.sql
## Database Design
### outpatient_visits
Stores visit-level information such as:
- visit date
- patient demographics
- reason for visit
- insurance type
- payment amount
- facility type
### drug_stock
Stores facility-level drug inventory information:
- drug name and category
- quantity and unit
- facility type and district
## How to Run the Project (Local)
### 1. Clone the repository
git clone
github.com
cd rwanda-health-dashboard
2. Create and activate virtual environment
python -m venv venv
venv\Scripts\activate #Windows
3. Install dependencies
pip install -r requirements.txt
4. Set up the database
Open MySQL Workbench
Run the SQL script in sql/setup.sql
Ensure MySQL is running on port 3307 ( or update DB settings in app.py)
5. Run the application
py app.py
Open in browser:
127.0.0.1
127.0.0.1
htt://127.0.0.1:5000/stock
## Data Quality & Reproducibility
Tables are truncated before reloading sample data to avoid duplicates
Clean reload …