feat: implement METAR data collection service and dashboard infrastructure

This commit is contained in:
2569718930@qq.com
2026-04-11 20:11:01 +08:00
parent 69168d2fdf
commit 77b4d7b341
14 changed files with 660 additions and 148 deletions
+11 -3
View File
@@ -19,6 +19,7 @@ from src.data_collection.city_registry import ALIASES
from src.utils.metrics import export_prometheus_metrics
from web.analysis_service import (
_analyze,
_analyze_summary,
_build_city_detail_payload,
_build_city_summary_payload,
)
@@ -425,10 +426,17 @@ async def list_cities(request: Request):
@router.get("/api/city/{name}")
async def city_detail(request: Request, name: str, force_refresh: bool = False):
async def city_detail(
request: Request,
name: str,
force_refresh: bool = False,
depth: str = "panel",
):
_assert_entitlement(request)
city = _normalize_city_or_404(name)
return await run_in_threadpool(_analyze, city, force_refresh)
normalized_depth = str(depth or "panel").strip().lower()
detail_mode = "full" if normalized_depth == "full" else "panel"
return await run_in_threadpool(_analyze, city, force_refresh, False, detail_mode)
@router.get("/api/history/{name}")
@@ -1021,7 +1029,7 @@ async def payment_reconcile_latest(request: Request):
@router.get("/api/city/{name}/summary")
async def city_summary(request: Request, name: str, force_refresh: bool = False):
city = _normalize_city_or_404(name)
data = await run_in_threadpool(_analyze, city, force_refresh, False)
data = await run_in_threadpool(_analyze_summary, city, force_refresh)
return await run_in_threadpool(_build_city_summary_payload, data)