mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-11 01:14:45 +02:00
feat(wfigs): add severity override for fire broadcasts
Fire events now carry _severity_override in the data dict: - New fires (case i/ii): priority by default - Update fires (case iii): priority by default - All fires: immediate if acres > 1000 OR contained_pct == 0 consumer.py checks for _severity_override before falling back to map_severity(inner.severity). This ensures fire broadcasts are prioritized appropriately in the dispatch queue. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fa8553a1e0
commit
69ccbc035a
2 changed files with 12 additions and 1 deletions
|
|
@ -584,10 +584,12 @@ class CentralConsumer:
|
||||||
source = CENTRAL_ADAPTER_TO_SOURCE.get(raw_adapter, raw_adapter)
|
source = CENTRAL_ADAPTER_TO_SOURCE.get(raw_adapter, raw_adapter)
|
||||||
if source != raw_adapter:
|
if source != raw_adapter:
|
||||||
logger.debug("Central adapter %r -> meshai source %r", raw_adapter, source)
|
logger.debug("Central adapter %r -> meshai source %r", raw_adapter, source)
|
||||||
|
# v0.6-3c: use handler severity override if present
|
||||||
|
sev_override = data.get("_severity_override") if isinstance(data, dict) else None
|
||||||
return make_event(
|
return make_event(
|
||||||
source=source,
|
source=source,
|
||||||
category=category,
|
category=category,
|
||||||
severity=map_severity(inner.get("severity")),
|
severity=sev_override or map_severity(inner.get("severity")),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,9 @@ def handle_wfigs(normalized: dict, envelope: dict, subject: str,
|
||||||
# from acres/containment updates (wildfire_incident).
|
# from acres/containment updates (wildfire_incident).
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
data["category"] = "wildfire_declared"
|
data["category"] = "wildfire_declared"
|
||||||
|
# v0.6-3c: severity override for fire broadcasts
|
||||||
|
if isinstance(data, dict):
|
||||||
|
data["_severity_override"] = "immediate" if (acres and acres > 1000) or contained_pct == 0 else "priority"
|
||||||
_attach_commit_handles(data, irwin_id=irwin_id,
|
_attach_commit_handles(data, irwin_id=irwin_id,
|
||||||
acres=acres, contained_pct=contained_pct,
|
acres=acres, contained_pct=contained_pct,
|
||||||
event_log_row_id=log_id)
|
event_log_row_id=log_id)
|
||||||
|
|
@ -170,6 +173,9 @@ def handle_wfigs(normalized: dict, envelope: dict, subject: str,
|
||||||
# handler call ran but no actual broadcast went out.
|
# handler call ran but no actual broadcast went out.
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
data["category"] = "wildfire_declared"
|
data["category"] = "wildfire_declared"
|
||||||
|
# v0.6-3c: severity override for fire broadcasts
|
||||||
|
if isinstance(data, dict):
|
||||||
|
data["_severity_override"] = "immediate" if (acres and acres > 1000) or contained_pct == 0 else "priority"
|
||||||
_attach_commit_handles(data, irwin_id=irwin_id,
|
_attach_commit_handles(data, irwin_id=irwin_id,
|
||||||
acres=acres, contained_pct=contained_pct,
|
acres=acres, contained_pct=contained_pct,
|
||||||
event_log_row_id=log_id)
|
event_log_row_id=log_id)
|
||||||
|
|
@ -209,6 +215,9 @@ def handle_wfigs(normalized: dict, envelope: dict, subject: str,
|
||||||
|
|
||||||
if (changed_acres or changed_contained) and eight_hours_passed:
|
if (changed_acres or changed_contained) and eight_hours_passed:
|
||||||
wire = _render(normalized, prefix="Update")
|
wire = _render(normalized, prefix="Update")
|
||||||
|
# v0.6-3c: severity override for fire updates
|
||||||
|
if isinstance(data, dict):
|
||||||
|
data["_severity_override"] = "immediate" if (acres and acres > 1000) or contained_pct == 0 else "priority"
|
||||||
_attach_commit_handles(data, irwin_id=irwin_id,
|
_attach_commit_handles(data, irwin_id=irwin_id,
|
||||||
acres=acres, contained_pct=contained_pct,
|
acres=acres, contained_pct=contained_pct,
|
||||||
event_log_row_id=log_id)
|
event_log_row_id=log_id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue