# Heatwave EWS — Heat Stress & Mortality Risk Early Warning System
A full-stack **ward-level heat risk early warning system** that ingests weather forecasts, computes physiological heat stress indices (WBGT, Heat Index, UTCI), scores ward vulnerability, and dispatches role-specific alerts to construction workers, healthcare, power grid operators, farmers, and the general public.
## Architecture
```
┌──────────────┐ ┌──────────────┐ ┌─────────────────────┐
│ Frontend │────▶│ Backend │────▶│ PostgreSQL/PostGIS │
│ React/Vite │ │ FastAPI │ │ Ward geometries │
│ Leaflet Map │ │ Uvicorn │ │ Risk scores │
│ Port 5173 │ │ Port 8000 │ │ Port 5432 │
└──────────────┘ └──────────────┘ └─────────────────────┘
```
| Service | Tech Stack | Port |
|------------|-----------------------------------|-------|
| **frontend** | React 18 + Vite + TypeScript + Tailwind + Leaflet | 5173 |
| **backend** | Python 3.12 + FastAPI + SQLAlchemy + APScheduler | 8000 |
| **db** | PostgreSQL 16 + PostGIS 3.4 | 5432 |
## Quick Start
### Prerequisites
- Docker and Docker Compose v2+
### Run
```bash
# Clone and start all services
cd heatwave-ews
docker compose up --build
```
Once running:
- **Frontend dashboard**:
localhost
- **Backend API docs**:
localhost
- **Health check**:
localhost
### Environment Variables
Copy and edit `.env` in the project root. Key variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `POSTGRES_USER` | `heatwave` | DB username |
| `POSTGRES_PASSWORD` | `heatwave` | DB password |
| `POSTGRES_DB` | `heatwave_ews` | DB name |
| `DATABASE_URL` | `postgresql://...` | SQLAlchemy connection string |
| `TWILIO_ACCOUNT_SID` | _(empty)_ | Set for real SMS/WhatsApp alerts |
| `TWILIO_AUTH_TOKEN` | _(empty)_ | Set for real SMS/WhatsApp alerts |
| …