How paradise-theking/eswatini-water-stress-ml works
The repository is a hydroclimatic research and forecasting application: environmental observations feed a one-month-ahead Ridge forecast, exposed through a FastAPI API and TypeScript dashboard. It also serves historical indices and separate climate-balance and satellite surface-water context. The dashboard includes demonstration subscription flows. Edges reflect README statements or shown imports/calls; sampled excerpts are partial, so unsampled details and some UI interactions are not inferred.
Main entry points: main.py FastAPI routes · main.ts Forecast and risk dashboard · live_forecast.py Live forecast generation · water_availability.py Climate balance and surface water
Components 15
Environmental data
- Earth observation ingestion
backend/data_ingestion.py - Research dataset
data/processed/mnjoli_water_stress_ml_dataset.csv - Live observed history
backend/live_history.py
Forecasting
- Trained Ridge model
models/water_stress_ridge.joblib - Forecast features
backend/feature_engineering.py - Live forecast generation
backend/live_forecast.py
API and water risk
- FastAPI routes
backend/main.py - Climate balance and surface water
backend/water_availability.py
Dashboard and services
- Forecast and risk dashboard
frontend/src/main.ts - Firebase setup
frontend/src/firebaseConfig.ts
Other components
- Water manager
- Earth Engine
- Weather provider
- Firebase Firestore
- Web browser
Connections 17
- Web browser → Forecast and risk dashboard: uses
frontend/src/main.ts - Water manager → Forecast and risk dashboard: views
- Forecast and risk dashboard → FastAPI routes: requests
frontend/src/main.ts - FastAPI routes → Live forecast generation: generates
backend/main.py - Live forecast generation → Earth observation ingestion: fetches observations
backend/live_forecast.py - Live forecast generation → Forecast features: builds input
backend/live_forecast.py - Live forecast generation → Trained Ridge model: loads and predicts
backend/live_forecast.py - FastAPI routes → Research dataset: reads history
backend/main.py - FastAPI routes → Live observed history: fetches live history
backend/main.py - Live observed history → Earth observation ingestion: fetches observations
backend/live_history.py - FastAPI routes → Climate balance and surface water: serves risk endpoints
backend/main.py - Climate balance and surface water → Weather provider: requests forecast data
- Climate balance and surface water → Earth Engine: processes satellite imagery
- Earth observation ingestion → Earth Engine: queries observations
backend/data_ingestion.py - Forecast and risk dashboard → Firebase setup: imports database
frontend/src/main.ts - Firebase setup → Firebase Firestore: initializes client
frontend/src/firebaseConfig.ts - Forecast and risk dashboard → Firebase Firestore: reads and writes subscriptions
frontend/src/main.ts