Distributed weather intelligence platform: edge observations flow through MQTT, are stored in TimescaleDB, aggregated and forecasted by FastAPI services, and surfaced via dashboards. Alerts are rule-based and broadcast over MQTT. Architecture and runtime are visualized in an accompanying backend dashboard.
- Dhruv Kalra (Backend) — Data Stream Handler
- Janaranjanee Sendhil Kumar (Backend) — Alert & Broadcast Module
- Dipal Nirmal (Frontend) — Visualization Dashboard
- Minhajuddin Muhammad (Backend) — Aggregator & Forecast Engine
- Yuvraj Singh Palh (Scrum Master) — Edge Node Data Service
- Edge Nodes: publish JSON observations to MQTT topics
city/{city}/observations. - Message Broker: Mosquitto (MQTT TCP + WS) routes observations and alerts.
- Database: TimescaleDB/Postgres (hypertables
observations,aggregates,alerts). - Aggregator & Forecast (FastAPI):
- MQTT ingestion → Timescale
observations - Aggregation jobs (15m/1h) →
aggregates - Alerts from rules on aggregates →
alertstable + MQTTalerts/{city} - OpenWeather forecast with caching; placeholder fallback
- APIs:
/health,/ready,/metrics,/cities/{id}/observations,/aggregates,/alerts,/forecast
- MQTT ingestion → Timescale
- Visualization Dashboard: consumes API for observations, aggregates, forecast.
- Backend Dashboard: architecture-style status (edge → broker → DB → aggregator → viz) with live counts.
- Prereqs: Docker Desktop; Python 3.11 (for scripts).
- Start stack:
docker compose -f infra/docker-compose.yml up --build- Frontend:
cd frontend && python -m http.server 3000
# open http://localhost:3000
# backend architecture dashboard: http://localhost:3000/backend-dashboard.html- API key: set header
X-API-Key: devkey(change via env). - Seed data (choose one):
- Edge simulator:
python edge-sim/publisher.py --host localhost --port 1883 --city toronto --source edge-sim --interval 5- Manual publish:
docker compose -f infra/docker-compose.yml exec mosquitto \
mosquitto_pub -t city/toronto/observations \
-m '{"city_id":"toronto","source":"sim","observed_at":"<ISO>","temp_c":36,"humidity":0.58,"wind_kph":45,"pressure_hpa":1010,"rain_mm":0.0}'- Verify APIs:
curl -H "X-API-Key: devkey" http://localhost:8080/health
curl -H "X-API-Key: devkey" "http://localhost:8080/cities/toronto/observations?limit=5"
curl -H "X-API-Key: devkey" "http://localhost:8080/cities/toronto/aggregates?window=15%20minutes&limit=5"
curl -H "X-API-Key: devkey" "http://localhost:8080/cities/toronto/alerts?limit=5"
curl -H "X-API-Key: devkey" "http://localhost:8080/cities/toronto/forecast?lat=43.6532&lon=-79.3832"- Observation (MQTT/DB):
{city_id, source, observed_at, temp_c, humidity, wind_kph, pressure_hpa, rain_mm} - Aggregate (DB):
{city_id, bucket_start, bucket_width, temp_avg, temp_min, temp_max, humidity_avg, wind_avg} - Alert (DB/MQTT):
{city_id, level, rule, message, triggered_at}
- API_KEY (for
X-API-Key) - FORECAST_API_KEY / FORECAST_BASE_URL
- MQTT_HOST/PORT/USERNAME/PASSWORD
- AGGREGATE_INTERVAL_SECONDS, ALERT_COOLDOWN_MINUTES
- OPENWEATHER_POLL_SECONDS, OPENWEATHER_CITIES (JSON)
- ALLOWED_ORIGINS
- Infra:
infra/docker-compose.yml,infra/sql/init.sql,infra/mosquitto.conf - Backend:
aggregator/app/main.py,aggregator/app/aggregator.py,aggregator/app/alerts.py,aggregator/app/forecast.py,aggregator/app/openweather_publisher.py - Frontend:
frontend/index.html,frontend/backend-dashboard.html,frontend/style.css,frontend/backend-dashboard.css,frontend/script.js,frontend/backend-dashboard.js - Simulator:
edge-sim/publisher.py - Demo script:
start.py
- MQTT decoupled ingestion; edge-friendly.
- Time-series optimized storage (Timescale).
- Rule-based alerts with MQTT broadcast.
- OpenWeather integration with caching.
- Health, readiness, metrics endpoints.
- Demo-friendly: simulator, dashboards, start script.