Alerts: confidence gate before any push, held alerts, release on corroboration (server-26#300)
No confidence field exists anywhere in scene/incident data, so the alerter derives one: match weight (talkgroup 1.0, extracted tag 0.8, raw transcript 0.6) scaled down only when stt_confidence is under ALERT_STT_REFERENCE (0.3), zero for not_speech. Below ALERT_MIN_CONFIDENCE, or high severity (term list, or a major incident) without ALERT_CORROBORATION_MIN_CALLS calls or ALERT_HIGH_SEVERITY_MIN_CONFIDENCE, the match is written to alert_holds (no Firestore rule, admin-only GET /alerts/held) and logged instead of pushed. A needs_corroboration hold is released when a later call brings its incident to the call minimum; a rule pushed by that call supersedes its hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
240bbee5a4
commit
ff0a89e9f1
@@ -163,6 +163,30 @@ class Settings(BaseSettings):
|
||||
# else's PII. Both gates must be open before any snippet leaves.
|
||||
alert_transcript_snippet_enabled: bool = False
|
||||
place_verify_max_per_call: int = 3
|
||||
# ── Alert confidence gate (server-26#300) ─────────────────────────────────
|
||||
# Nothing in the pipeline emits a confidence, so the alerter derives one:
|
||||
# how the rule matched (talkgroup 1.0 / extracted tag 0.8 / raw transcript
|
||||
# text only 0.5 -- the CrimeRadar "fire alarm" -> "firearm" failure was a
|
||||
# transcript match) scaled down when Whisper's own per-token probability
|
||||
# (calls.stt_confidence) is below alert_stt_reference. Below the floor ->
|
||||
# held, never pushed. High-severity matches also need the incident to
|
||||
# have alert_corroboration_min_calls calls, or a confidence at or above
|
||||
# alert_high_severity_min_confidence; held ones are released when a
|
||||
# later call corroborates the incident. Starting values, not measured.
|
||||
alert_min_confidence: float = 0.5
|
||||
alert_high_severity_min_confidence: float = 0.85
|
||||
alert_corroboration_min_calls: int = 2
|
||||
# Low on purpose: exp(avg_logprob) on vocoded radio audio is often well
|
||||
# under 0.5 for speech that is right, and Groq/OpenAI logprobs are not on
|
||||
# a shared scale. Only clearly garbled audio should pull the score down.
|
||||
alert_stt_reference: float = 0.3
|
||||
alert_high_severity_terms: list[str] = [
|
||||
"shots-fired", "shots fired", "shooting", "shot", "gun", "firearm", "weapon",
|
||||
"stabbing", "stabbed", "officer-down", "officer down", "10-13",
|
||||
"officer-needs-assistance", "active-shooter", "hostage", "barricade",
|
||||
"explosion", "structure-fire", "structure fire", "working-fire",
|
||||
"entrapment", "cardiac-arrest", "vehicle-pursuit", "pursuit",
|
||||
]
|
||||
# How close a candidate has to sound before it may rewrite a transcript.
|
||||
# Below this, Places Text Search will confidently hand back the nearest
|
||||
# business for any garbage string.
|
||||
|
||||
Reference in New Issue
Block a user