# chandra372/nexus-resq architecture

> Architecture diagram of the GitHub repository chandra372/nexus-resq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandra372/nexus-resq
- Repository: https://github.com/chandra372/nexus-resq

## Overview

NEXUS RESQ turns multi-channel emergency reports into traceable incident records for a human responder dashboard. Its main workflow is staged report ingestion, classification and information extraction, location resolution and incident matching, then persistent incident updates with evidence and priority. The README documents these domain stages and the dashboard; sampled source confirms key orchestration, route, and UI connections. Several service-to-service links rely on the documented workflow because the stage-engine excerpt omits the processing section.

Main entry points: [`nexus-resq/backend/app/services/stages/stage_engine.py`](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/stages/stage_engine.py) (Stage processing), [`nexus-resq/backend/app/services/incidents/memory.py`](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/incidents/memory.py) (Incident memory), [`nexus-resq/backend/app/services/ingestion/discovery.py`](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/ingestion/discovery.py) (Dataset ingestion), [`nexus-resq/frontend/src/pages/Dashboard.tsx`](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/pages/Dashboard.tsx) (Operations dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Report inputs"]
  node_dataset["Staged reports"]
  node_discovery["Dataset ingestion<br/>[discovery.py]"]
  node_transcription["Speech transcription<br/>[speech_provider.py]"]
  node_events["Unified events<br/>[events.py]"]
end

subgraph group_analysis["Report analysis"]
  node_stage_engine["Stage processing<br/>[stage_engine.py]"]
  node_classifier["Intent classifier<br/>[classifier.py]"]
  node_extractor["Information extraction<br/>[extractor.py]"]
  node_location["Location resolver<br/>[resolver.py]"]
end

subgraph group_incidents["Incident intelligence"]
  node_matcher["Incident matching<br/>[matcher.py]"]
  node_memory[("Incident memory<br/>[memory.py]")]
  node_evidence["Evidence engine<br/>[evidence_engine.py]"]
  node_priority["Priority engine<br/>[priority_engine.py]"]
  node_incident_schema["Incident records<br/>[incident.py]"]
end

subgraph group_service["API service"]
  node_api["REST and WebSocket API<br/>[routes.py]"]
  node_evaluation["Benchmark evaluation<br/>[evaluate.py]"]
end

subgraph group_dashboard["Responder dashboard"]
  node_dashboard["Operations dashboard<br/>[Dashboard.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_ui_components["Incident and map views<br/>[LiveMap.tsx]"]
  node_evaluation_ui["Evaluation view"]
end

node_reporters(("Report sources"))
node_human(("Responders"))

node_reporters -.->|"submit reports"| node_dataset
node_dataset -.->|"read stages"| node_discovery
node_discovery -->|"transcribes audio"| node_transcription
node_discovery -->|"creates events"| node_events
node_stage_engine -->|"loads stages"| node_discovery
node_stage_engine -->|"classifies reports"| node_classifier
node_stage_engine -->|"extracts details"| node_extractor
node_stage_engine -->|"resolves locations"| node_location
node_stage_engine -->|"matches incidents"| node_matcher
node_stage_engine -->|"updates memory"| node_memory
node_matcher -.->|"selects incident"| node_memory
node_memory -->|"uses evidence"| node_evidence
node_memory -->|"calculates priority"| node_priority
node_memory -->|"builds records"| node_incident_schema
node_api -->|"controls replay"| node_stage_engine
node_api -->|"reads incidents"| node_memory
node_human -->|"reviews incidents"| node_dashboard
node_dashboard -->|"requests data"| node_api_client
node_api_client -.->|"calls endpoints"| node_api
node_dashboard -->|"renders views"| node_ui_components
node_dashboard -->|"opens evaluation"| node_evaluation_ui
node_evaluation_ui -->|"requests metrics"| node_api_client
node_evaluation -->|"evaluates ingestion"| node_discovery
node_evaluation -->|"evaluates clustering"| node_memory

click node_dataset "https://github.com/chandra372/nexus-resq/tree/main/large_emergency_dataset"
click node_discovery "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/ingestion/discovery.py"
click node_transcription "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/transcription/speech_provider.py"
click node_events "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/schemas/events.py"
click node_stage_engine "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/stages/stage_engine.py"
click node_classifier "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/ai/classifier.py"
click node_extractor "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/extraction/extractor.py"
click node_location "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/location/resolver.py"
click node_matcher "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/clustering/matcher.py"
click node_memory "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/incidents/memory.py"
click node_evidence "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/evidence/evidence_engine.py"
click node_priority "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/priority/priority_engine.py"
click node_incident_schema "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/schemas/incident.py"
click node_api "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/api/routes.py"
click node_dashboard "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/pages/Dashboard.tsx"
click node_api_client "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/services/api.ts"
click node_ui_components "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/components/LiveMap.tsx"
click node_evaluation_ui "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/components/EvaluationModal.tsx"
click node_evaluation "https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/evaluation/evaluate.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_discovery,node_transcription,node_events toneBlue
class node_stage_engine,node_classifier,node_extractor,node_location toneAmber
class node_matcher,node_memory,node_evidence,node_priority,node_incident_schema toneMint
class node_api,node_evaluation toneRose
class node_dashboard,node_api_client,node_ui_components,node_evaluation_ui,node_reporters,node_human toneIndigo
```

## Components

### Report inputs

- [Staged reports](https://github.com/chandra372/nexus-resq/tree/main/large_emergency_dataset): `large_emergency_dataset`
- [Dataset ingestion](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/ingestion/discovery.py): `nexus-resq/backend/app/services/ingestion/discovery.py`
- [Speech transcription](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/transcription/speech_provider.py): `nexus-resq/backend/app/services/transcription/speech_provider.py`
- [Unified events](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/schemas/events.py): `nexus-resq/backend/app/schemas/events.py`

### Report analysis

- [Stage processing](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/stages/stage_engine.py): `nexus-resq/backend/app/services/stages/stage_engine.py`
- [Intent classifier](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/ai/classifier.py): `nexus-resq/backend/app/services/ai/classifier.py`
- [Information extraction](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/extraction/extractor.py): `nexus-resq/backend/app/services/extraction/extractor.py`
- [Location resolver](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/location/resolver.py): `nexus-resq/backend/app/services/location/resolver.py`

### Incident intelligence

- [Incident matching](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/clustering/matcher.py): `nexus-resq/backend/app/services/clustering/matcher.py`
- [Incident memory](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/incidents/memory.py): `nexus-resq/backend/app/services/incidents/memory.py`
- [Evidence engine](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/evidence/evidence_engine.py): `nexus-resq/backend/app/services/evidence/evidence_engine.py`
- [Priority engine](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/services/priority/priority_engine.py): `nexus-resq/backend/app/services/priority/priority_engine.py`
- [Incident records](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/schemas/incident.py): `nexus-resq/backend/app/schemas/incident.py`

### API service

- [REST and WebSocket API](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/app/api/routes.py): `nexus-resq/backend/app/api/routes.py`
- [Benchmark evaluation](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/backend/evaluation/evaluate.py): `nexus-resq/backend/evaluation/evaluate.py`

### Responder dashboard

- [Operations dashboard](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/pages/Dashboard.tsx): `nexus-resq/frontend/src/pages/Dashboard.tsx`
- [API client](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/services/api.ts): `nexus-resq/frontend/src/services/api.ts`
- [Incident and map views](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/components/LiveMap.tsx): `nexus-resq/frontend/src/components/LiveMap.tsx`
- [Evaluation view](https://github.com/chandra372/nexus-resq/blob/main/nexus-resq/frontend/src/components/EvaluationModal.tsx): `nexus-resq/frontend/src/components/EvaluationModal.tsx`

### Other components

- **Report sources**
- **Responders**

## Connections

- Report sources → Staged reports: submit reports (evidence: `README.md`)
- Staged reports → Dataset ingestion: read stages (evidence: `README.md`)
- Dataset ingestion → Speech transcription: transcribes audio (evidence: `nexus-resq/backend/app/services/ingestion/discovery.py`)
- Dataset ingestion → Unified events: creates events (evidence: `nexus-resq/backend/app/services/ingestion/discovery.py`)
- Stage processing → Dataset ingestion: loads stages (evidence: `nexus-resq/backend/app/services/stages/stage_engine.py`)
- Stage processing → Intent classifier: classifies reports (evidence: `README.md`)
- Stage processing → Information extraction: extracts details (evidence: `README.md`)
- Stage processing → Location resolver: resolves locations (evidence: `README.md`)
- Stage processing → Incident matching: matches incidents (evidence: `README.md`)
- Stage processing → Incident memory: updates memory (evidence: `nexus-resq/backend/app/services/stages/stage_engine.py`)
- Incident matching → Incident memory: selects incident (evidence: `README.md`)
- Incident memory → Evidence engine: uses evidence (evidence: `nexus-resq/backend/app/services/incidents/memory.py`)
- Incident memory → Priority engine: calculates priority (evidence: `nexus-resq/backend/app/services/incidents/memory.py`)
- Incident memory → Incident records: builds records (evidence: `nexus-resq/backend/app/services/incidents/memory.py`)
- REST and WebSocket API → Stage processing: controls replay (evidence: `nexus-resq/backend/app/api/routes.py`)
- REST and WebSocket API → Incident memory: reads incidents (evidence: `nexus-resq/backend/app/api/routes.py`)
- Responders → Operations dashboard: reviews incidents (evidence: `README.md`)
- Operations dashboard → API client: requests data (evidence: `nexus-resq/frontend/src/pages/Dashboard.tsx`)
- API client → REST and WebSocket API: calls endpoints (evidence: `nexus-resq/frontend/src/services/api.ts`)
- Operations dashboard → Incident and map views: renders views (evidence: `nexus-resq/frontend/src/pages/Dashboard.tsx`)
- Operations dashboard → Evaluation view: opens evaluation (evidence: `nexus-resq/frontend/src/pages/Dashboard.tsx`)
- Evaluation view → API client: requests metrics (evidence: `nexus-resq/frontend/src/components/EvaluationModal.tsx`)
- Benchmark evaluation → Dataset ingestion: evaluates ingestion (evidence: `nexus-resq/backend/evaluation/evaluate.py`)
- Benchmark evaluation → Incident memory: evaluates clustering (evidence: `nexus-resq/backend/evaluation/evaluate.py`)
