mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 15:26:15 +00:00
feat(weather): add sky conditions and snow type to predictions
Add WMO weather_code from Open-Meteo to derive sky conditions (sunny/cloudy/foggy/storm) and infer snow type (powder/hard/wet/spring) from temperature and snowfall data. Both fields flow through the full pipeline: weather API, hybrid predictor, SQLite storage, REST API schemas, Telegram bot messages, and scheduler tasks.
This commit is contained in:
1 parent
5e2a22340f
commit
70e3a1cf92
10 files changed
+128
-1
No files matched your search
+11
-1
@@ -62,6 +62,7 @@ _WEATHER_COLUMNS: list[str] = [
|
||||
"wind_direction_10m_dominant",
|
||||
"relative_humidity_2m_mean",
|
||||
"surface_pressure_mean",
|
||||
"weather_code",
|
||||
]
|
||||
|
||||
|
||||
@@ -398,9 +399,10 @@ class SQLiteStore:
|
||||
INSERT INTO {CURRENT_FORECASTS_TABLE} (
|
||||
generated_at, run_hour, station_id, prediction_date,
|
||||
open_probability, km_open, crowd_level,
|
||||
sky_condition, snow_type,
|
||||
weather_summary, rule_notes_json, prediction_source
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
[
|
||||
(
|
||||
@@ -411,6 +413,8 @@ class SQLiteStore:
|
||||
self._coerce_float(f.get("open_probability")),
|
||||
self._coerce_float(f.get("km_open")),
|
||||
f.get("crowd_level"),
|
||||
f.get("sky_condition"),
|
||||
f.get("snow_type"),
|
||||
f.get("weather_summary"),
|
||||
json.dumps(f.get("rule_notes") or [], ensure_ascii=False),
|
||||
f.get("prediction_source"),
|
||||
@@ -430,11 +434,13 @@ class SQLiteStore:
|
||||
INSERT INTO {PAST_FORECASTS_TABLE} (
|
||||
generated_at, run_hour, station_id, prediction_date,
|
||||
open_probability, km_open, crowd_level,
|
||||
sky_condition, snow_type,
|
||||
weather_summary, rule_notes_json, prediction_source
|
||||
)
|
||||
SELECT
|
||||
generated_at, run_hour, station_id, prediction_date,
|
||||
open_probability, km_open, crowd_level,
|
||||
sky_condition, snow_type,
|
||||
weather_summary, rule_notes_json, prediction_source
|
||||
FROM {CURRENT_FORECASTS_TABLE}
|
||||
"""
|
||||
@@ -649,6 +655,8 @@ class SQLiteStore:
|
||||
open_probability REAL,
|
||||
km_open REAL,
|
||||
crowd_level TEXT,
|
||||
sky_condition TEXT,
|
||||
snow_type TEXT,
|
||||
weather_summary TEXT,
|
||||
rule_notes_json TEXT,
|
||||
prediction_source TEXT
|
||||
@@ -663,6 +671,8 @@ class SQLiteStore:
|
||||
open_probability REAL,
|
||||
km_open REAL,
|
||||
crowd_level TEXT,
|
||||
sky_condition TEXT,
|
||||
snow_type TEXT,
|
||||
weather_summary TEXT,
|
||||
rule_notes_json TEXT,
|
||||
prediction_source TEXT
|
||||
|
||||
Reference in new issue
Block a user