# cyberclutch146/paradox---26-iem-sl architecture

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

- Interactive diagram: https://gitdiagram.com/cyberclutch146/paradox---26-iem-sl
- Repository: https://github.com/cyberclutch146/paradox---26-iem-sl

## Overview

DistraAI is a disaster-risk dashboard for monitoring flood and landslide hazards across Indian regions. Its main workflow serves regional risk data through a mock/API provider seam to dashboard views for maps, scores, alerts, sensor insights, and reports. A separate responder-chat workflow sends questions through the chat API to the remote ML orchestrator, with Gemini as a secondary explainer; Firebase backs live room chat. The graph preserves documented agent and GIS capabilities, but several links to unsampled UI and Python implementation details are supported only by README statements.

Main entry points: [`src/lib/use-data.ts`](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/use-data.ts) (Data hook), [`src/lib/agents/orchestrator.ts`](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/orchestrator.ts) (Agent orchestrator), [`src/lib/agents/chat-service.ts`](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/chat-service.ts) (Local chat service), [`src/lib/mock-store.ts`](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/mock-store.ts) (Sample data store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_dashboard["Risk dashboard<br/>[dashboard-view.tsx]"]
  node_map["Risk map<br/>[RiskMap.tsx]"]
  node_alerts["Alert feed<br/>[AlertsFeed.tsx]"]
  node_insights["Sensor insights<br/>[InsightCards.tsx]"]
  node_reports["Zone reports<br/>[view.tsx]"]
  node_community["Community reports"]
  node_chatroom["Responder room<br/>[ChatRoom.tsx]"]
end

subgraph group_data["Risk data"]
  node_use_data["Data hook<br/>[use-data.ts]"]
  node_client["Provider seam<br/>[data-client.ts]"]
  node_mock[("Sample data store<br/>[mock-store.ts]")]
  node_regions["Region catalog<br/>[regions.ts]"]
  node_zones["Risk zones<br/>[mockRiskZones.ts]"]
  node_risk_summary["Risk summary<br/>[risk-summary.ts]"]
  node_api_routes["Data API routes"]
end

subgraph group_conversation["Chat and agents"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_bridge["Orchestrator bridge"]
  node_chat_service["Local chat service<br/>[chat-service.ts]"]
  node_planner["Query planner<br/>[planner.ts]"]
  node_composer["Answer composer<br/>[composer.ts]"]
  node_gemini["Gemini assistant<br/>[gemini-brain.ts]"]
end

subgraph group_inference["ML inference"]
  node_orchestrator["Agent orchestrator<br/>[orchestrator.ts]"]
  node_risk_agent["Risk scoring<br/>[risk-agent.ts]"]
  node_gis_agent["GIS analysis<br/>[gis-agent.ts]"]
  node_community_agent["Ground reports<br/>[community-agent.ts]"]
  node_alert_agent["Alert drafting<br/>[alert-agent.ts]"]
  node_remote_ml["Remote ML service<br/>[orchestrator.py]"]
  node_python_gis["GIS sub-agent<br/>[api_backend.py]"]
  node_point_model["Point-risk model<br/>[risk_agent &#40;1&#41;.py]"]
end

subgraph group_services["Persistence"]
  node_sqlite[("SQLite store<br/>[db.ts]")]
  node_firebase[("Firebase auth and chat<br/>[firebase.ts]")]
end

node_responder(("Responder"))

node_responder -->|"views risk"| node_dashboard
node_dashboard -.->|"requests data"| node_use_data
node_use_data -->|"calls"| node_client
node_client -->|"loads fixtures"| node_mock
node_client -->|"fetches when API"| node_api_routes
node_mock -->|"reads zones"| node_zones
node_mock -->|"reads region data"| node_regions
node_mock -->|"computes summary"| node_risk_summary
node_api_routes -->|"queries when available"| node_sqlite
node_api_routes -->|"computes summary"| node_risk_summary
node_use_data -.->|"supplies risk data"| node_map
node_use_data -.->|"supplies alert data"| node_alerts
node_use_data -.->|"supplies insights"| node_insights
node_use_data -.->|"supplies reports"| node_reports
node_use_data -->|"supplies reports"| node_community
node_responder -->|"joins"| node_chatroom
node_chatroom -.->|"authenticates and listens"| node_firebase
node_responder -->|"submits question"| node_chat_api
node_chat_api -->|"calls"| node_bridge
node_chat_api -.->|"passes optional client"| node_gemini
node_chat_service -->|"plans local query"| node_planner
node_chat_service -->|"runs local plan"| node_orchestrator
node_chat_service -->|"composes reply"| node_composer
node_chat_service -->|"tries Gemini"| node_gemini
node_bridge -->|"dispatches inference"| node_remote_ml
node_bridge -->|"uses as explainer"| node_gemini
node_remote_ml -->|"queries GIS"| node_python_gis
node_remote_ml -->|"runs simulation"| node_point_model
node_orchestrator -->|"routes risk requests"| node_risk_agent
node_orchestrator -->|"requests zone evidence"| node_gis_agent
node_orchestrator -->|"requests reports"| node_community_agent
node_orchestrator -->|"drafts alerts"| node_alert_agent

click node_dashboard "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/dashboard-view.tsx"
click node_map "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/map/RiskMap.tsx"
click node_alerts "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/alerts/AlertsFeed.tsx"
click node_insights "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/insights/InsightCards.tsx"
click node_reports "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/reports/view.tsx"
click node_community "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/community/CommunityPreview.tsx"
click node_chatroom "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/chat/ChatRoom.tsx"
click node_use_data "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/use-data.ts"
click node_client "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/data-client.ts"
click node_mock "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/mock-store.ts"
click node_regions "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/data/regions.ts"
click node_zones "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/data/mockRiskZones.ts"
click node_risk_summary "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/risk-summary.ts"
click node_api_routes "https://github.com/cyberclutch146/paradox---26-iem-sl/tree/main/src/app/api"
click node_sqlite "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/db.ts"
click node_chat_api "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/api/chat/route.ts"
click node_bridge "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/orchestrator-bridge.ts"
click node_chat_service "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/chat-service.ts"
click node_planner "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/planner.ts"
click node_composer "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/composer.ts"
click node_gemini "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/gemini-brain.ts"
click node_orchestrator "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/orchestrator.ts"
click node_risk_agent "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/risk-agent.ts"
click node_gis_agent "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/gis-agent.ts"
click node_community_agent "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/community-agent.ts"
click node_alert_agent "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/alert-agent.ts"
click node_remote_ml "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/orchestrator.py"
click node_python_gis "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/GIS_agent/api_backend.py"
click node_point_model "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/risk_agent/risk_agent%20(1).py"
click node_firebase "https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/firebase.ts"

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_dashboard,node_map,node_alerts,node_insights,node_reports,node_community,node_chatroom toneBlue
class node_use_data,node_client,node_mock,node_regions,node_zones,node_risk_summary,node_api_routes toneAmber
class node_chat_api,node_bridge,node_chat_service,node_planner,node_composer,node_gemini toneMint
class node_orchestrator,node_risk_agent,node_gis_agent,node_community_agent,node_alert_agent,node_remote_ml,node_python_gis,node_point_model toneRose
class node_sqlite,node_firebase,node_responder toneIndigo
```

## Components

### Dashboard experience

- [Risk dashboard](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/dashboard-view.tsx): `src/app/dashboard-view.tsx`
- [Risk map](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/map/RiskMap.tsx): `src/components/map/RiskMap.tsx`
- [Alert feed](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/alerts/AlertsFeed.tsx): `src/components/alerts/AlertsFeed.tsx`
- [Sensor insights](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/insights/InsightCards.tsx): `src/components/insights/InsightCards.tsx`
- [Zone reports](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/reports/view.tsx): `src/app/reports/view.tsx`
- [Community reports](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/community/CommunityPreview.tsx): `src/components/community/CommunityPreview.tsx`
- [Responder room](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/components/chat/ChatRoom.tsx): `src/components/chat/ChatRoom.tsx`

### Risk data

- [Data hook](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/use-data.ts): `src/lib/use-data.ts`
- [Provider seam](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/data-client.ts): `src/lib/data-client.ts`
- [Sample data store](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/mock-store.ts): `src/lib/mock-store.ts`
- [Region catalog](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/data/regions.ts): `src/data/regions.ts`
- [Risk zones](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/data/mockRiskZones.ts): `src/data/mockRiskZones.ts`
- [Risk summary](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/risk-summary.ts): `src/lib/risk-summary.ts`
- [Data API routes](https://github.com/cyberclutch146/paradox---26-iem-sl/tree/main/src/app/api): `src/app/api`

### Chat and agents

- [Chat API](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Orchestrator bridge](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/orchestrator-bridge.ts): `src/lib/agents/orchestrator-bridge.ts`
- [Local chat service](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/chat-service.ts): `src/lib/agents/chat-service.ts`
- [Query planner](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/planner.ts): `src/lib/agents/planner.ts`
- [Answer composer](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/composer.ts): `src/lib/agents/composer.ts`
- [Gemini assistant](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/gemini-brain.ts): `src/lib/agents/gemini-brain.ts`

### ML inference

- [Agent orchestrator](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/orchestrator.ts): `src/lib/agents/orchestrator.ts`
- [Risk scoring](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/risk-agent.ts): `src/lib/agents/risk-agent.ts`
- [GIS analysis](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/gis-agent.ts): `src/lib/agents/gis-agent.ts`
- [Ground reports](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/community-agent.ts): `src/lib/agents/community-agent.ts`
- [Alert drafting](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/agents/alert-agent.ts): `src/lib/agents/alert-agent.ts`
- [Remote ML service](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/orchestrator.py): `orchestrator/orchestrator.py`
- [GIS sub-agent](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/GIS_agent/api_backend.py): `orchestrator/GIS_agent/api_backend.py`
- [Point-risk model](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/orchestrator/risk_agent/risk_agent%20(1).py): `orchestrator/risk_agent/risk_agent (1).py`

### Persistence

- [SQLite store](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Firebase auth and chat](https://github.com/cyberclutch146/paradox---26-iem-sl/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`

### Other components

- **Responder**

## Connections

- Responder → Risk dashboard: views risk (evidence: `README.md`)
- Risk dashboard → Data hook: requests data (evidence: `README.md`)
- Data hook → Provider seam: calls (evidence: `README.md`)
- Provider seam → Sample data store: loads fixtures (evidence: `src/lib/data-client.ts`)
- Provider seam → Data API routes: fetches when API (evidence: `src/lib/data-client.ts`)
- Sample data store → Risk zones: reads zones (evidence: `src/lib/mock-store.ts`)
- Sample data store → Region catalog: reads region data (evidence: `src/lib/mock-store.ts`)
- Sample data store → Risk summary: computes summary (evidence: `src/lib/mock-store.ts`)
- Data API routes → SQLite store: queries when available (evidence: `src/app/api/risk-summary/route.ts`)
- Data API routes → Risk summary: computes summary (evidence: `src/app/api/risk-summary/route.ts`)
- Data hook → Risk map: supplies risk data (evidence: `README.md`)
- Data hook → Alert feed: supplies alert data (evidence: `README.md`)
- Data hook → Sensor insights: supplies insights (evidence: `README.md`)
- Data hook → Zone reports: supplies reports (evidence: `README.md`)
- Data hook → Community reports: supplies reports (evidence: `src/components/community/CommunityPreview.tsx`)
- Responder → Responder room: joins (evidence: `README.md`)
- Responder room → Firebase auth and chat: authenticates and listens (evidence: `README.md`)
- Responder → Chat API: submits question (evidence: `README.md`)
- Chat API → Orchestrator bridge: calls (evidence: `src/app/api/chat/route.ts`)
- Chat API → Gemini assistant: passes optional client (evidence: `src/app/api/chat/route.ts`)
- Local chat service → Query planner: plans local query (evidence: `src/lib/agents/chat-service.ts`)
- Local chat service → Agent orchestrator: runs local plan (evidence: `src/lib/agents/chat-service.ts`)
- Local chat service → Answer composer: composes reply (evidence: `src/lib/agents/chat-service.ts`)
- Local chat service → Gemini assistant: tries Gemini (evidence: `src/lib/agents/chat-service.ts`)
- Orchestrator bridge → Remote ML service: dispatches inference (evidence: `README.md`)
- Orchestrator bridge → Gemini assistant: uses as explainer (evidence: `README.md`)
- Remote ML service → GIS sub-agent: queries GIS (evidence: `README.md`)
- Remote ML service → Point-risk model: runs simulation (evidence: `README.md`)
- Agent orchestrator → Risk scoring: routes risk requests (evidence: `src/lib/agents/orchestrator.ts`)
- Agent orchestrator → GIS analysis: requests zone evidence (evidence: `src/lib/agents/orchestrator.ts`)
- Agent orchestrator → Ground reports: requests reports (evidence: `src/lib/agents/orchestrator.ts`)
- Agent orchestrator → Alert drafting: drafts alerts (evidence: `src/lib/agents/orchestrator.ts`)
