# zaber-dev/hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/zaber-dev/hospital-management-system
- Repository: https://github.com/zaber-dev/hospital-management-system

## Overview

This PHP hospital-management application takes users from sign-in to a role-aware dashboard, where staff and administrators manage operational records and doctors access their own clinical work. The main domains are identity and access, registries and scheduling, clinical records, and facilities; shared PHP data-access functions support these workflows. The README documents the broader feature set, including admissions and role permissions. Some management pages and database code are unsampled, so their subsystem coverage follows the file tree and SOURCE INDEX; uncertain links are omitted.

Main entry points: [`database.php`](https://github.com/zaber-dev/hospital-management-system/blob/main/database.php) (PHP Data Access), [`index.php`](https://github.com/zaber-dev/hospital-management-system/blob/main/index.php) (Home and Overview), [`auth/login.php`](https://github.com/zaber-dev/hospital-management-system/blob/main/auth/login.php) (Sign In), [`auth/signup.php`](https://github.com/zaber-dev/hospital-management-system/blob/main/auth/signup.php) (Staff Registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and Access"]
  node_login["Sign In<br/>[login.php]"]
  node_signup["Staff Registration<br/>[signup.php]"]
  node_logout["Sign Out<br/>[logout.php]"]
  node_auth["Session and Role Controls<br/>[config.php]"]
  node_users["User Administration<br/>[manage-users.php]"]
end

subgraph group_operations["Hospital Operations"]
  node_home["Home and Overview<br/>[index.php]"]
  node_dashboard["Role-Aware Dashboard<br/>[index.php]"]
  node_sidebar["Role Navigation<br/>[sidebar.php]"]
  node_appointments["Appointment Management"]
  node_appointment_status["Appointment Status API"]
  node_appointment_options["Appointment Options API"]
  node_patients["Patient Registry"]
  node_doctors["Doctor Registry<br/>[manage-doctors.php]"]
  node_departments["Department Registry"]
  node_rooms["Rooms and Admissions<br/>[manage-rooms.php]"]
end

subgraph group_clinical["Clinical Records"]
  node_treatments["Treatment Records"]
  node_prescriptions["Prescriptions"]
  node_medications["Medication Registry"]
end

subgraph group_shared["Shared Services"]
  node_data_access["PHP Data Access<br/>[database.php]"]
  node_database_schema[("Relational Schema<br/>[schema.sql]")]
end

node_user(("Hospital User"))

node_user -->|"opens"| node_home
node_home -->|"offers sign-in"| node_login
node_home -->|"offers registration"| node_signup
node_user -->|"submits credentials"| node_login
node_login -->|"looks up account"| node_data_access
node_login -->|"uses session controls"| node_auth
node_user -->|"submits registration"| node_signup
node_signup -->|"creates account"| node_data_access
node_signup -->|"uses session controls"| node_auth
node_user -->|"requests sign-out"| node_logout
node_logout -->|"uses session controls"| node_auth
node_home -->|"loads overview data"| node_data_access
node_dashboard -->|"loads dashboard data"| node_data_access
node_dashboard -->|"posts status changes"| node_appointment_status
node_appointments -->|"manages appointments"| node_data_access
node_appointment_status -->|"updates appointment"| node_data_access
node_appointment_options -->|"queries appointments"| node_data_access
node_patients -->|"manages patients"| node_data_access
node_doctors -->|"manages doctors"| node_data_access
node_departments -->|"manages departments"| node_data_access
node_rooms -->|"manages rooms and stays"| node_data_access
node_treatments -->|"manages treatments"| node_data_access
node_prescriptions -->|"manages prescriptions"| node_data_access
node_medications -->|"manages medications"| node_data_access
node_users -->|"manages accounts"| node_data_access
node_data_access -->|"loads database settings"| node_auth
node_data_access -.->|"accesses relational records"| node_database_schema
node_dashboard -->|"includes navigation"| node_sidebar
node_appointments -->|"includes navigation"| node_sidebar
node_rooms -.->|"includes navigation"| node_sidebar

click node_home "https://github.com/zaber-dev/hospital-management-system/blob/main/index.php"
click node_login "https://github.com/zaber-dev/hospital-management-system/blob/main/auth/login.php"
click node_signup "https://github.com/zaber-dev/hospital-management-system/blob/main/auth/signup.php"
click node_logout "https://github.com/zaber-dev/hospital-management-system/blob/main/auth/logout.php"
click node_auth "https://github.com/zaber-dev/hospital-management-system/blob/main/config.php"
click node_dashboard "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/index.php"
click node_sidebar "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/sidebar.php"
click node_appointments "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-appointments.php"
click node_appointment_status "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/api/appointment_status.php"
click node_appointment_options "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/api/appointments_options.php"
click node_patients "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-patients.php"
click node_doctors "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-doctors.php"
click node_departments "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-departments.php"
click node_rooms "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-rooms.php"
click node_treatments "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-treatments.php"
click node_prescriptions "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-prescriptions.php"
click node_medications "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-medications.php"
click node_users "https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-users.php"
click node_data_access "https://github.com/zaber-dev/hospital-management-system/blob/main/database.php"
click node_database_schema "https://github.com/zaber-dev/hospital-management-system/blob/main/schema.sql"

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_login,node_signup,node_logout,node_auth,node_users,node_user toneBlue
class node_home,node_dashboard,node_sidebar,node_appointments,node_appointment_status,node_appointment_options,node_patients,node_doctors,node_departments,node_rooms toneAmber
class node_treatments,node_prescriptions,node_medications toneMint
class node_data_access,node_database_schema toneRose
```

## Components

### Identity and Access

- [Sign In](https://github.com/zaber-dev/hospital-management-system/blob/main/auth/login.php): `auth/login.php`
- [Staff Registration](https://github.com/zaber-dev/hospital-management-system/blob/main/auth/signup.php): `auth/signup.php`
- [Sign Out](https://github.com/zaber-dev/hospital-management-system/blob/main/auth/logout.php): `auth/logout.php`
- [Session and Role Controls](https://github.com/zaber-dev/hospital-management-system/blob/main/config.php): `config.php`
- [User Administration](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-users.php): `dashboard/manage-users.php`

### Hospital Operations

- [Home and Overview](https://github.com/zaber-dev/hospital-management-system/blob/main/index.php): `index.php`
- [Role-Aware Dashboard](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/index.php): `dashboard/index.php`
- [Role Navigation](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/sidebar.php): `dashboard/sidebar.php`
- [Appointment Management](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-appointments.php): `dashboard/manage-appointments.php`
- [Appointment Status API](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/api/appointment_status.php): `dashboard/api/appointment_status.php`
- [Appointment Options API](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/api/appointments_options.php): `dashboard/api/appointments_options.php`
- [Patient Registry](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-patients.php): `dashboard/manage-patients.php`
- [Doctor Registry](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-doctors.php): `dashboard/manage-doctors.php`
- [Department Registry](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-departments.php): `dashboard/manage-departments.php`
- [Rooms and Admissions](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-rooms.php): `dashboard/manage-rooms.php`

### Clinical Records

- [Treatment Records](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-treatments.php): `dashboard/manage-treatments.php`
- [Prescriptions](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-prescriptions.php): `dashboard/manage-prescriptions.php`
- [Medication Registry](https://github.com/zaber-dev/hospital-management-system/blob/main/dashboard/manage-medications.php): `dashboard/manage-medications.php`

### Shared Services

- [PHP Data Access](https://github.com/zaber-dev/hospital-management-system/blob/main/database.php): `database.php`
- [Relational Schema](https://github.com/zaber-dev/hospital-management-system/blob/main/schema.sql): `schema.sql`

### Other components

- **Hospital User**

## Connections

- Hospital User → Home and Overview: opens (evidence: `README.md`)
- Home and Overview → Sign In: offers sign-in (evidence: `index.php`)
- Home and Overview → Staff Registration: offers registration (evidence: `index.php`)
- Hospital User → Sign In: submits credentials (evidence: `auth/login.php`)
- Sign In → PHP Data Access: looks up account (evidence: `auth/login.php`)
- Sign In → Session and Role Controls: uses session controls (evidence: `auth/login.php`)
- Hospital User → Staff Registration: submits registration (evidence: `auth/signup.php`)
- Staff Registration → PHP Data Access: creates account (evidence: `auth/signup.php`)
- Staff Registration → Session and Role Controls: uses session controls (evidence: `auth/signup.php`)
- Hospital User → Sign Out: requests sign-out (evidence: `auth/logout.php`)
- Sign Out → Session and Role Controls: uses session controls (evidence: `auth/logout.php`)
- Home and Overview → PHP Data Access: loads overview data (evidence: `index.php`)
- Role-Aware Dashboard → PHP Data Access: loads dashboard data (evidence: `dashboard/index.php`)
- Role-Aware Dashboard → Appointment Status API: posts status changes (evidence: `dashboard/index.php`)
- Appointment Management → PHP Data Access: manages appointments (evidence: `dashboard/manage-appointments.php`)
- Appointment Status API → PHP Data Access: updates appointment (evidence: `dashboard/api/appointment_status.php`)
- Appointment Options API → PHP Data Access: queries appointments (evidence: `dashboard/api/appointments_options.php`)
- Patient Registry → PHP Data Access: manages patients (evidence: `dashboard/manage-patients.php`)
- Doctor Registry → PHP Data Access: manages doctors (evidence: `dashboard/manage-doctors.php`)
- Department Registry → PHP Data Access: manages departments (evidence: `dashboard/manage-departments.php`)
- Rooms and Admissions → PHP Data Access: manages rooms and stays (evidence: `dashboard/manage-rooms.php`)
- Treatment Records → PHP Data Access: manages treatments (evidence: `dashboard/manage-treatments.php`)
- Prescriptions → PHP Data Access: manages prescriptions (evidence: `dashboard/manage-prescriptions.php`)
- Medication Registry → PHP Data Access: manages medications (evidence: `dashboard/manage-medications.php`)
- User Administration → PHP Data Access: manages accounts (evidence: `dashboard/manage-users.php`)
- PHP Data Access → Session and Role Controls: loads database settings (evidence: `database.php`)
- PHP Data Access → Relational Schema: accesses relational records
- Role-Aware Dashboard → Role Navigation: includes navigation (evidence: `dashboard/index.php`)
- Appointment Management → Role Navigation: includes navigation (evidence: `dashboard/manage-appointments.php`)
- Rooms and Admissions → Role Navigation: includes navigation (evidence: `dashboard/manage-rooms.php`)
