refactor(crowd_analysis): simplify table + upgrade YOLO + add regional holidays

- Remove internal YOLO counts (cars/people/buses/total_vehicles) from crowd_analysis table
- Keep only crowd_density and confidence_scores for persistence (no ML training impact)
- Upgrade from YOLOv8n to YOLOv11m for better person detection (fewer false positives)
- Add regional holidays: Día de Castilla y León (4/23), Santiago Apóstol (7/25, shared with Galicia)
- Add Easter Monday (moveable, 2018-2035) for Castilla y León and Galicia
- Update all tests to match simplified crowd_analysis schema

Tests: all 38 SQLite/crowd_analyzer tests + 13 feature tests passing.
This commit is contained in:
dasemu committed 2026-03-13 18:03:15 +01:00
1 parent fa7d61b7db
commit 5e2a22340f
5 files changed
+25 -78

No files matched your search

+2 -15
View File
@@ -318,24 +318,16 @@ class SQLiteStore:
analysis_date,
station_id,
image_path,
cars_detected,
people_detected,
buses_detected,
total_vehicles,
crowd_density,
confidence_scores_json
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?)
""",
(
analyzed_at,
analysis_date,
result.get("station_id"),
result.get("image_path"),
int(result.get("cars_detected", 0)),
int(result.get("people_detected", 0)),
int(result.get("buses_detected", 0)),
int(result.get("total_vehicles", 0)),
result.get("crowd_density"),
json.dumps(result.get("confidence_scores") or [], ensure_ascii=False),
),
@@ -370,8 +362,7 @@ class SQLiteStore:
query = f"""
SELECT analyzed_at, analysis_date, station_id, image_path,
cars_detected, people_detected, buses_detected,
total_vehicles, crowd_density, confidence_scores_json
crowd_density, confidence_scores_json
FROM crowd_analysis
{where}
ORDER BY analyzed_at ASC, id ASC
@@ -645,10 +636,6 @@ class SQLiteStore:
analysis_date TEXT NOT NULL,
station_id TEXT NOT NULL,
image_path TEXT,
cars_detected INTEGER NOT NULL,
people_detected INTEGER NOT NULL,
buses_detected INTEGER NOT NULL,
total_vehicles INTEGER NOT NULL,
crowd_density TEXT NOT NULL,
confidence_scores_json TEXT NOT NULL
);