ba43796c51
incident_correlator.py — full rewrite: always runs on every call, fetches all active incidents cross-type, fast path collects all talkgroup matches and disambiguates by unit/vehicle overlap → location proximity → embedding, new location proximity path, slow path requires location corroboration, "Auto:" stripped from titles, "auto-generated" tag added, units/vehicles now accumulated on update intelligence.py — resolved field in GPT schema, returned as 5th value upload.py — both pipelines unpack 5-tuple, always call correlate, auto-resolve on resolved=True summarizer.py — stale sweep runs each tick, resolves incidents idle for 90+ minutes config.py — correlation_window_hours=2, embedding_similarity_threshold=0.93, location_proximity_km=0.5, incident_auto_resolve_minutes=90
90 lines
2.0 KiB
TypeScript
90 lines
2.0 KiB
TypeScript
export type NodeStatus = "online" | "offline" | "recording" | "unconfigured";
|
|
export type ApprovalStatus = "pending" | "approved" | "rejected";
|
|
|
|
export interface NodeRecord {
|
|
node_id: string;
|
|
name: string;
|
|
lat: number;
|
|
lon: number;
|
|
status: NodeStatus;
|
|
configured: boolean;
|
|
last_seen: string | null;
|
|
assigned_system_id: string | null;
|
|
approval_status: ApprovalStatus | null;
|
|
}
|
|
|
|
export interface SystemRecord {
|
|
system_id: string;
|
|
name: string;
|
|
type: string; // P25 | DMR | NBFM
|
|
config: Record<string, unknown>;
|
|
}
|
|
|
|
export interface TranscriptSegment {
|
|
start: number;
|
|
end: number;
|
|
text: string;
|
|
}
|
|
|
|
export interface CallRecord {
|
|
call_id: string;
|
|
node_id: string;
|
|
system_id: string | null;
|
|
talkgroup_id: number | null;
|
|
talkgroup_name: string | null;
|
|
freq: number | null;
|
|
started_at: string;
|
|
ended_at: string | null;
|
|
audio_url: string | null;
|
|
transcript: string | null;
|
|
transcript_corrected: string | null;
|
|
segments: TranscriptSegment[] | null;
|
|
incident_id: string | null;
|
|
location: string | null;
|
|
tags: string[];
|
|
status: "active" | "ended";
|
|
}
|
|
|
|
export interface IncidentRecord {
|
|
incident_id: string;
|
|
title: string | null;
|
|
type: string | null;
|
|
status: "active" | "resolved";
|
|
location: string | null;
|
|
location_coords: { lat: number; lng: number } | null;
|
|
call_ids: string[];
|
|
system_ids: string[];
|
|
talkgroup_ids: string[];
|
|
units: string[];
|
|
vehicles: string[];
|
|
severity: string | null;
|
|
started_at: string;
|
|
updated_at: string;
|
|
summary: string | null;
|
|
tags: string[];
|
|
}
|
|
|
|
export interface AlertRule {
|
|
rule_id: string;
|
|
name: string;
|
|
keywords: string[];
|
|
talkgroup_ids: number[];
|
|
enabled: boolean;
|
|
discord_webhook: string | null;
|
|
created_at?: string;
|
|
}
|
|
|
|
export interface AlertEvent {
|
|
alert_id: string;
|
|
rule_id: string;
|
|
rule_name: string;
|
|
call_id: string;
|
|
node_id: string;
|
|
talkgroup_id: number | null;
|
|
talkgroup_name: string | null;
|
|
matched_keywords: string[];
|
|
transcript_snippet: string | null;
|
|
triggered_at: string;
|
|
acknowledged: boolean;
|
|
}
|