# udayteck/hospital-self-management architecture

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

- Interactive diagram: https://gitdiagram.com/udayteck/hospital-self-management
- Repository: https://github.com/udayteck/hospital-self-management

## Overview

This Flask hospital-management app serves patient, doctor, receptionist, and admin workflows. The principal flow is patient registration and login, doctor/slot discovery, appointment request, approval, and notification; appointments also feed clinician schedules and administrative reporting. Domain branches include patient records and insurance, prescriptions, billing, receptionist operations, and account/settings administration. The excerpts establish the app’s blueprint registration, models, selected booking/auth flows, and email integration; other route capabilities are represented from README claims and source-index references, not inspected implementation details.

Main entry points: [`app/__init__.py`](https://github.com/udayteck/hospital-self-management/blob/main/app/__init__.py) (Flask app), [`app/models.py`](https://github.com/udayteck/hospital-self-management/blob/main/app/models.py) (Domain entities), [`app/routes/auth.py`](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/auth.py) (Accounts and OTP), [`app/routes/patient.py`](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/patient.py) (Patient booking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and auth"]
  node_web_app["Flask app<br/>[__init__.py]"]
  node_auth["Accounts and OTP<br/>[auth.py]"]
  node_forms["Web forms<br/>[forms.py]"]
  node_home["Home page<br/>[main.py]"]
end

subgraph group_appointments["Appointment workflows"]
  node_patient_booking["Patient booking<br/>[patient.py]"]
  node_slot_logic["Availability slots<br/>[models.py]"]
  node_doctor_schedule["Doctor schedule<br/>[doctor.py]"]
end

subgraph group_care["Clinical and patient care"]
  node_patient_records["Patient records<br/>[patient.py]"]
  node_prescriptions["Prescriptions<br/>[doctor.py]"]
end

subgraph group_operations["Hospital operations"]
  node_reception_ops["Reception desk<br/>[receptionist.py]"]
  node_admin_ops["Admin management<br/>[admin.py]"]
  node_reports["Admin reports<br/>[admin.py]"]
  node_billing_insurance["Billing and insurance<br/>[admin.py]"]
end

subgraph group_platform["Shared platform"]
  node_domain_models["Domain entities<br/>[models.py]"]
  node_database[("SQL database")]
  node_extensions["Flask extensions<br/>[extensions.py]"]
  node_email_helper["Email delivery<br/>[email_helper.py]"]
end

node_patient(("Patient"))
node_doctor_actor(("Doctor"))
node_receptionist_actor(("Receptionist"))
node_admin_actor(("Administrator"))
node_email_service["Brevo SMTP API"]

node_patient -->|"uses"| node_web_app
node_doctor_actor -.->|"uses"| node_web_app
node_receptionist_actor -.->|"uses"| node_web_app
node_admin_actor -.->|"uses"| node_web_app
node_web_app -->|"registers"| node_auth
node_web_app -->|"registers"| node_patient_booking
node_web_app -->|"registers"| node_doctor_schedule
node_web_app -->|"registers"| node_reception_ops
node_web_app -->|"registers"| node_admin_ops
node_web_app -->|"registers"| node_home
node_auth -->|"queries and creates"| node_domain_models
node_auth -->|"sends OTP"| node_email_helper
node_auth -.->|"uses"| node_forms
node_patient_booking -->|"requests slots"| node_slot_logic
node_patient_booking -->|"books and cancels"| node_domain_models
node_patient_booking -->|"notifies"| node_email_helper
node_doctor_schedule -->|"updates appointments"| node_domain_models
node_doctor_schedule -->|"notifies patient"| node_email_helper
node_reception_ops -->|"manages appointments"| node_domain_models
node_admin_ops -->|"manages records"| node_domain_models
node_admin_ops -->|"computes metrics"| node_reports
node_patient_records -.->|"reads patient data"| node_domain_models
node_prescriptions -.->|"manages prescriptions"| node_domain_models
node_billing_insurance -->|"manages charges"| node_domain_models
node_domain_models -.->|"persists"| node_database
node_web_app -->|"initializes"| node_extensions
node_extensions -->|"provides ORM"| node_database
node_email_helper -->|"posts email"| node_email_service

click node_web_app "https://github.com/udayteck/hospital-self-management/blob/main/app/__init__.py"
click node_auth "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/auth.py"
click node_forms "https://github.com/udayteck/hospital-self-management/blob/main/app/forms.py"
click node_patient_booking "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/patient.py"
click node_slot_logic "https://github.com/udayteck/hospital-self-management/blob/main/app/models.py"
click node_doctor_schedule "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/doctor.py"
click node_reception_ops "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/receptionist.py"
click node_admin_ops "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py"
click node_reports "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py"
click node_patient_records "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/patient.py"
click node_prescriptions "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/doctor.py"
click node_billing_insurance "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py"
click node_domain_models "https://github.com/udayteck/hospital-self-management/blob/main/app/models.py"
click node_extensions "https://github.com/udayteck/hospital-self-management/blob/main/app/extensions.py"
click node_email_helper "https://github.com/udayteck/hospital-self-management/blob/main/app/email_helper.py"
click node_home "https://github.com/udayteck/hospital-self-management/blob/main/app/routes/main.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_web_app,node_auth,node_forms,node_home toneBlue
class node_patient_booking,node_slot_logic,node_doctor_schedule toneAmber
class node_patient_records,node_prescriptions,node_email_service toneMint
class node_reception_ops,node_admin_ops,node_reports,node_billing_insurance toneRose
class node_domain_models,node_database,node_extensions,node_email_helper,node_patient,node_doctor_actor,node_receptionist_actor,node_admin_actor toneIndigo
```

## Components

### Web entry and auth

- [Flask app](https://github.com/udayteck/hospital-self-management/blob/main/app/__init__.py): `app/__init__.py`
- [Accounts and OTP](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/auth.py): `app/routes/auth.py`
- [Web forms](https://github.com/udayteck/hospital-self-management/blob/main/app/forms.py): `app/forms.py`
- [Home page](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/main.py): `app/routes/main.py`

### Appointment workflows

- [Patient booking](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/patient.py): `app/routes/patient.py`
- [Availability slots](https://github.com/udayteck/hospital-self-management/blob/main/app/models.py): `app/models.py`
- [Doctor schedule](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/doctor.py): `app/routes/doctor.py`

### Clinical and patient care

- [Patient records](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/patient.py): `app/routes/patient.py`
- [Prescriptions](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/doctor.py): `app/routes/doctor.py`

### Hospital operations

- [Reception desk](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/receptionist.py): `app/routes/receptionist.py`
- [Admin management](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py): `app/routes/admin.py`
- [Admin reports](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py): `app/routes/admin.py`
- [Billing and insurance](https://github.com/udayteck/hospital-self-management/blob/main/app/routes/admin.py): `app/routes/admin.py`

### Shared platform

- [Domain entities](https://github.com/udayteck/hospital-self-management/blob/main/app/models.py): `app/models.py`
- **SQL database**
- [Flask extensions](https://github.com/udayteck/hospital-self-management/blob/main/app/extensions.py): `app/extensions.py`
- [Email delivery](https://github.com/udayteck/hospital-self-management/blob/main/app/email_helper.py): `app/email_helper.py`

### Other components

- **Patient**
- **Doctor**
- **Receptionist**
- **Administrator**
- **Brevo SMTP API**

## Connections

- Patient → Flask app: uses (evidence: `app/__init__.py`)
- Doctor → Flask app: uses
- Receptionist → Flask app: uses
- Administrator → Flask app: uses
- Flask app → Accounts and OTP: registers (evidence: `app/__init__.py`)
- Flask app → Patient booking: registers (evidence: `app/__init__.py`)
- Flask app → Doctor schedule: registers (evidence: `app/__init__.py`)
- Flask app → Reception desk: registers (evidence: `app/__init__.py`)
- Flask app → Admin management: registers (evidence: `app/__init__.py`)
- Flask app → Home page: registers (evidence: `app/__init__.py`)
- Accounts and OTP → Domain entities: queries and creates (evidence: `app/routes/auth.py`)
- Accounts and OTP → Email delivery: sends OTP (evidence: `app/routes/auth.py`)
- Accounts and OTP → Web forms: uses
- Patient booking → Availability slots: requests slots (evidence: `app/routes/patient.py`)
- Patient booking → Domain entities: books and cancels (evidence: `app/routes/patient.py`)
- Patient booking → Email delivery: notifies (evidence: `app/routes/patient.py`)
- Doctor schedule → Domain entities: updates appointments (evidence: `app/routes/doctor.py`)
- Doctor schedule → Email delivery: notifies patient (evidence: `app/routes/doctor.py`)
- Reception desk → Domain entities: manages appointments (evidence: `app/routes/receptionist.py`)
- Admin management → Domain entities: manages records (evidence: `app/routes/admin.py`)
- Admin management → Admin reports: computes metrics (evidence: `app/routes/admin.py`)
- Patient records → Domain entities: reads patient data (evidence: `app/routes/patient.py`)
- Prescriptions → Domain entities: manages prescriptions (evidence: `app/routes/doctor.py`)
- Billing and insurance → Domain entities: manages charges (evidence: `app/routes/admin.py`)
- Domain entities → SQL database: persists
- Flask app → Flask extensions: initializes (evidence: `app/__init__.py`)
- Flask extensions → SQL database: provides ORM (evidence: `app/extensions.py`)
- Email delivery → Brevo SMTP API: posts email (evidence: `app/email_helper.py`)
