From 4f3f19f6db30bbd40f80a129982efe78d6c4c715 Mon Sep 17 00:00:00 2001 From: grabowski Date: Tue, 11 Aug 2026 15:26:58 +0700 Subject: [PATCH] feat: rainfall + HII water-level layers on the dashboard New endpoints GET /api/hii/rainfall/latest and /api/hii/waterlevel/latest serve the latest per-station rows from the hii_* tables. The map gains a TWA-style rain layer: circle markers binned by TMD 24-h classes (blues for light/moderate/heavy, site amber/red for very-heavy/extreme), with a legend block and show/hide toggle. The ThaiWater sensor panel now prefers the DB-backed HII feed (no API key required, 97+ stations, ThaiWater storage-percent situation colors, gauge-datum conversion via offset_msl) and falls back to the live /sensors/thaiwater passthrough. --- src/static/dashboard.html | 93 ++++++++++++++++++++++++++++++++++--- src/web_api.py | 68 +++++++++++++++++++++++++++ tests/test_dashboard.py | 13 ++++++ tests/test_hii_collector.py | 52 +++++++++++++++++++++ 4 files changed, 219 insertions(+), 7 deletions(-) diff --git a/src/static/dashboard.html b/src/static/dashboard.html index abb6789..de8f10c 100644 --- a/src/static/dashboard.html +++ b/src/static/dashboard.html @@ -216,6 +216,14 @@
Very high > 250
River · no nearby gauge
River · gauge colour, dashes = flow
+
Rainfall · 24 h + +
+
Light 0.1–10 mm
+
Moderate 10–35
+
Heavy 35–90
+
Very heavy 90–150
+
Extreme > 150
Loading river conditions…
@@ -270,7 +278,7 @@