# dshri2005/rescuenetai_major_project architecture

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

- Interactive diagram: https://gitdiagram.com/dshri2005/rescuenetai_major_project
- Repository: https://github.com/dshri2005/rescuenetai_major_project

## Overview

RescueNet AI combines authenticated disaster guidance with citizen/volunteer emergency operations. A user signs in, selects a state, and uses the dashboard for guidance, alerts, services, or SOS; volunteers coordinate and track SOS cases. The documented chat pipeline routes queries to policy, risk, shelter, or fallback handling and returns cited, confidence-aware answers. Alert ingestion polls SACHET and persists cached XML and parsed events. Paths for unsampled chat and emergency implementations are limited to their enclosing API/agent directories; their documented capabilities are represented without asserting undocumented internal call wiring.

Main entry points: [`backend/app/api/emergency.py`](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/emergency.py) (Emergency API), [`frontend/src/App.jsx`](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/App.jsx) (Session shell), [`backend/app/api/auth.py`](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/auth.py) (Authentication API), [`frontend/src/guidelines.jsx`](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/guidelines.jsx) (Guidance dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_app["Session shell<br/>[App.jsx]"]
  node_authui["Sign-in forms<br/>[auth.jsx]"]
  node_dashboard["Guidance dashboard<br/>[guidelines.jsx]"]
  node_stateui["State selection<br/>[StateRequired.jsx]"]
  node_incidentmap["Incident map"]
  node_volunteerqueue["Volunteer queue<br/>[VolunteerQueue.jsx]"]
  node_volunteerprofileui["Volunteer profile"]
end

subgraph group_identity["Identity and profiles"]
  node_authapi["Authentication API<br/>[auth.py]"]
end

subgraph group_assistant["Disaster assistant"]
  node_chatapi["Chat API<br/>[chat.py]"]
  node_orchestrator["Query routing<br/>[orchestrator.py]"]
  node_retrieval["Policy retrieval<br/>[retrieval.py]"]
  node_risk["Risk assessment<br/>[risk_agent.py]"]
  node_uncertainty["Confidence scoring<br/>[uncertainty.py]"]
  node_response["Grounded response<br/>[response.py]"]
end

subgraph group_operations["Emergency operations"]
  node_emergencyapi["Emergency API<br/>[emergency.py]"]
  node_sachet["Alert synchronizer<br/>[sachet.py]"]
end

subgraph group_persistence["Persistence"]
  node_chromadb[("Chroma vector store")]
  node_models["Persistence models"]
end

node_citizen(("Citizen"))
node_volunteer(("Volunteer"))
node_sachetservice{{"SACHET feeds"}}
node_gemini{{"Gemini API"}}
node_db[("PostgreSQL")]
node_routing{{"Map routing service"}}

node_citizen -->|"uses"| node_app
node_volunteer -->|"uses"| node_app
node_app -->|"renders"| node_authui
node_authui -->|"registers or signs in"| node_authapi
node_authapi -->|"reads and writes"| node_db
node_app -->|"checks session"| node_authapi
node_app -->|"prompts when needed"| node_stateui
node_stateui -->|"updates state"| node_authapi
node_app -->|"opens dashboard"| node_dashboard
node_dashboard -->|"requests guidance"| node_chatapi
node_chatapi -->|"routes query"| node_orchestrator
node_orchestrator -->|"retrieves policy"| node_retrieval
node_orchestrator -->|"assesses risk"| node_risk
node_chatapi -->|"scores confidence"| node_uncertainty
node_chatapi -->|"builds answer"| node_response
node_retrieval -->|"searches chunks"| node_chromadb
node_response -.->|"generates answer"| node_gemini
node_dashboard -->|"loads alerts and services"| node_emergencyapi
node_dashboard -->|"submits SOS"| node_emergencyapi
node_volunteerqueue -->|"claims or resolves SOS"| node_emergencyapi
node_incidentmap -->|"polls incident location"| node_emergencyapi
node_incidentmap -.->|"requests route"| node_routing
node_dashboard -->|"updates SOS location"| node_emergencyapi
node_volunteerprofileui -->|"reads and updates profile"| node_authapi
node_emergencyapi -->|"reads and writes operations"| node_db
node_sachet -->|"fetches RSS and CAP"| node_sachetservice
node_sachet -->|"caches and stores events"| node_db
node_emergencyapi -->|"uses records"| node_models
node_sachet -->|"uses alert records"| node_models
node_authapi -->|"uses user records"| node_models

click node_app "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/App.jsx"
click node_authui "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/auth.jsx"
click node_dashboard "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/guidelines.jsx"
click node_stateui "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/StateRequired.jsx"
click node_incidentmap "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/LiveIncidentMap.jsx"
click node_volunteerqueue "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/VolunteerQueue.jsx"
click node_volunteerprofileui "https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/VolunteerProfile.jsx"
click node_authapi "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/auth.py"
click node_chatapi "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/chat.py"
click node_orchestrator "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/orchestrator.py"
click node_retrieval "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/retrieval.py"
click node_risk "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/risk_agent.py"
click node_uncertainty "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/uncertainty.py"
click node_response "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/response.py"
click node_emergencyapi "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/emergency.py"
click node_sachet "https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/services/sachet.py"
click node_chromadb "https://github.com/dshri2005/rescuenetai_major_project/tree/master/backend/vector_store/chroma_db"
click node_models "https://github.com/dshri2005/rescuenetai_major_project/tree/master/backend/app/models"

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_authui,node_dashboard,node_stateui,node_incidentmap,node_volunteerqueue,node_volunteerprofileui toneBlue
class node_authapi,node_db toneAmber
class node_chatapi,node_orchestrator,node_retrieval,node_risk,node_uncertainty,node_response,node_gemini toneMint
class node_emergencyapi,node_sachet toneRose
class node_chromadb,node_models,node_citizen,node_volunteer,node_sachetservice,node_routing toneIndigo
```

## Components

### Web experience

- [Session shell](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in forms](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/auth.jsx): `frontend/src/components/auth.jsx`
- [Guidance dashboard](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/guidelines.jsx): `frontend/src/guidelines.jsx`
- [State selection](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/StateRequired.jsx): `frontend/src/components/StateRequired.jsx`
- [Incident map](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/LiveIncidentMap.jsx): `frontend/src/components/LiveIncidentMap.jsx`
- [Volunteer queue](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/VolunteerQueue.jsx): `frontend/src/components/VolunteerQueue.jsx`
- [Volunteer profile](https://github.com/dshri2005/rescuenetai_major_project/blob/master/frontend/src/components/VolunteerProfile.jsx): `frontend/src/components/VolunteerProfile.jsx`

### Identity and profiles

- [Authentication API](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/auth.py): `backend/app/api/auth.py`

### Disaster assistant

- [Chat API](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Query routing](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/orchestrator.py): `backend/app/agents/orchestrator.py`
- [Policy retrieval](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/retrieval.py): `backend/app/agents/retrieval.py`
- [Risk assessment](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/risk_agent.py): `backend/app/agents/risk_agent.py`
- [Confidence scoring](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/uncertainty.py): `backend/app/agents/uncertainty.py`
- [Grounded response](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/agents/response.py): `backend/app/agents/response.py`

### Emergency operations

- [Emergency API](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/api/emergency.py): `backend/app/api/emergency.py`
- [Alert synchronizer](https://github.com/dshri2005/rescuenetai_major_project/blob/master/backend/app/services/sachet.py): `backend/app/services/sachet.py`

### Persistence

- [Chroma vector store](https://github.com/dshri2005/rescuenetai_major_project/tree/master/backend/vector_store/chroma_db): `backend/vector_store/chroma_db`
- [Persistence models](https://github.com/dshri2005/rescuenetai_major_project/tree/master/backend/app/models): `backend/app/models`

### Other components

- **Citizen**
- **Volunteer**
- **SACHET feeds**
- **Gemini API**
- **PostgreSQL**
- **Map routing service**

## Connections

- Citizen → Session shell: uses
- Volunteer → Session shell: uses
- Session shell → Sign-in forms: renders
- Sign-in forms → Authentication API: registers or signs in
- Authentication API → PostgreSQL: reads and writes
- Session shell → Authentication API: checks session
- Session shell → State selection: prompts when needed
- State selection → Authentication API: updates state
- Session shell → Guidance dashboard: opens dashboard
- Guidance dashboard → Chat API: requests guidance
- Chat API → Query routing: routes query
- Query routing → Policy retrieval: retrieves policy
- Query routing → Risk assessment: assesses risk
- Chat API → Confidence scoring: scores confidence
- Chat API → Grounded response: builds answer
- Policy retrieval → Chroma vector store: searches chunks
- Grounded response → Gemini API: generates answer
- Guidance dashboard → Emergency API: loads alerts and services
- Guidance dashboard → Emergency API: submits SOS
- Volunteer queue → Emergency API: claims or resolves SOS
- Incident map → Emergency API: polls incident location
- Incident map → Map routing service: requests route
- Guidance dashboard → Emergency API: updates SOS location
- Volunteer profile → Authentication API: reads and updates profile
- Emergency API → PostgreSQL: reads and writes operations
- Alert synchronizer → SACHET feeds: fetches RSS and CAP
- Alert synchronizer → PostgreSQL: caches and stores events
- Emergency API → Persistence models: uses records
- Alert synchronizer → Persistence models: uses alert records
- Authentication API → Persistence models: uses user records
