# sudhir61127/vigilor architecture

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

- Interactive diagram: https://gitdiagram.com/sudhir61127/vigilor
- Repository: https://github.com/sudhir61127/vigilor

## Overview

VIGIL-OR is a clinical decision-support dashboard. The main workflow is a clinician using a dashboard view or assistant (optionally with voice) to submit a request; the FastAPI agent routes it to patient, report, monitoring, or checklist functionality and returns a response. Monitoring is also fetched directly by the dashboard. The README documents MongoDB patient records and RAG report retrieval; sampled source shows the RAG build and search stages, but not how patient tools reach the repository. The AI agent is described as under development.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/App.jsx) (Dashboard App), [`backend/app/graph/workflow.py`](https://github.com/sudhir61127/vigilor/blob/main/backend/app/graph/workflow.py) (Agent Workflow), [`backend/app/api/routes.py`](https://github.com/sudhir61127/vigilor/blob/main/backend/app/api/routes.py) (FastAPI Routes), [`backend/app/rag/rag_pipeline.py`](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/rag_pipeline.py) (RAG Index Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Clinician Dashboard"]
  node_app["Dashboard App<br/>[App.jsx]"]
  node_voice["Voice And API Hooks<br/>[useVoice.js]"]
  node_overview["Overview View<br/>[OverviewView.jsx]"]
  node_patientview["Patient View<br/>[PatientView.jsx]"]
  node_reportsview["Reports View<br/>[ReportsView.jsx]"]
  node_monitorview["Monitor View<br/>[MonitorView.jsx]"]
  node_checklistview["Checklist View<br/>[ChecklistView.jsx]"]
  node_assistantview["Assistant View<br/>[AssistantView.jsx]"]
end

subgraph group_api["API And Agent"]
  node_api["FastAPI Routes<br/>[routes.py]"]
  node_workflow["Agent Workflow<br/>[workflow.py]"]
  node_main["Application Setup<br/>[main.py]"]
end

subgraph group_clinical["Clinical Capabilities"]
  node_patienttool["Patient Lookup<br/>[patient_tool.py]"]
  node_checklist["Surgical Checklist<br/>[checklist_tool.py]"]
  node_monitortool["Monitor Tool<br/>[monitor_tool.py]"]
  node_monitor["Simulated OR Monitor<br/>[monitor.py]"]
end

subgraph group_patientdata["Patient Data"]
  node_patientrepo["Patient Repository"]
  node_profile["Profile Repository"]
  node_mongo[("MongoDB")]
end

subgraph group_rag["Report Retrieval"]
  node_ragtool["Report Search Tool<br/>[rag_tool.py]"]
  node_retriever["Document Retriever<br/>[retriever.py]"]
  node_embeddings["Embedding Model<br/>[embeddings.py]"]
  node_vectorstore[("FAISS Index<br/>[vector_store.py]")]
  node_ragbuild["RAG Index Builder<br/>[rag_pipeline.py]"]
  node_loader["Report Loader<br/>[loader.py]"]
  node_chunker["Document Chunker<br/>[chunker.py]"]
end

node_clinician(("Clinician"))

node_clinician -->|"uses"| node_app
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_patientview
node_app -->|"renders"| node_reportsview
node_app -->|"renders"| node_monitorview
node_app -->|"renders"| node_checklistview
node_app -->|"renders"| node_assistantview
node_app -->|"uses hooks"| node_voice
node_voice -->|"posts agent input"| node_api
node_voice -->|"fetches vitals"| node_api
node_main -->|"mounts routes"| node_api
node_main -->|"initializes connection"| node_mongo
node_api -->|"runs agent"| node_workflow
node_api -->|"gets vitals"| node_monitor
node_workflow -->|"calls"| node_patienttool
node_workflow -->|"calls"| node_ragtool
node_workflow -->|"calls"| node_checklist
node_workflow -->|"calls"| node_monitortool
node_patientrepo -.->|"uses connection"| node_mongo
node_profile -.->|"uses connection"| node_mongo
node_patienttool -.->|"accesses records"| node_patientrepo
node_monitortool -->|"uses monitor"| node_monitor
node_ragtool -->|"searches documents"| node_retriever
node_retriever -->|"embeds query"| node_embeddings
node_retriever -->|"loads index"| node_vectorstore
node_ragbuild -->|"loads reports"| node_loader
node_ragbuild -->|"splits reports"| node_chunker
node_ragbuild -->|"embeds chunks"| node_embeddings
node_ragbuild -->|"builds index"| node_vectorstore

click node_app "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/App.jsx"
click node_voice "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/hooks/useVoice.js"
click node_overview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/OverviewView.jsx"
click node_patientview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/PatientView.jsx"
click node_reportsview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/ReportsView.jsx"
click node_monitorview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/MonitorView.jsx"
click node_checklistview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/ChecklistView.jsx"
click node_assistantview "https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/AssistantView.jsx"
click node_api "https://github.com/sudhir61127/vigilor/blob/main/backend/app/api/routes.py"
click node_workflow "https://github.com/sudhir61127/vigilor/blob/main/backend/app/graph/workflow.py"
click node_main "https://github.com/sudhir61127/vigilor/blob/main/backend/app/main.py"
click node_patienttool "https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/patient_tool.py"
click node_checklist "https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/checklist_tool.py"
click node_monitortool "https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/monitor_tool.py"
click node_monitor "https://github.com/sudhir61127/vigilor/blob/main/backend/app/monitor/monitor.py"
click node_patientrepo "https://github.com/sudhir61127/vigilor/blob/main/backend/app/database/patient_repository.py"
click node_profile "https://github.com/sudhir61127/vigilor/blob/main/backend/app/database/profile_repository.py"
click node_ragtool "https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/rag_tool.py"
click node_retriever "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/retriever.py"
click node_embeddings "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/embeddings.py"
click node_vectorstore "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/vector_store.py"
click node_ragbuild "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/rag_pipeline.py"
click node_loader "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/loader.py"
click node_chunker "https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/chunker.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_voice,node_overview,node_patientview,node_reportsview,node_monitorview,node_checklistview,node_assistantview toneBlue
class node_api,node_workflow,node_main toneAmber
class node_patienttool,node_checklist,node_monitortool,node_monitor toneMint
class node_patientrepo,node_profile,node_mongo toneRose
class node_ragtool,node_retriever,node_embeddings,node_vectorstore,node_ragbuild,node_loader,node_chunker,node_clinician toneIndigo
```

## Components

### Clinician Dashboard

- [Dashboard App](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Voice And API Hooks](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/hooks/useVoice.js): `frontend/src/hooks/useVoice.js`
- [Overview View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/OverviewView.jsx): `frontend/src/pages/OverviewView.jsx`
- [Patient View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/PatientView.jsx): `frontend/src/pages/PatientView.jsx`
- [Reports View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/ReportsView.jsx): `frontend/src/pages/ReportsView.jsx`
- [Monitor View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/MonitorView.jsx): `frontend/src/pages/MonitorView.jsx`
- [Checklist View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/ChecklistView.jsx): `frontend/src/pages/ChecklistView.jsx`
- [Assistant View](https://github.com/sudhir61127/vigilor/blob/main/frontend/src/pages/AssistantView.jsx): `frontend/src/pages/AssistantView.jsx`

### API And Agent

- [FastAPI Routes](https://github.com/sudhir61127/vigilor/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Agent Workflow](https://github.com/sudhir61127/vigilor/blob/main/backend/app/graph/workflow.py): `backend/app/graph/workflow.py`
- [Application Setup](https://github.com/sudhir61127/vigilor/blob/main/backend/app/main.py): `backend/app/main.py`

### Clinical Capabilities

- [Patient Lookup](https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/patient_tool.py): `backend/app/tools/patient_tool.py`
- [Surgical Checklist](https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/checklist_tool.py): `backend/app/tools/checklist_tool.py`
- [Monitor Tool](https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/monitor_tool.py): `backend/app/tools/monitor_tool.py`
- [Simulated OR Monitor](https://github.com/sudhir61127/vigilor/blob/main/backend/app/monitor/monitor.py): `backend/app/monitor/monitor.py`

### Patient Data

- [Patient Repository](https://github.com/sudhir61127/vigilor/blob/main/backend/app/database/patient_repository.py): `backend/app/database/patient_repository.py`
- [Profile Repository](https://github.com/sudhir61127/vigilor/blob/main/backend/app/database/profile_repository.py): `backend/app/database/profile_repository.py`
- **MongoDB**

### Report Retrieval

- [Report Search Tool](https://github.com/sudhir61127/vigilor/blob/main/backend/app/tools/rag_tool.py): `backend/app/tools/rag_tool.py`
- [Document Retriever](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`
- [Embedding Model](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/embeddings.py): `backend/app/rag/embeddings.py`
- [FAISS Index](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/vector_store.py): `backend/app/rag/vector_store.py`
- [RAG Index Builder](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/rag_pipeline.py): `backend/app/rag/rag_pipeline.py`
- [Report Loader](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/loader.py): `backend/app/rag/loader.py`
- [Document Chunker](https://github.com/sudhir61127/vigilor/blob/main/backend/app/rag/chunker.py): `backend/app/rag/chunker.py`

### Other components

- **Clinician**

## Connections

- Clinician → Dashboard App: uses (evidence: `frontend/src/App.jsx`)
- Dashboard App → Overview View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Patient View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Reports View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Monitor View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Checklist View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Assistant View: renders (evidence: `frontend/src/App.jsx`)
- Dashboard App → Voice And API Hooks: uses hooks (evidence: `frontend/src/App.jsx`)
- Voice And API Hooks → FastAPI Routes: posts agent input (evidence: `frontend/src/hooks/useVoice.js`)
- Voice And API Hooks → FastAPI Routes: fetches vitals (evidence: `frontend/src/hooks/useVoice.js`)
- Application Setup → FastAPI Routes: mounts routes (evidence: `backend/app/main.py`)
- Application Setup → MongoDB: initializes connection (evidence: `backend/app/main.py`)
- FastAPI Routes → Agent Workflow: runs agent (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Simulated OR Monitor: gets vitals (evidence: `backend/app/api/routes.py`)
- Agent Workflow → Patient Lookup: calls (evidence: `backend/app/graph/workflow.py`)
- Agent Workflow → Report Search Tool: calls (evidence: `backend/app/graph/workflow.py`)
- Agent Workflow → Surgical Checklist: calls (evidence: `backend/app/graph/workflow.py`)
- Agent Workflow → Monitor Tool: calls (evidence: `backend/app/graph/workflow.py`)
- Patient Repository → MongoDB: uses connection (evidence: `backend/app/database/patient_repository.py`)
- Profile Repository → MongoDB: uses connection (evidence: `backend/app/database/profile_repository.py`)
- Patient Lookup → Patient Repository: accesses records
- Monitor Tool → Simulated OR Monitor: uses monitor (evidence: `backend/app/tools/monitor_tool.py`)
- Report Search Tool → Document Retriever: searches documents (evidence: `backend/app/tools/rag_tool.py`)
- Document Retriever → Embedding Model: embeds query (evidence: `backend/app/rag/retriever.py`)
- Document Retriever → FAISS Index: loads index (evidence: `backend/app/rag/retriever.py`)
- RAG Index Builder → Report Loader: loads reports (evidence: `backend/app/rag/rag_pipeline.py`)
- RAG Index Builder → Document Chunker: splits reports (evidence: `backend/app/rag/rag_pipeline.py`)
- RAG Index Builder → Embedding Model: embeds chunks (evidence: `backend/app/rag/rag_pipeline.py`)
- RAG Index Builder → FAISS Index: builds index (evidence: `backend/app/rag/rag_pipeline.py`)
