# maheeth07/carevault architecture

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

- Interactive diagram: https://gitdiagram.com/maheeth07/carevault
- Repository: https://github.com/maheeth07/carevault

## Overview

CareVault is a FastAPI backend for patient and doctor accounts, appointment scheduling, consultations, and transcript storage, with a separate transcript-ingestion/embedding area. The main workflow is HTTP route → controller → MongoDB; appointments are validated and scheduled before a consultation can be recorded, and transcripts can be attached to consultations. The excerpts do not show all route wiring or the agent pipeline, so those links are omitted where unverified.

Main entry points: [`backend/app.py`](https://github.com/maheeth07/carevault/blob/main/backend/app.py) (FastAPI app), [`backend/db/mng.py`](https://github.com/maheeth07/carevault/blob/main/backend/db/mng.py) (Mongo access), [`backend/models`](https://github.com/maheeth07/carevault/tree/main/backend/models) (Domain models), [`backend/controllers/patient_controller.py`](https://github.com/maheeth07/carevault/blob/main/backend/controllers/patient_controller.py) (Patient accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Surface"]
  node_app["FastAPI app<br/>[app.py]"]
  node_appointment_routes["Appointment routes"]
  node_consultation_routes["Consultation routes"]
  node_patient_routes["Patient routes<br/>[patient_routes.py]"]
  node_doctor_routes["Doctor routes<br/>[doctor_routes.py]"]
  node_tenure_routes["Tenure routes<br/>[tenure_routes.py]"]
  node_transcript_routes["Transcript routes"]
end

subgraph group_domain["Care Workflows"]
  node_appointment["Appointment workflow"]
  node_consultation["Consultation workflow"]
  node_patient["Patient accounts"]
  node_doctor["Doctor accounts"]
  node_tenure["Tenure workflow"]
  node_transcript["Transcript storage"]
  node_auth["Token utility<br/>[auth.py]"]
end

subgraph group_data["Persistence and Models"]
  node_models["Domain models"]
  node_mongo[("Mongo access<br/>[mng.py]")]
end

subgraph group_agent["Transcript Agent"]
  node_embedder["Text embedder<br/>[embedder.py]"]
  node_chunker["Transcript chunker<br/>[chunker.py]"]
  node_vectorstore[("Vector store<br/>[mongo_vector.py]")]
end

node_client(("API client"))
node_mongodb[("MongoDB")]

node_client -->|"sends requests"| node_app
node_app -->|"registers"| node_appointment_routes
node_app -->|"registers"| node_consultation_routes
node_app -->|"registers"| node_patient_routes
node_app -->|"registers"| node_doctor_routes
node_app -->|"registers"| node_tenure_routes
node_appointment_routes -->|"calls"| node_appointment
node_consultation_routes -->|"calls"| node_consultation
node_patient_routes -->|"calls"| node_patient
node_transcript_routes -->|"routes to"| node_transcript
node_appointment -->|"reads and writes"| node_mongo
node_consultation -->|"reads and writes"| node_mongo
node_patient -->|"reads and writes"| node_mongo
node_doctor -->|"reads and writes"| node_mongo
node_tenure -->|"reads and writes"| node_mongo
node_transcript -->|"updates consultation"| node_mongo
node_appointment -->|"uses schema"| node_models
node_consultation -->|"uses schema"| node_models
node_patient -->|"uses schema"| node_models
node_doctor -->|"uses schema"| node_models
node_transcript -->|"uses schema"| node_models
node_patient -->|"creates token"| node_auth
node_doctor -->|"creates token"| node_auth
node_mongo -->|"connects to"| node_mongodb
node_app -->|"creates indexes"| node_mongo

click node_app "https://github.com/maheeth07/carevault/blob/main/backend/app.py"
click node_appointment_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/appointment_routes.py"
click node_consultation_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/consultation_routes.py"
click node_patient_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/patient_routes.py"
click node_doctor_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/doctor_routes.py"
click node_tenure_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/tenure_routes.py"
click node_transcript_routes "https://github.com/maheeth07/carevault/blob/main/backend/routes/transcript_routes.py"
click node_appointment "https://github.com/maheeth07/carevault/blob/main/backend/controllers/appointment_controller.py"
click node_consultation "https://github.com/maheeth07/carevault/blob/main/backend/controllers/consultation_controller.py"
click node_patient "https://github.com/maheeth07/carevault/blob/main/backend/controllers/patient_controller.py"
click node_doctor "https://github.com/maheeth07/carevault/blob/main/backend/controllers/doctor_controller.py"
click node_tenure "https://github.com/maheeth07/carevault/blob/main/backend/controllers/tenure_controller.py"
click node_transcript "https://github.com/maheeth07/carevault/blob/main/backend/controllers/transcript_controller.py"
click node_auth "https://github.com/maheeth07/carevault/blob/main/backend/utils/auth.py"
click node_models "https://github.com/maheeth07/carevault/tree/main/backend/models"
click node_mongo "https://github.com/maheeth07/carevault/blob/main/backend/db/mng.py"
click node_embedder "https://github.com/maheeth07/carevault/blob/main/backend/agent/embeddings/embedder.py"
click node_chunker "https://github.com/maheeth07/carevault/blob/main/backend/agent/ingestion/chunker.py"
click node_vectorstore "https://github.com/maheeth07/carevault/blob/main/backend/agent/vectorstore/mongo_vector.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_appointment_routes,node_consultation_routes,node_patient_routes,node_doctor_routes,node_tenure_routes,node_transcript_routes,node_client toneBlue
class node_appointment,node_consultation,node_patient,node_doctor,node_tenure,node_transcript,node_auth,node_mongodb toneAmber
class node_models,node_mongo toneMint
class node_embedder,node_chunker,node_vectorstore toneRose
```

## Components

### API Surface

- [FastAPI app](https://github.com/maheeth07/carevault/blob/main/backend/app.py): `backend/app.py`
- [Appointment routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/appointment_routes.py): `backend/routes/appointment_routes.py`
- [Consultation routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/consultation_routes.py): `backend/routes/consultation_routes.py`
- [Patient routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/patient_routes.py): `backend/routes/patient_routes.py`
- [Doctor routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/doctor_routes.py): `backend/routes/doctor_routes.py`
- [Tenure routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/tenure_routes.py): `backend/routes/tenure_routes.py`
- [Transcript routes](https://github.com/maheeth07/carevault/blob/main/backend/routes/transcript_routes.py): `backend/routes/transcript_routes.py`

### Care Workflows

- [Appointment workflow](https://github.com/maheeth07/carevault/blob/main/backend/controllers/appointment_controller.py): `backend/controllers/appointment_controller.py`
- [Consultation workflow](https://github.com/maheeth07/carevault/blob/main/backend/controllers/consultation_controller.py): `backend/controllers/consultation_controller.py`
- [Patient accounts](https://github.com/maheeth07/carevault/blob/main/backend/controllers/patient_controller.py): `backend/controllers/patient_controller.py`
- [Doctor accounts](https://github.com/maheeth07/carevault/blob/main/backend/controllers/doctor_controller.py): `backend/controllers/doctor_controller.py`
- [Tenure workflow](https://github.com/maheeth07/carevault/blob/main/backend/controllers/tenure_controller.py): `backend/controllers/tenure_controller.py`
- [Transcript storage](https://github.com/maheeth07/carevault/blob/main/backend/controllers/transcript_controller.py): `backend/controllers/transcript_controller.py`
- [Token utility](https://github.com/maheeth07/carevault/blob/main/backend/utils/auth.py): `backend/utils/auth.py`

### Persistence and Models

- [Domain models](https://github.com/maheeth07/carevault/tree/main/backend/models): `backend/models`
- [Mongo access](https://github.com/maheeth07/carevault/blob/main/backend/db/mng.py): `backend/db/mng.py`

### Transcript Agent

- [Text embedder](https://github.com/maheeth07/carevault/blob/main/backend/agent/embeddings/embedder.py): `backend/agent/embeddings/embedder.py`
- [Transcript chunker](https://github.com/maheeth07/carevault/blob/main/backend/agent/ingestion/chunker.py): `backend/agent/ingestion/chunker.py`
- [Vector store](https://github.com/maheeth07/carevault/blob/main/backend/agent/vectorstore/mongo_vector.py): `backend/agent/vectorstore/mongo_vector.py`

### Other components

- **API client**
- **MongoDB**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → Appointment routes: registers (evidence: `backend/app.py`)
- FastAPI app → Consultation routes: registers (evidence: `backend/app.py`)
- FastAPI app → Patient routes: registers (evidence: `backend/app.py`)
- FastAPI app → Doctor routes: registers (evidence: `backend/app.py`)
- FastAPI app → Tenure routes: registers (evidence: `backend/app.py`)
- Appointment routes → Appointment workflow: calls (evidence: `backend/routes/appointment_routes.py`)
- Consultation routes → Consultation workflow: calls (evidence: `backend/routes/consultation_routes.py`)
- Patient routes → Patient accounts: calls (evidence: `backend/routes/patient_routes.py`)
- Transcript routes → Transcript storage: routes to (evidence: `backend/routes/transcript_routes.py`)
- Appointment workflow → Mongo access: reads and writes (evidence: `backend/controllers/appointment_controller.py`)
- Consultation workflow → Mongo access: reads and writes (evidence: `backend/controllers/consultation_controller.py`)
- Patient accounts → Mongo access: reads and writes (evidence: `backend/controllers/patient_controller.py`)
- Doctor accounts → Mongo access: reads and writes (evidence: `backend/controllers/doctor_controller.py`)
- Tenure workflow → Mongo access: reads and writes (evidence: `backend/controllers/tenure_controller.py`)
- Transcript storage → Mongo access: updates consultation (evidence: `backend/controllers/transcript_controller.py`)
- Appointment workflow → Domain models: uses schema (evidence: `backend/controllers/appointment_controller.py`)
- Consultation workflow → Domain models: uses schema (evidence: `backend/controllers/consultation_controller.py`)
- Patient accounts → Domain models: uses schema (evidence: `backend/controllers/patient_controller.py`)
- Doctor accounts → Domain models: uses schema (evidence: `backend/controllers/doctor_controller.py`)
- Transcript storage → Domain models: uses schema (evidence: `backend/controllers/transcript_controller.py`)
- Patient accounts → Token utility: creates token (evidence: `backend/controllers/patient_controller.py`)
- Doctor accounts → Token utility: creates token (evidence: `backend/controllers/doctor_controller.py`)
- Mongo access → MongoDB: connects to (evidence: `backend/db/mng.py`)
- FastAPI app → Mongo access: creates indexes (evidence: `backend/app.py`)
