mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 15:26:15 +00:00
feat(crowd): add automated historical webcam collection and dataset integration
This commit is contained in:
1 parent
e952cea417
commit
b4c6041eea
91 files changed
+7957
-40
No files matched your search
+21
-1
@@ -194,9 +194,10 @@ def run_forecast_cycle(run_hour: int) -> None:
|
||||
# (one run per distinct target date, same as collect_daily_data.py)
|
||||
_save_as_prediction_runs(store, all_forecasts, run_hour)
|
||||
|
||||
# 8. At hour 20: scrape today's actual data
|
||||
# 8. At hour 20: scrape today's actual data and crowd density
|
||||
if run_hour == 20:
|
||||
_scrape_daily_actuals(store, scraper)
|
||||
_collect_daily_crowd_density(store)
|
||||
|
||||
logger.info(
|
||||
"=== Forecast cycle finished (run_hour=%d, forecasts=%d) ===",
|
||||
@@ -205,6 +206,25 @@ def run_forecast_cycle(run_hour: int) -> None:
|
||||
)
|
||||
|
||||
|
||||
def _collect_daily_crowd_density(store: SQLiteStore) -> None:
|
||||
"""Download and analyze today's 10:00 AM webcam snapshot from Infonieve."""
|
||||
logger.info("Collecting today's crowd density from historical archive.")
|
||||
# Local import to avoid circular dependencies
|
||||
from scripts.collect_historical_webcams import HistoricalWebcamCollector
|
||||
|
||||
collector = HistoricalWebcamCollector(store=store)
|
||||
today = date.today()
|
||||
|
||||
# Process for each configured historical station
|
||||
from scripts.collect_historical_webcams import HISTORICAL_CONFIG
|
||||
for station_id in HISTORICAL_CONFIG:
|
||||
try:
|
||||
logger.info("Collecting historical snapshot for %s on %s", station_id, today)
|
||||
collector.process_day(station_id, today)
|
||||
except Exception as exc:
|
||||
logger.error("Daily crowd collection failed for %s: %s", station_id, exc)
|
||||
|
||||
|
||||
def _save_as_prediction_runs(
|
||||
store: SQLiteStore,
|
||||
forecasts: list[dict[str, Any]],
|
||||
|
||||
Reference in new issue
Block a user