# fatimatanveer76/nexus_ai_hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/fatimatanveer76/nexus_ai_hackathon
- Repository: https://github.com/fatimatanveer76/nexus_ai_hackathon

## Overview

NEXUS AI is a disaster-response decision-support platform: operators maintain operational data, run resource-allocation optimization, inspect and map the plan, query a grounded Commander, and compare disruption simulations before human review. The map preserves documented operational-data, command-center, optimization, and what-if capabilities. Source excerpts establish the optimization and UI call paths; several API and storage relationships are supported by the source index, while simulation details beyond the UI excerpt remain limited.

Main entry points: [`backend/app/api/v1/optimization.py`](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/optimization.py) (Optimization API), [`backend/app/models.py`](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/models.py) (Operational model), [`backend/app/db.py`](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/db.py) (Operational database), [`frontend/src/App.tsx`](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/App.tsx) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Command Interface"]
  node_app["App navigation<br/>[App.tsx]"]
  node_commandpage["Command center"]
  node_commanderpage["Commander query<br/>[CommanderPage.tsx]"]
  node_datapages["Data management views"]
  node_map["Geospatial map<br/>[NexusMap.tsx]"]
  node_client["API client<br/>[client.ts]"]
end

subgraph group_api["Operational API"]
  node_api_router["API routing<br/>[router.py]"]
  node_operational_api["Operational records API"]
  node_optimization_api["Optimization API<br/>[optimization.py]"]
  node_commander_api["Commander API<br/>[commander.py]"]
end

subgraph group_decision["Decision Support"]
  node_optimizer["Allocation optimizer<br/>[optimization.py]"]
  node_commander["Grounded explanations<br/>[commander.py]"]
  node_simulation["What-if simulation"]
end

subgraph group_data["Operational Data"]
  node_schemas["Data contracts<br/>[schemas.py]"]
  node_models["Operational model<br/>[models.py]"]
  node_database[("Operational database<br/>[db.py]")]
  node_config["Database settings<br/>[config.py]"]
end

node_operator(("Commander"))

node_operator -->|"opens"| node_app
node_app -->|"routes to"| node_commandpage
node_app -->|"routes to"| node_commanderpage
node_app -->|"routes to"| node_datapages
node_commandpage -->|"requests"| node_client
node_commanderpage -->|"requests"| node_client
node_datapages -->|"requests"| node_client
node_commandpage -->|"renders"| node_map
node_client -->|"calls HTTP API"| node_api_router
node_api_router -->|"dispatches"| node_operational_api
node_api_router -->|"dispatches"| node_optimization_api
node_api_router -->|"dispatches"| node_commander_api
node_optimization_api -->|"runs allocation"| node_optimizer
node_commander_api -->|"queries"| node_commander
node_commander -->|"uses run context"| node_optimizer
node_commandpage -->|"compares scenarios"| node_simulation
node_operational_api -->|"reads and writes"| node_models
node_optimization_api -->|"loads run state"| node_models
node_optimizer -->|"reads and persists"| node_models
node_commander -->|"reads operations"| node_models
node_operational_api -->|"sessions"| node_database
node_optimization_api -->|"sessions"| node_database
node_commander_api -->|"sessions"| node_database
node_database -->|"configures connection"| node_config
node_operational_api -->|"validates responses"| node_schemas
node_optimization_api -->|"validates requests"| node_schemas
node_models -->|"maps tables"| node_database

