mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-11 01:14:45 +02:00
feat(incident): config-driven TomTom min_magnitude filter
Add tomtom_incidents.min_magnitude setting (default 4 = severe) to adapter_config registry. Replace the hardcoded magnitude==0 drop check with a config-driven floor that silently drops any TomTom event below the configured threshold. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b60ea5c5db
commit
6149900917
2 changed files with 8 additions and 3 deletions
|
|
@ -180,6 +180,11 @@ REGISTRY: dict[tuple[str, str], dict[str, Any]] = {
|
|||
"type": "bool",
|
||||
"description": "Drop envelopes whose time_validity != 'present'.",
|
||||
},
|
||||
("tomtom_incidents", "min_magnitude"): {
|
||||
"default": 4,
|
||||
"type": "int",
|
||||
"description": "Minimum TomTom magnitude_of_delay to broadcast (1=minor, 2=moderate, 3=major, 4=severe). Anything below this is silently dropped.",
|
||||
},
|
||||
|
||||
# =================================================================
|
||||
# STATE_511_ATIS -- 1 setting (states to skip in favor of itd_511)
|
||||
|
|
|
|||
|
|
@ -272,10 +272,10 @@ def _parse_tomtom_incident(envelope: dict, now: int) -> Optional[dict]:
|
|||
inner = envelope.get("data") or {}
|
||||
d = inner.get("data") or {}
|
||||
|
||||
# FILTER §6: magnitude_of_delay == 0 -> drop at handler entrance.
|
||||
# v0.6-3b: gated by adapter_config.tomtom_incidents.drop_zero_magnitude.
|
||||
# Drop events below configured minimum magnitude.
|
||||
magnitude = d.get("magnitude_of_delay")
|
||||
if magnitude == 0 and bool(adapter_config.tomtom_incidents.drop_zero_magnitude):
|
||||
min_mag = int(adapter_config.tomtom_incidents.min_magnitude or 4)
|
||||
if magnitude is not None and magnitude < min_mag:
|
||||
return None
|
||||
|
||||
# FILTER §4: time_validity != 'present' -> drop past/future.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue