mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 15:26:15 +00:00
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:
1 parent
fa7d61b7db
commit
5e2a22340f
5 files changed
+25
-78
No files matched your search
@@ -24,6 +24,7 @@ _SPANISH_HOLIDAYS: set[tuple[int, int]] = {
|
||||
(1, 1), # New Year's Day
|
||||
(1, 6), # Epiphany
|
||||
(5, 1), # Labour Day
|
||||
(7, 25), # Santiago Apóstol (National + Día de Galicia)
|
||||
(8, 15), # Assumption of Mary
|
||||
(10, 12), # National Day of Spain
|
||||
(11, 1), # All Saints' Day
|
||||
@@ -32,6 +33,8 @@ _SPANISH_HOLIDAYS: set[tuple[int, int]] = {
|
||||
(12, 25), # Christmas Day
|
||||
# Asturian regional
|
||||
(9, 8), # Day of Asturias
|
||||
# Castilla y León regional
|
||||
(4, 23), # Día de Castilla y León
|
||||
}
|
||||
|
||||
# Approximate Good Friday dates for years 2018-2035 (moveable feast).
|
||||
@@ -57,6 +60,16 @@ _GOOD_FRIDAY: dict[int, tuple[int, int]] = {
|
||||
2035: (3, 23),
|
||||
}
|
||||
|
||||
# Easter Monday dates for years 2018-2035 (Good Friday + 3 days).
|
||||
# Regional holiday in Castilla y León and Galicia.
|
||||
_EASTER_MONDAY: dict[int, tuple[int, int]] = {
|
||||
2018: (4, 2), 2019: (4, 22), 2020: (4, 13), 2021: (4, 5),
|
||||
2022: (4, 18), 2023: (4, 10), 2024: (4, 1), 2025: (4, 21),
|
||||
2026: (4, 6), 2027: (3, 29), 2028: (4, 17), 2029: (4, 2),
|
||||
2030: (4, 22), 2031: (4, 14), 2032: (3, 29), 2033: (4, 18),
|
||||
2034: (4, 10), 2035: (3, 26),
|
||||
}
|
||||
|
||||
|
||||
def _build_holiday_set(years: Optional[list[int]] = None) -> set[pd.Timestamp]:
|
||||
"""Return a set of Timestamps for every known holiday across the given years.
|
||||
@@ -81,6 +94,10 @@ def _build_holiday_set(years: Optional[list[int]] = None) -> set[pd.Timestamp]:
|
||||
if gf:
|
||||
holidays.add(pd.Timestamp(year=year, month=gf[0], day=gf[1]))
|
||||
|
||||
em = _EASTER_MONDAY.get(year)
|
||||
if em:
|
||||
holidays.add(pd.Timestamp(year=year, month=em[0], day=em[1]))
|
||||
|
||||
return holidays
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user