click node_app "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/App.tsx"
click node_commandpage "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/OptimizationPage.tsx"
click node_commanderpage "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/CommanderPage.tsx"
click node_datapages "https://github.com/fatimatanveer76/nexus_ai_hackathon/tree/main/frontend/src/pages"
click node_map "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/components/NexusMap.tsx"
click node_client "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/api/client.ts"
click node_api_router "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/router.py"
click node_operational_api "https://github.com/fatimatanveer76/nexus_ai_hackathon/tree/main/backend/app/api/v1"
click node_optimization_api "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/optimization.py"
click node_commander_api "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/commander.py"
click node_optimizer "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/services/optimization.py"
click node_commander "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/services/commander.py"
click node_simulation "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/OptimizationPage.tsx"
click node_schemas "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/schemas.py"
click node_models "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/models.py"
click node_database "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/db.py"
click node_config "https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/config.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_app,node_commandpage,node_commanderpage,node_datapages,node_map,node_client toneBlue
class node_api_router,node_operational_api,node_optimization_api,node_commander_api toneAmber
class node_optimizer,node_commander,node_simulation toneMint
class node_schemas,node_models,node_database,node_config toneRose
class node_operator toneIndigo
```

## Components

### Command Interface

- [App navigation](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Command center](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/OptimizationPage.tsx): `frontend/src/pages/OptimizationPage.tsx`
- [Commander query](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/CommanderPage.tsx): `frontend/src/pages/CommanderPage.tsx`
- [Data management views](https://github.com/fatimatanveer76/nexus_ai_hackathon/tree/main/frontend/src/pages): `frontend/src/pages`
- [Geospatial map](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/components/NexusMap.tsx): `frontend/src/components/NexusMap.tsx`
- [API client](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Operational API

- [API routing](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Operational records API](https://github.com/fatimatanveer76/nexus_ai_hackathon/tree/main/backend/app/api/v1): `backend/app/api/v1`
- [Optimization API](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/optimization.py): `backend/app/api/v1/optimization.py`
- [Commander API](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/api/v1/commander.py): `backend/app/api/v1/commander.py`

### Decision Support

- [Allocation optimizer](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/services/optimization.py): `backend/app/services/optimization.py`
- [Grounded explanations](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/services/commander.py): `backend/app/services/commander.py`
- [What-if simulation](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/frontend/src/pages/OptimizationPage.tsx): `frontend/src/pages/OptimizationPage.tsx`

### Operational Data

- [Data contracts](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Operational model](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/models.py): `backend/app/models.py`
- [Operational database](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/db.py): `backend/app/db.py`
- [Database settings](https://github.com/fatimatanveer76/nexus_ai_hackathon/blob/main/backend/app/config.py): `backend/app/config.py`

### Other components

- **Commander**

## Connections

- Commander → App navigation: opens (evidence: `frontend/src/App.tsx`)
- App navigation → Command center: routes to (evidence: `frontend/src/App.tsx`)
- App navigation → Commander query: routes to (evidence: `frontend/src/App.tsx`)
- App navigation → Data management views: routes to (evidence: `frontend/src/App.tsx`)
- Command center → API client: requests (evidence: `frontend/src/pages/OptimizationPage.tsx`)
- Commander query → API client: requests (evidence: `frontend/src/pages/CommanderPage.tsx`)
- Data management views → API client: requests (evidence: `frontend/src/pages/DemandsPage.tsx`)
- Command center → Geospatial map: renders (evidence: `frontend/src/pages/OptimizationPage.tsx`)
- API client → API routing: calls HTTP API (evidence: `frontend/src/api/client.ts`)
- API routing → Operational records API: dispatches (evidence: `backend/app/api/v1/router.py`)
- API routing → Optimization API: dispatches (evidence: `backend/app/api/v1/router.py`)
- API routing → Commander API: dispatches (evidence: `backend/app/api/v1/router.py`)
- Optimization API → Allocation optimizer: runs allocation (evidence: `backend/app/api/v1/optimization.py`)
- Commander API → Grounded explanations: queries (evidence: `backend/app/api/v1/commander.py`)
- Grounded explanations → Allocation optimizer: uses run context (evidence: `backend/app/services/commander.py`)
- Command center → What-if simulation: compares scenarios (evidence: `frontend/src/pages/OptimizationPage.tsx`)
- Operational records API → Operational model: reads and writes (evidence: `backend/app/api/v1/demands.py`)
- Optimization API → Operational model: loads run state (evidence: `backend/app/api/v1/optimization.py`)
- Allocation optimizer → Operational model: reads and persists (evidence: `backend/app/services/optimization.py`)
- Grounded explanations → Operational model: reads operations (evidence: `backend/app/services/commander.py`)
- Operational records API → Operational database: sessions (evidence: `backend/app/api/v1/demands.py`)
- Optimization API → Operational database: sessions (evidence: `backend/app/api/v1/optimization.py`)
- Commander API → Operational database: sessions (evidence: `backend/app/api/v1/commander.py`)
- Operational database → Database settings: configures connection (evidence: `backend/app/db.py`)
- Operational records API → Data contracts: validates responses (evidence: `backend/app/api/v1/demands.py`)
- Optimization API → Data contracts: validates requests (evidence: `backend/app/api/v1/optimization.py`)
- Operational model → Operational database: maps tables (evidence: `backend/app/models.py`)
