vccs
Vue 3용 차트 컴포넌트 모음, Recharts에서 포팅
Thailand flood & water levels: 1,000+ canal and river gauges vs the bank, backtested 12–48 h forecasts · ระดับน้ำคลองและแม่น้ำทั่วไทย — flood.autobahn.bot
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
BKK FloodWatch — Thailand flood and water-level monitor 🌊 ติดตามระดับน้ำคลองและแม่น้ำกว่า 1,000 สถานีทั่วประเทศ เทียบตลิ่ง พร้อมคาดการณ์ 12–48 ชั่วโมง Real-time water levels of canals and rivers across Thailand — 1,000+ gauges from HII, RID, EGAT and BMA, compared with the bank, with backtested 12–48 h forecasts — in plain Thai, on your phone. It started in Bangkok during the 2026 flood (hence the name) and covers the whole country since v0.16. ▶ Open the app — flood.autobahn.bot · API docs · Changelog · Handoff (for developers)README 전문 보기 ↗
ติดตามระดับน้ำคลองและแม่น้ำกว่า 1,000 สถานีทั่วประเทศ เทียบตลิ่ง พร้อมคาดการณ์ 12–48 ชั่วโมง Real-time water levels of canals and rivers across Thailand — 1,000+ gauges from HII, RID, EGAT and BMA, compared with the bank, with backtested 12–48 h forecasts — in plain Thai, on your phone. It started in Bangkok during the 2026 flood (hence the name) and covers the whole country since v0.16.
▶ Open the app — flood.autobahn.bot · API docs · Changelog · Handoff (for developers)
[!WARNING] Not an official warning service · ไม่ใช่ประกาศทางการ. Always follow BMA, DDPM, RID and HII announcements. Emergency: กทม. 1555 · ปภ. 1784. A gauge measures the canal, not your street or your house.
| You ask | The app shows |
|---|---|
| น้ำแถวบ้านจะขึ้นหรือลง? Is the water near me going up or down? | Tap any place (or "สถานีใกล้ฉัน"): the nearest canal gauge, its status against the bank, what it did in the last 24 h ("ลดลง 20 ซม.") and its 24/48 h trend ("↘ ลดลง ราว −12 ซม."), rain in the next 24 h and street-flood reports around you. |
| ไม่เข้าใจตัวเลข I don't get the numbers | Every pin has a plain line under its headline, and one button "✨ ให้ AI สรุปให้ฟังง่าย ๆ": renders instantly (<50ms) from deterministic rule lines without waiting, then polishes into a warm, natural Thai spoken narrative (GLM) in the background, with an audio readout button ("🔊 ฟังเสียง") for voice accessibility, and the numbers folded under "ดูตัวเลข". The rules write the story; the AI may only retell it after a strict check. |
| เมื่อไหร่น้ำจะลด? When will it drop below the bank? | A date range with its conditions ("หากลดในอัตราเดิมและไม่มีฝนหนัก … ความเชื่อมั่นต่ำ"), never a minute countdown. |
AI_EXPLAIN=0).flowchart LR
S["HII · BMA canals · RID · Open-Meteo rain · Traffy reports · DWR posts · Google Flood Hub"] --> C["Collectors<br/>(raw archive, every 5–10 min)"]
C --> DB[("Postgres")]
DB --> Q["Quality control<br/>dropouts · erratic & stuck gauges · measured trend"]
Q --> F["Forecasts per gauge<br/>backtested per horizon, conformal ranges"]
F --> API["FastAPI (JSON)"]
API --> W["Thai web app<br/>list · map · point check"]
One server with docker compose, published through a Cloudflare Tunnel (no open ports). Models and formulas: MODELS · methods: APPROACH_AND_METHODS · design: ARCHITECTURE.
| Source | What we use | Status |
|---|---|---|
| HII ThaiWater (สสน.) | Water levels, banks, discharge, rain gauges; up to a year of hourly history; official forecasts (archived and scored) | ✅ live |
| BMA canal gauges (สำนักการระบายน้ำ กทม.) | 199 Bangkok gauges every 5 min via the public KlongMap relay; a year of history for 158 from HII | ✅ live |
| RID (กรมชลประทาน), EGAT (กฟผ.), พพภ. | River gauges across Thailand and the Chao Phraya Dam release, via HII | ✅ live |
| Open-Meteo | Rain forecast, and rain as it was forecast 1–2 days earlier (for honest backtests): Bangkok points and a 0.5° cell for every other gauge | ✅ live |
| Traffy Fondue | Street-flood reports around each gauge (counts only) | 🟡 often overloaded; age shown |
| OpenStreetMap Nominatim | Place search, on request only (queries are never stored); the villages along the Phetchaburi River for the impact tab, built once into a file (D-110) | ✅ live |
| Google WeatherNext 3 (DeepMind) | 64-member AI weather forecasts; subscribed via BigQuery Analytics Hub (weathernext_3), live queries verified (D-069, research/backtesting only; real-time rain is never shown or served per terms) | 🔬 connected / research only (D-069) |
| GISTDA, Copernicus GFM (satellite flood maps), GloFAS | Tested 2026-10-02: satellites are blind among Bangkok's buildings, GloFAS adds nothing to a 3–7 day outlook here | 🔬 research only (D-069) |
| Google Flood Hub (Flood Forecasting API) | 103 river points in Thailand: flood status, thresholds, 9-day discharge; collected every 6 h and compared with our gauges | 🔬 validating, not shown (D-087) |
| DWR early-warning posts (กรมทรัพยากรน้ำ) | 455 village level posts; local datum, so shown as measured change only | ✅ trend-only map layer () |
Full registry, including endpoints that were tested and refuted: SOURCES.
| Endpoint | Returns |
|---|---|
GET /api/point?lat=&lon= | Outlook for a place: nearest canal, its measured and forecast change, rain, street reports |
GET /api/stations | All gauges with status, bank distance, measured 24 h change, 24/48/72 h forecast rows and the trend group |
GET /api/stations/{code}?days=7 | One gauge: history and forecast path |
GET /api/rivers · GET /api/profile?river= | The 62 river views · one river from upstream to downstream |
GET /api/risks | The ⚠️ จับตา groups (over the bank / may reach it, each split by trend; upstream water; fast rise; heavy rain) with track records |
GET /api/situation | The national ticker: short items [{icon, text, ai}], refreshed every 30 min |
GET /api/explain?lat=&lon=&q=simple · /api/explain_station?code= · /api/explain_watch?region=&prov= | The ✨ plain-Thai story and lines (add &part=gist for the checked AI retelling, or null) |
GET /api/reports · /api/rain · /api/health | Street-report cells · rain outlook · pipeline freshness |
curl -s "https://flood.autobahn.bot/api/point?lat=13.8545&lon=100.588"
Response, trimmed (live, 2026-09-30 05:38 UTC):
{
"forecast": {"risk": "high", "title": "ระดับน้ำในคลองล้นตลิ่ง/วิกฤต",
"desc": "คลองสายหลักรอบจุดนี้ล้นตลิ่ง เฝ้าระวังน้ำเอ่อล้นพื้นที่ลุ่มต่ำริมตลิ่ง"},
"area": {"category": "critical", "confidence": "medium", "nearest_km": 0.1, "n": 27},
"nearest_canal": {"code": "BKK021", "distance_km": 0.1, "status": "critical",
"observed24": {"change_cm": -20, "level": "strong_fall", "hours": 24},
"change24": {"dir": "falling", "level": "fall", "median": -0.12, "basis": "measured_trend"}},
"rain_next24_mm": 1.4,
"evidence": {"traffy_flood_reports_1km_6h": 0}
}
Interactive docs: /api/docs. Please keep requests reasonable; the payloads refresh once a minute.
cp .env.example .env # set POSTGRES_PASSWORD (and Cloudflare values only if you publish)
docker compose up -d --build # db, worker, app (add --profile public for the tunnel)
docker compose run --rm --no-deps worker pytest -q # 104 tests
python3 scripts/ux_consistency.py # UI consistency proof (Playwright), ~12 min
No data API keys are needed for basic monitoring. Secrets live only in .env (git-ignored). Operations, deploys and next steps: HANDOFF.
Live since 2026-09-26, built during the 2026 flood; current release in the badge above (v0.34.0, 2026-10-06). v0.16 brought every gauge in Thailand to the same history, forecast gate and panels as Bangkok; v0.21–v0.24 added the ⚠️ จับตา tab, one trend rule, the national ticker and the 24/48/72 h rows; v0.25 improved the forecast under an honest test (star reads the 7/30-day means and short/long changes; up to 4 upstream gauges — on gauges the choice never saw, 24 h error vs "no change" −6.6 → −8.3…−9.1 %), turned the ticker into short items with symbols, and put the ✨ AI summary on station sheets and the จับตา tab. v0.26 feeds Google Flood Hub forecasts to the model near its points and recalibrates the 90 % ranges daily. v0.27–v0.33 built the 💧 impact tab for partner engineers (the national dams list, 7-day release plans that keep each day's tested error, a river view per plan); v0.33.1 keeps the range calibration from undoing itself, and MODELS §12 shows how the models improved release by release, measured against what the water did; v0.34 puts the release plans side by side in one grid, labels every plan that runs beyond the river data, clips ONWR's layers to the case and adds the AI brief, comparison and typed plans (D-110). Open: the WeatherNext backtest after the free BigQuery quota resets (Q53), an external uptime alert, the Thai VPN's stability (KI-289). Details: HANDOFF.md, docs/MODELS.md §12, CHANGELOG.md.
| Doc | For |
|---|---|
| HANDOFF | What is live, how to operate it, what to do next |
| KNOWLEDGE | The "three waters", datums, stations, polders, the 2026 event |
| MODELS | How the app calculates (Thai summary + English): formulas, parameters, which models win, hard cases, what we tried and why, data wish-list |
| APPROACH_AND_METHODS | QC, forecasts, backtests, conformal ranges, point check |
| ARCHITECTURE · SOURCES | System design · every data source and its test status |
| KNOWN_ISSUES · GUIDELINES | Pitfalls with status (KI-IDs) · rules for code, data and UX |
| UX_VALIDATION · OWNER_ACTIONS | Resident checks and findings · what the project needs from its owner |
| docs/README | Full index and reading order |
สถานีวัดน้ำของ สสน. (HII), กรมชลประทาน และสำนักการระบายน้ำ กทม. ฝนคาดการณ์จาก Open-Meteo และรายงานน้ำท่วมจาก Traffy Fondue — official gauges plus open rain and citizen-report feeds; see Data sources.
ได้ ตั้งแต่ v0.16 ทุกสถานีของ สสน. กรมชลประทาน และ กฟผ. ทั่วประเทศ ใช้กฎเดียวกับกรุงเทพฯ แตะ "อีสาน" "ใต้" หรือจุดใดก็ได้บนแผนที่ — yes: since v0.16 every HII/RID/EGAT gauge in Thailand follows the same rules as Bangkok. Pick a region chip or tap any place; outside Bangkok the panel speaks of the rivers near you.
ไม่ได้ สถานีวัดระดับน้ำในคลองเทียบตลิ่ง ไม่ใช่ระดับบนถนนหรือในบ้าน แอปจึงบอกสถานะคลองใกล้คุณ แนวโน้ม และรายงานน้ำท่วมรอบจุด — No: a gauge measures the canal against its bank, so the app shows the nearest canal, its trend and nearby reports, never a depth at your pin.
ทุกสถานีทดสอบย้อนหลังแยกตามช่วงเวลา ใช้แบบจำลองเฉพาะที่แม่นกว่า "ถือว่าน้ำคงที่" ปุ่ม ⓘ บอกความมั่นใจและโอกาสที่แนวโน้มจะเป็นต่อ — every gauge is backtested per horizon; the ⓘ next to each row gives the confidence or the historical odds.
ผลจริงตั้งแต่ 26 ก.ย. 2569 (ตรวจกับระดับน้ำที่เกิดขึ้นจริง 96,287 รอบ): คาด 6–12 ชม. คลาดน้อยกว่า "ถือว่าน้ำคงที่" 11–21 % ทั่วประเทศ 24 ชม. 3–7 % และ 48–72 ชม. พอ ๆ กัน · ช่วง 90 % ครอบคลุมจริง 80–89 % ของครั้ง — As issued since 2026-09-26 and scored against what the water did: 6–12 h forecasts missed by 11–21 % less than "no change" nationwide, 24 h by 3–7 % less, 48–72 h about the same; the 90 % ranges held 80–89 % of the time (MODELS §12).
ช่วง 50 % ในแต่ละแถวครอบคลุมจริง 37–55 % ของครั้ง (ควรเป็นครึ่งหนึ่ง) และแคบเกินไปในช่วงน้ำลดล่าสุด (38–39 %) — กำลังแก้ที่ตัวคาดการณ์ — the 50 % range on each row held 37–55 % of the time (it should hold half), too narrow in the latest recession (38–39 %); the fix belongs in the forecasts themselves.
ค่าผิดปกติ เช่น ขึ้นลงเร็วเพราะการสูบน้ำใกล้เครื่องวัด หรือค่าค้างที่เดิม จะถูกซ่อนพร้อมหมายเหตุ แต่สถานียังอยู่บนแผนที่ — values that jump (pumps next to the sensor) or stay stuck are hidden with a note; the gauge stays on the map.
โค้ดเป็น MIT และมี API ฟรี ข้อมูลของแต่ละหน่วยงานเป็นไปตามเงื่อนไขของหน่วยงานนั้น — the code is MIT and the API is free; third-party data keeps its own terms (SOURCES).
Issues and pull requests are welcome: open an issue. Please read GUIDELINES first (evidence rule, no secrets, short panel text) and run the tests.
Code: MIT. Data: HII/สสน., RID/กรมชลประทาน, BMA/กทม., DWR/กรมทรัพยากรน้ำ, TMD, Traffy Fondue, Google Flood Hub (validation only), Open-Meteo / Copernicus GloFAS, OpenStreetMap contributors — each under its own terms. Official contacts: กทม. 1555 · ศูนย์ป้องกันน้ำท่วม กทม. 02-248-5115 · ปภ. 1784 · กรมชลประทาน 1460 · thaiwater.net.
/impact is the whole app plus a 💧 ผลกระทบ tab: every large dam on the map against its rule curve and its own release history (RID and EGAT side by side), a 7-day trend for 37 of 38 dams — tested rain-driven inflow models for 32 of them, else "if today holds" — with one storage-% definition for the whole list (D-102, D-103, D-106), and the Kaeng Krachan case — 7-day release scenarios found by search and judged on seven effects, with a ★ plan by a printed rule (D-101), compared in one grid (D-110): the ★, today's release, the engine's best plan per goal, up to three of your own plans and a ladder of constant releases, each a strip of 7 days coloured by its worst gauge and hatched "⚠ นอกช่วงข้อมูล" wherever a gauge's flow passes anything its rating has seen (the ★ included — labelled, not hidden, by the owner's choice) — the river's level per plan from a model tested for each of the 7 days, with that day's error as the margin, and the dam's inflow from a model fed four rain forecasts (D-104); km of river near its bank and the villages along it (OpenStreetMap) instead of a flood area; each plan's day on the map (the river by its gauges), with ONWR's flood warning and forecast layers clipped to the case and off until ticked (D-105, KI-318); on tap, an executive brief to copy, a two-plan comparison and a plan typed in Thai (rules write every number; GLM may only reword or read, never decide); the river below the dam, an honest replay and what data would make the downstream numbers credible; those stay labelled until they beat "keep today's level" (D-099, D-100).