# sandrapple-code/veraops architecture

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

- Interactive diagram: https://gitdiagram.com/sandrapple-code/veraops
- Repository: https://github.com/sandrapple-code/veraops

## Overview

VeraOps is a Streamlit hospital information system with an agentic clinical assistant. Clinicians use the app to manage patient records and hospital operations, or ask questions; the agent selects tools, gathers hospital or patient context, and returns a grounded response. The repository also maintains separate hospital and patient retrieval stores. The README documents major UI capabilities, while source excerpts and the index expose only part of their implementation, so some product-level links rely on README evidence.

Main entry points: [`agents/nodes.py`](https://github.com/sandrapple-code/veraops/blob/main/agents/nodes.py) (Agent Nodes), [`app.py`](https://github.com/sandrapple-code/veraops/blob/main/app.py) (Streamlit App), [`rag/ingestion.py`](https://github.com/sandrapple-code/veraops/blob/main/rag/ingestion.py) (Document Ingestion), [`db/sqlite.py`](https://github.com/sandrapple-code/veraops/blob/main/db/sqlite.py) (Hospital Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui_ops["Hospital Workspace"]
  node_app["Streamlit App<br/>[app.py]"]
  node_bed_tool["Bed Availability"]
end

subgraph group_agent["Agent Workflow"]
  node_agent_graph{{"Agent Graph<br/>[graph.py]"}}
  node_agent_router["Query Router<br/>[router.py]"]
  node_agent_nodes["Agent Nodes<br/>[nodes.py]"]
end

subgraph group_rag["Knowledge Retrieval"]
  node_similar_case["Similar Cases<br/>[similar_case.py]"]
  node_hospital_tool["Hospital Knowledge"]
  node_ingestion["Document Ingestion<br/>[ingestion.py]"]
  node_embeddings["Embedding Model<br/>[embeddings.py]"]
  node_doc_store[("Hospital Vector Store<br/>[document_store.py]")]
  node_patient_store[("Patient Vector Store<br/>[patient_store.py]")]
  node_rag_pipeline["RAG Pipeline<br/>[rag_pipeline.py]"]
  node_hospital_docs["Hospital Documents"]
end

subgraph group_records["Patient Records"]
  node_patient_service["Patient Service<br/>[patient_service.py]"]
  node_sqlite[("Hospital Database<br/>[sqlite.py]")]
  node_update_tool["Record Updates<br/>[update_patient.py]"]
  node_register_tool["Patient Registration"]
  node_patient_lookup["Patient Lookup<br/>[patient_lookup.py]"]
  node_patient_history["Patient History<br/>[patient_history.py]"]
  node_patient_docs["Patient Documents"]
end

subgraph group_integrations["External Services"]
  node_groq_client["Groq Client<br/>[groq_client.py]"]
  node_groq{{"Groq API"}}
end

node_user(("Clinician"))

node_user -->|"uses"| node_app
node_app -->|"reads and writes"| node_sqlite
node_app -->|"manages records"| node_patient_service
node_app -->|"submits queries"| node_agent_graph
node_app -->|"shows bed status"| node_bed_tool
node_patient_service -->|"persists patients"| node_sqlite
node_patient_service -->|"indexes changes"| node_ingestion
node_register_tool -->|"registers patient"| node_patient_service
node_update_tool -->|"updates records"| node_sqlite
node_update_tool -->|"indexes updates"| node_ingestion
node_bed_tool -->|"checks availability"| node_sqlite
node_agent_graph -->|"dispatches queries"| node_agent_router
node_agent_graph -->|"runs nodes"| node_agent_nodes
node_agent_nodes -->|"invokes tool"| node_patient_lookup
node_agent_nodes -->|"invokes tool"| node_patient_history
node_agent_nodes -->|"invokes tool"| node_similar_case
node_agent_nodes -->|"invokes tool"| node_hospital_tool
node_agent_nodes -->|"invokes tool"| node_update_tool
node_agent_nodes -->|"invokes tool"| node_register_tool
node_patient_lookup -->|"looks up patients"| node_sqlite
node_patient_history -->|"retrieves history"| node_patient_store
node_similar_case -->|"searches cases"| node_patient_store
node_similar_case -->|"gets patient details"| node_sqlite
node_hospital_tool -->|"searches knowledge"| node_doc_store
node_ingestion -->|"indexes documents"| node_hospital_docs
node_ingestion -->|"indexes documents"| node_patient_docs
node_ingestion -->|"builds index"| node_doc_store
node_ingestion -->|"builds index"| node_patient_store
node_doc_store -->|"embeds chunks"| node_embeddings
node_patient_store -->|"embeds patients"| node_embeddings
node_rag_pipeline -->|"generates answers"| node_groq_client
node_agent_router -->|"classifies queries"| node_groq_client
node_agent_nodes -->|"generates response"| node_groq_client
node_groq_client -->|"calls model"| node_groq
node_app -->|"supports workspace"| node_patient_docs

click node_app "https://github.com/sandrapple-code/veraops/blob/main/app.py"
click node_patient_service "https://github.com/sandrapple-code/veraops/blob/main/services/patient_service.py"
click node_sqlite "https://github.com/sandrapple-code/veraops/blob/main/db/sqlite.py"
click node_bed_tool "https://github.com/sandrapple-code/veraops/blob/main/tools/bed_availability.py"
click node_update_tool "https://github.com/sandrapple-code/veraops/blob/main/tools/update_patient.py"
click node_register_tool "https://github.com/sandrapple-code/veraops/blob/main/tools/register_patient.py"
click node_agent_graph "https://github.com/sandrapple-code/veraops/blob/main/agents/graph.py"
click node_agent_router "https://github.com/sandrapple-code/veraops/blob/main/agents/router.py"
click node_agent_nodes "https://github.com/sandrapple-code/veraops/blob/main/agents/nodes.py"
click node_patient_lookup "https://github.com/sandrapple-code/veraops/blob/main/tools/patient_lookup.py"
click node_patient_history "https://github.com/sandrapple-code/veraops/blob/main/tools/patient_history.py"
click node_similar_case "https://github.com/sandrapple-code/veraops/blob/main/tools/similar_case.py"
click node_hospital_tool "https://github.com/sandrapple-code/veraops/blob/main/tools/hospital_knowledge.py"
click node_ingestion "https://github.com/sandrapple-code/veraops/blob/main/rag/ingestion.py"
click node_embeddings "https://github.com/sandrapple-code/veraops/blob/main/rag/embeddings.py"
click node_doc_store "https://github.com/sandrapple-code/veraops/blob/main/rag/document_store.py"
click node_patient_store "https://github.com/sandrapple-code/veraops/blob/main/rag/patient_store.py"
click node_rag_pipeline "https://github.com/sandrapple-code/veraops/blob/main/rag/rag_pipeline.py"
click node_groq_client "https://github.com/sandrapple-code/veraops/blob/main/llm/groq_client.py"
click node_hospital_docs "https://github.com/sandrapple-code/veraops/tree/main/hospital_docs"
click node_patient_docs "https://github.com/sandrapple-code/veraops/tree/main/patient_documents"

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_bed_tool toneBlue
class node_agent_graph,node_agent_router,node_agent_nodes toneAmber
class node_similar_case,node_hospital_tool,node_ingestion,node_embeddings,node_doc_store,node_patient_store,node_rag_pipeline,node_hospital_docs toneMint
class node_patient_service,node_sqlite,node_update_tool,node_register_tool,node_patient_lookup,node_patient_history,node_patient_docs toneRose
class node_groq_client,node_groq,node_user toneIndigo
```

## Components

### Hospital Workspace

- [Streamlit App](https://github.com/sandrapple-code/veraops/blob/main/app.py): `app.py`
- [Bed Availability](https://github.com/sandrapple-code/veraops/blob/main/tools/bed_availability.py): `tools/bed_availability.py`

### Agent Workflow

- [Agent Graph](https://github.com/sandrapple-code/veraops/blob/main/agents/graph.py): `agents/graph.py`
- [Query Router](https://github.com/sandrapple-code/veraops/blob/main/agents/router.py): `agents/router.py`
- [Agent Nodes](https://github.com/sandrapple-code/veraops/blob/main/agents/nodes.py): `agents/nodes.py`

### Knowledge Retrieval

- [Similar Cases](https://github.com/sandrapple-code/veraops/blob/main/tools/similar_case.py): `tools/similar_case.py`
- [Hospital Knowledge](https://github.com/sandrapple-code/veraops/blob/main/tools/hospital_knowledge.py): `tools/hospital_knowledge.py`
- [Document Ingestion](https://github.com/sandrapple-code/veraops/blob/main/rag/ingestion.py): `rag/ingestion.py`
- [Embedding Model](https://github.com/sandrapple-code/veraops/blob/main/rag/embeddings.py): `rag/embeddings.py`
- [Hospital Vector Store](https://github.com/sandrapple-code/veraops/blob/main/rag/document_store.py): `rag/document_store.py`
- [Patient Vector Store](https://github.com/sandrapple-code/veraops/blob/main/rag/patient_store.py): `rag/patient_store.py`
- [RAG Pipeline](https://github.com/sandrapple-code/veraops/blob/main/rag/rag_pipeline.py): `rag/rag_pipeline.py`
- [Hospital Documents](https://github.com/sandrapple-code/veraops/tree/main/hospital_docs): `hospital_docs`

### Patient Records

- [Patient Service](https://github.com/sandrapple-code/veraops/blob/main/services/patient_service.py): `services/patient_service.py`
- [Hospital Database](https://github.com/sandrapple-code/veraops/blob/main/db/sqlite.py): `db/sqlite.py`
- [Record Updates](https://github.com/sandrapple-code/veraops/blob/main/tools/update_patient.py): `tools/update_patient.py`
- [Patient Registration](https://github.com/sandrapple-code/veraops/blob/main/tools/register_patient.py): `tools/register_patient.py`
- [Patient Lookup](https://github.com/sandrapple-code/veraops/blob/main/tools/patient_lookup.py): `tools/patient_lookup.py`
- [Patient History](https://github.com/sandrapple-code/veraops/blob/main/tools/patient_history.py): `tools/patient_history.py`
- [Patient Documents](https://github.com/sandrapple-code/veraops/tree/main/patient_documents): `patient_documents`

### External Services

- [Groq Client](https://github.com/sandrapple-code/veraops/blob/main/llm/groq_client.py): `llm/groq_client.py`
- **Groq API**

### Other components

- **Clinician**

## Connections

- Clinician → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → Hospital Database: reads and writes (evidence: `app.py`)
- Streamlit App → Patient Service: manages records (evidence: `README.md`)
- Streamlit App → Agent Graph: submits queries (evidence: `app.py`)
- Streamlit App → Bed Availability: shows bed status (evidence: `app.py`)
- Patient Service → Hospital Database: persists patients (evidence: `services/patient_service.py`)
- Patient Service → Document Ingestion: indexes changes (evidence: `services/patient_service.py`)
- Patient Registration → Patient Service: registers patient (evidence: `tools/register_patient.py`)
- Record Updates → Hospital Database: updates records (evidence: `tools/update_patient.py`)
- Record Updates → Document Ingestion: indexes updates (evidence: `tools/update_patient.py`)
- Bed Availability → Hospital Database: checks availability (evidence: `tools/bed_availability.py`)
- Agent Graph → Query Router: dispatches queries (evidence: `agents/graph.py`)
- Agent Graph → Agent Nodes: runs nodes (evidence: `agents/graph.py`)
- Agent Nodes → Patient Lookup: invokes tool (evidence: `agents/nodes.py`)
- Agent Nodes → Patient History: invokes tool (evidence: `agents/nodes.py`)
- Agent Nodes → Similar Cases: invokes tool (evidence: `agents/nodes.py`)
- Agent Nodes → Hospital Knowledge: invokes tool (evidence: `agents/nodes.py`)
- Agent Nodes → Record Updates: invokes tool (evidence: `agents/nodes.py`)
- Agent Nodes → Patient Registration: invokes tool (evidence: `agents/nodes.py`)
- Patient Lookup → Hospital Database: looks up patients (evidence: `tools/patient_lookup.py`)
- Patient History → Patient Vector Store: retrieves history (evidence: `tools/patient_history.py`)
- Similar Cases → Patient Vector Store: searches cases (evidence: `tools/similar_case.py`)
- Similar Cases → Hospital Database: gets patient details (evidence: `tools/similar_case.py`)
- Hospital Knowledge → Hospital Vector Store: searches knowledge (evidence: `tools/hospital_knowledge.py`)
- Document Ingestion → Hospital Documents: indexes documents (evidence: `README.md`)
- Document Ingestion → Patient Documents: indexes documents (evidence: `README.md`)
- Document Ingestion → Hospital Vector Store: builds index (evidence: `rag/ingestion.py`)
- Document Ingestion → Patient Vector Store: builds index (evidence: `rag/ingestion.py`)
- Hospital Vector Store → Embedding Model: embeds chunks (evidence: `rag/document_store.py`)
- Patient Vector Store → Embedding Model: embeds patients (evidence: `rag/patient_store.py`)
- RAG Pipeline → Groq Client: generates answers (evidence: `rag/rag_pipeline.py`)
- Query Router → Groq Client: classifies queries (evidence: `agents/router.py`)
- Agent Nodes → Groq Client: generates response (evidence: `agents/nodes.py`)
- Groq Client → Groq API: calls model (evidence: `llm/groq_client.py`)
- Streamlit App → Patient Documents: supports workspace (evidence: `README.md`)
