# Architecture & Data Flow ## 1. drb-c2-core (The Brain) **Purpose:** The central command-and-control server. **Tech:** Python (FastAPI), MQTT Broker (Mosquitto), Firestore. **Role:** Manages node health (Heartbeats) and acts as the gatekeeper for configuration commands. It provides the "Raw Data" (Nodes, Frequencies) to the system. ## 2. drb-edge-node (The Ear) **Purpose:** The physical radio receiver. **Tech:** Docker, Python, OP25, Liquidsoap. **Role:** Listens to RF, demodulates audio, and extracts metadata (Talkgroup, Frequency). **Check-In:** Sends heartbeat every 30s. **Output:** Sends Audio and Metadata to Icecast and Metadata to MQTT. ## 3. drb-intelligence-engine (The Analyst) **Purpose:** Converts raw audio/text into structured Intelligence. **Tech:** Python, OpenAI Whisper, LLM (GPT-4o/Claude), Vector Search (Optional). **Core Logic:** The Incident Aggregator Unlike simple logging, this engine maintains "State". - **Step 1 Transcribe:** Audio -> Text. - **Step 2 Classify:** Determines if the text is "Routine" (Traffic stop, status check) or "Incident" (Fire, Burglary). - **Step 3 Correlate (Global Knowledge):** It looks at all active incidents across all nodes. **Scenario:** Node A (PD) hears "Responding to 123 Main St". Node B (FD) hears "Fire at 123 Main St". **Action:** The engine groups both calls into a single Incident document because the location and time window overlap. - **Step 4 Update:** Updates the Firestore incidents collection with new summaries, active units, and status. ## 4. drb-web-portal (The Dashboard) **Purpose:** User interface for real-time situational awareness. **Tech:** Next.js, Tailwind, Mapbox/Leaflet. **Data Model:** - **Nodes:** Physical status of receivers. - **Incidents:** The "Event" layer. Contains the derived data (Location, Summary, Transcript list). **Visuals:** - **Map:** Shows Incidents, not just radios. - **Detail View:** Rolling transcript of a specific event, filtering out unrelated noise from the same radio frequency. ## 5. Data Model (Firestore) ### Collection: `nodes` ```json { "id": "node-01", "status": "online", "location": { "lat": 0.0, "lng": 0.0 } } ``` ### Collection: `incidents` ```json { "id": "inc-timestamp-hash", "type": "Structure Fire", "status": "Active", // or "Cleared" "started_at": "Timestamp", "last_update": "Timestamp", "location": { "lat": 0.0, "lng": 0.0 }, "location_history": [ { "lat": 0.0, "lng": 0.0, "time": "Timestamp" } ], "units_on_scene": ["E-22", "L-4", "PD-102"], "summary": "Fire reported at 123 Main St. Smoke visible. Units en route.", "transcript_refs": ["Array of IDs pointing to the raw history logs"], "heard_on":["city_fire_department_dispatch_system", "county_police_radio_system"] } ```