# subayel-wali/hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/subayel-wali/hospital-management-system
- Repository: https://github.com/subayel-wali/hospital-management-system

## Overview

HMAS is a Django hospital-management application for patient, doctor, and staff workflows. Patients register and create patient records, browse doctors and availability, book appointments, then view history or submit feedback; doctors manage profiles and availability, appointments, notes, tests, and feedback; staff manage availability, appointments, tests, and audit views. The map includes the shared domain models, role checks, and major documented capabilities. Evidence is limited to the README and indexed or excerpted files; unsampled route wiring and audit configuration are not inferred.

Main entry points: [`hmes/staff/views.py`](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/views.py) (Staff workflows), [`hmes/appointment/models.py`](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/models.py) (Appointment records), [`hmes/doctor/views.py`](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/views.py) (Doctor workflows), [`hmes/appointment/views.py`](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/views.py) (Appointment workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Home"]
  node_accounts["Accounts and roles<br/>[views.py]"]
  node_user_info[("User profiles<br/>[models.py]")]
  node_role_guard["Role checks<br/>[decorator.py]"]
  node_home["Home and dashboard<br/>[views.py]"]
  node_home_content[("Homepage content<br/>[models.py]")]
end

subgraph group_care["Patients and Appointments"]
  node_patients["Patient records<br/>[views.py]"]
  node_patient_model[("Patient data<br/>[models.py]")]
  node_appointments["Appointment workflows<br/>[views.py]"]
  node_appointment_forms["Appointment forms<br/>[forms.py]"]
  node_appointment_model[("Appointment records<br/>[models.py]")]
end

subgraph group_clinical["Doctors and Tests"]
  node_doctor_views["Doctor workflows<br/>[views.py]"]
  node_doctor_forms["Doctor forms<br/>[forms.py]"]
  node_doctor_model[("Doctors and slots<br/>[models.py]")]
  node_tests[("Diagnostic tests<br/>[models.py]")]
end

subgraph group_operations["Staff Operations"]
  node_staff_views["Staff workflows<br/>[views.py]"]
  node_staff_forms["Staff forms<br/>[forms.py]"]
  node_audit["Audit history<br/>[views.py]"]
end

node_visitor(("Hospital user"))

node_visitor -->|"registers or logs in"| node_accounts
node_accounts -->|"creates profile"| node_user_info
node_home -->|"loads images"| node_home_content
node_home -->|"redirects by role"| node_patients
node_home -.->|"redirects by role"| node_doctor_views
node_home -.->|"redirects by role"| node_staff_views
node_patients -->|"checks access"| node_role_guard
node_patients -->|"creates and reads"| node_patient_model
node_patients -->|"reads role profile"| node_user_info
node_patients -->|"loads history"| node_appointment_model
node_visitor -->|"browses doctors"| node_doctor_views
node_doctor_views -->|"reads and updates"| node_doctor_model
node_doctor_views -->|"saves profile"| node_doctor_forms
node_doctor_views -->|"reads and updates"| node_appointment_model
node_doctor_views -->|"lists and adds tests"| node_tests
node_appointments -->|"checks access"| node_role_guard
node_appointments -->|"loads doctor slots"| node_doctor_model
node_appointments -->|"loads patient records"| node_patient_model
node_appointments -->|"uses feedback form"| node_appointment_forms
node_appointments -->|"books and updates"| node_appointment_model
node_staff_views -->|"checks access"| node_role_guard
node_staff_views -->|"updates availability"| node_doctor_model
node_staff_views -->|"lists appointments"| node_appointment_model
node_staff_views -->|"creates and updates"| node_tests
node_staff_views -->|"uses test form"| node_staff_forms
node_staff_views -->|"loads log entries"| node_audit
node_appointment_model -->|"references slots"| node_doctor_model
node_appointment_model -->|"references patients"| node_patient_model
node_appointment_model -->|"associates tests"| node_tests

click node_accounts "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/account/views.py"
click node_user_info "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/account/models.py"
click node_role_guard "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/hmes/decorator.py"
click node_home "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/home/views.py"
click node_home_content "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/home/models.py"
click node_patients "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/patient/views.py"
click node_patient_model "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/patient/models.py"
click node_appointments "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/views.py"
click node_appointment_forms "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/forms.py"
click node_appointment_model "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/models.py"
click node_doctor_views "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/views.py"
click node_doctor_forms "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/forms.py"
click node_doctor_model "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/models.py"
click node_tests "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/hospital_test/models.py"
click node_staff_views "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/views.py"
click node_staff_forms "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/forms.py"
click node_audit "https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/views.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_accounts,node_user_info,node_role_guard,node_home,node_home_content,node_visitor toneBlue
class node_patients,node_patient_model,node_appointments,node_appointment_forms,node_appointment_model toneAmber
class node_doctor_views,node_doctor_forms,node_doctor_model,node_tests toneMint
class node_staff_views,node_staff_forms,node_audit toneRose
```

## Components

### Access and Home

- [Accounts and roles](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/account/views.py): `hmes/account/views.py`
- [User profiles](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/account/models.py): `hmes/account/models.py`
- [Role checks](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/hmes/decorator.py): `hmes/hmes/decorator.py`
- [Home and dashboard](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/home/views.py): `hmes/home/views.py`
- [Homepage content](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/home/models.py): `hmes/home/models.py`

### Patients and Appointments

- [Patient records](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/patient/views.py): `hmes/patient/views.py`
- [Patient data](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/patient/models.py): `hmes/patient/models.py`
- [Appointment workflows](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/views.py): `hmes/appointment/views.py`
- [Appointment forms](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/forms.py): `hmes/appointment/forms.py`
- [Appointment records](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/appointment/models.py): `hmes/appointment/models.py`

### Doctors and Tests

- [Doctor workflows](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/views.py): `hmes/doctor/views.py`
- [Doctor forms](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/forms.py): `hmes/doctor/forms.py`
- [Doctors and slots](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/doctor/models.py): `hmes/doctor/models.py`
- [Diagnostic tests](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/hospital_test/models.py): `hmes/hospital_test/models.py`

### Staff Operations

- [Staff workflows](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/views.py): `hmes/staff/views.py`
- [Staff forms](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/forms.py): `hmes/staff/forms.py`
- [Audit history](https://github.com/subayel-wali/hospital-management-system/blob/main/hmes/staff/views.py): `hmes/staff/views.py`

### Other components

- **Hospital user**

## Connections

- Hospital user → Accounts and roles: registers or logs in (evidence: `hmes/account/views.py`)
- Accounts and roles → User profiles: creates profile (evidence: `hmes/account/views.py`)
- Home and dashboard → Homepage content: loads images (evidence: `hmes/home/views.py`)
- Home and dashboard → Patient records: redirects by role (evidence: `hmes/home/views.py`)
- Home and dashboard → Doctor workflows: redirects by role
- Home and dashboard → Staff workflows: redirects by role
- Patient records → Role checks: checks access (evidence: `hmes/patient/views.py`)
- Patient records → Patient data: creates and reads (evidence: `hmes/patient/views.py`)
- Patient records → User profiles: reads role profile (evidence: `hmes/patient/views.py`)
- Patient records → Appointment records: loads history (evidence: `hmes/patient/views.py`)
- Hospital user → Doctor workflows: browses doctors (evidence: `hmes/doctor/views.py`)
- Doctor workflows → Doctors and slots: reads and updates (evidence: `hmes/doctor/views.py`)
- Doctor workflows → Doctor forms: saves profile (evidence: `hmes/doctor/views.py`)
- Doctor workflows → Appointment records: reads and updates (evidence: `hmes/doctor/views.py`)
- Doctor workflows → Diagnostic tests: lists and adds tests (evidence: `hmes/doctor/views.py`)
- Appointment workflows → Role checks: checks access (evidence: `hmes/appointment/views.py`)
- Appointment workflows → Doctors and slots: loads doctor slots (evidence: `hmes/appointment/views.py`)
- Appointment workflows → Patient data: loads patient records (evidence: `hmes/appointment/views.py`)
- Appointment workflows → Appointment forms: uses feedback form (evidence: `hmes/appointment/views.py`)
- Appointment workflows → Appointment records: books and updates (evidence: `hmes/appointment/views.py`)
- Staff workflows → Role checks: checks access (evidence: `hmes/staff/views.py`)
- Staff workflows → Doctors and slots: updates availability (evidence: `hmes/staff/views.py`)
- Staff workflows → Appointment records: lists appointments (evidence: `hmes/staff/views.py`)
- Staff workflows → Diagnostic tests: creates and updates (evidence: `hmes/staff/views.py`)
- Staff workflows → Staff forms: uses test form (evidence: `hmes/staff/views.py`)
- Staff workflows → Audit history: loads log entries (evidence: `hmes/staff/views.py`)
- Appointment records → Doctors and slots: references slots (evidence: `hmes/appointment/models.py`)
- Appointment records → Patient data: references patients (evidence: `hmes/appointment/models.py`)
- Appointment records → Diagnostic tests: associates tests (evidence: `hmes/appointment/models.py`)
