diff --git a/backend/app/bot_regional.py b/backend/app/bot_regional.py index 02e0f67..52483b3 100644 --- a/backend/app/bot_regional.py +++ b/backend/app/bot_regional.py @@ -32,7 +32,11 @@ _USER_AGENT = ( ) _BASE_URL = "https://app.bot.or.th/BTWS_STAT/statistics/ReportPage.aspx?reportID=" -# Default mapping of BOT regions; extend as other reportIDs are confirmed. +# Default mapping of BOT regions (BTWS_STAT regional consumption reports). +# Only regions with REAL published values are enabled. north (RG_NR_042, 954) +# is confirmed live (idx 100.3). northeast (RG_NE_044, 955) currently returns a +# 0.0 placeholder (BE 2570 forecast page, no real data yet) so it is NOT enabled +# until BOT publishes real values. south/central reportIDs pending confirmation. REGION_REPORT_IDS: dict[str, int] = { "north": 954, } @@ -112,9 +116,9 @@ def parse_bot_regional_html(html_text: str) -> dict: if not cells: continue # header row: month labels (e.g. 'มิ.ย. 2569 p') — keep only cells - # whose text carries a Thai month + Buddhist year (256X). - if "256" in " ".join(cells) and not re.search(r"\d\.\d", " ".join(cells)): - # keep only cells carrying a 4-digit BE year (256X) — drops + # carrying a 4-digit BE year (25XX, may be 2569/2570/...). + if re.search(r"25\d\d", " ".join(cells)) and not re.search(r"\d\.\d", " ".join(cells)): + # keep only cells carrying a 4-digit BE year (25XX) — drops # column titles like 'ลำดับ' / 'รายการ'. month_cells = [c for c in cells if re.search(r"25\d\d", c)] if month_cells: