# ankitpolar/hms-final architecture

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

- Interactive diagram: https://gitdiagram.com/ankitpolar/hms-final
- Repository: https://github.com/ankitpolar/hms-final

## Overview

This PHP/MySQL hospital management system serves patients, doctors, and administrators through separate web interfaces. The principal patient workflow is appointment booking, followed by payment and confirmation; patients can also review or cancel appointments. Doctors manage appointments and profiles, while administrators manage doctors, patients, and system activity. The excerpts show booking persistence, Razorpay handoff, and appointment-history behavior. Other capabilities are represented from the README and file tree; their internal links are left unverified where source was not sampled.

Main entry points: [`hms/book-appointment.php`](https://github.com/ankitpolar/hms-final/blob/main/hms/book-appointment.php) (Appointment booking), [`hms/appointment-history.php`](https://github.com/ankitpolar/hms-final/blob/main/hms/appointment-history.php) (Appointment history and cancellation), [`hms/pay.php`](https://github.com/ankitpolar/hms-final/blob/main/hms/pay.php) (Payment handoff), [`hms/payment_success.php`](https://github.com/ankitpolar/hms-final/blob/main/hms/payment_success.php) (Payment confirmation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient services"]
  node_patient_auth["Patient registration and login<br/>[registration.php]"]
  node_patient_dashboard["Patient dashboard<br/>[dashboard.php]"]
  node_booking["Appointment booking"]
  node_availability["Doctor availability"]
  node_doctor_lookup["Doctor lookup and fees<br/>[get_doctor.php]"]
  node_patient_history["Appointment history and cancellation"]
  node_patient_profile["Patient profile<br/>[edit-profile.php]"]
  node_payment["Payment handoff<br/>[pay.php]"]
  node_payment_confirm["Payment confirmation"]
end

subgraph group_clinical["Doctor services"]
  node_doctor_auth["Doctor login<br/>[index.php]"]
  node_doctor_dashboard["Doctor dashboard<br/>[dashboard.php]"]
  node_doctor_history["Doctor appointment history"]
  node_doctor_profile["Doctor profile<br/>[edit-profile.php]"]
end

subgraph group_admin["Administration"]
  node_admin_auth["Admin login<br/>[index.php]"]
  node_admin_dashboard["Admin dashboard<br/>[dashboard.php]"]
  node_doctor_management["Doctor and specialization management<br/>[add-doctor.php]"]
  node_patient_management["Patient management<br/>[manage-users.php]"]
  node_admin_appointments["Appointment history"]
  node_session_logs["Session logs<br/>[doctor-logs.php]"]
end

subgraph group_shared["Shared infrastructure"]
  node_database[("MySQL database")]
  node_db_config["Database connection<br/>[config.php]"]
  node_patient_guard["Patient login guard<br/>[checklogin.php]"]
  node_patient_ui["Patient shared interface"]
  node_doctor_ui["Doctor shared interface"]
  node_admin_ui["Admin shared interface"]
  node_status_maintenance["Appointment status maintenance"]
end

node_patient_actor(("Patient"))
node_payment_gateway["Razorpay"]
node_doctor_actor(("Doctor"))
node_admin_actor(("Administrator"))

node_patient_actor -->|"registers or signs in"| node_patient_auth
node_patient_actor -->|"books"| node_booking
node_booking -->|"requests doctors"| node_doctor_lookup
node_booking -.->|"checks availability"| node_availability
node_booking -->|"writes appointment"| node_database
node_booking -->|"redirects after insert"| node_payment
node_payment -.->|"opens checkout"| node_payment_gateway
node_payment_gateway -->|"submits payment result"| node_payment_confirm
node_payment_confirm -->|"uses configured connection"| node_database
node_patient_actor -->|"views appointments"| node_patient_history
node_patient_history -->|"reads and updates"| node_database
node_patient_actor -.->|"updates profile"| node_patient_profile
node_patient_actor -.->|"uses portal"| node_patient_dashboard
node_doctor_actor -->|"signs in"| node_doctor_auth
node_doctor_actor -.->|"uses portal"| node_doctor_dashboard
node_doctor_actor -->|"manages appointments"| node_doctor_history
node_doctor_actor -->|"updates profile"| node_doctor_profile
node_admin_actor -.->|"signs in"| node_admin_auth
node_admin_actor -->|"views statistics"| node_admin_dashboard
node_admin_actor -->|"manages doctors"| node_doctor_management
node_admin_actor -->|"manages patients"| node_patient_management
node_admin_actor -.->|"reviews appointments"| node_admin_appointments
node_admin_actor -.->|"reviews sessions"| node_session_logs
node_db_config -->|"connects to"| node_database
node_patient_guard -->|"redirects unauthenticated users"| node_patient_auth
node_booking -->|"checks login"| node_patient_guard
node_patient_history -->|"includes status update"| node_status_maintenance
node_status_maintenance -->|"updates expired appointments"| node_database
node_booking -->|"includes shared interface"| node_patient_ui
node_doctor_history -->|"includes shared interface"| node_doctor_ui
node_admin_dashboard -->|"includes shared interface"| node_admin_ui

click node_patient_auth "https://github.com/ankitpolar/hms-final/blob/main/hms/registration.php"
click node_patient_dashboard "https://github.com/ankitpolar/hms-final/blob/main/hms/dashboard.php"
click node_booking "https://github.com/ankitpolar/hms-final/blob/main/hms/book-appointment.php"
click node_availability "https://github.com/ankitpolar/hms-final/blob/main/hms/check_availability.php"
click node_doctor_lookup "https://github.com/ankitpolar/hms-final/blob/main/hms/get_doctor.php"
click node_patient_history "https://github.com/ankitpolar/hms-final/blob/main/hms/appointment-history.php"
click node_patient_profile "https://github.com/ankitpolar/hms-final/blob/main/hms/edit-profile.php"
click node_payment "https://github.com/ankitpolar/hms-final/blob/main/hms/pay.php"
click node_payment_confirm "https://github.com/ankitpolar/hms-final/blob/main/hms/payment_success.php"
click node_doctor_auth "https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/index.php"
click node_doctor_dashboard "https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/dashboard.php"
click node_doctor_history "https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/appointment-history.php"
click node_doctor_profile "https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/edit-profile.php"
click node_admin_auth "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/index.php"
click node_admin_dashboard "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/dashboard.php"
click node_doctor_management "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/add-doctor.php"
click node_patient_management "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/manage-users.php"
click node_admin_appointments "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/appointment-history.php"
click node_session_logs "https://github.com/ankitpolar/hms-final/blob/main/hms/admin/doctor-logs.php"
click node_db_config "https://github.com/ankitpolar/hms-final/blob/main/hms/include/config.php"
click node_patient_guard "https://github.com/ankitpolar/hms-final/blob/main/hms/include/checklogin.php"
click node_patient_ui "https://github.com/ankitpolar/hms-final/tree/main/hms/include"
click node_doctor_ui "https://github.com/ankitpolar/hms-final/tree/main/hms/doctor/include"
click node_admin_ui "https://github.com/ankitpolar/hms-final/tree/main/hms/admin/include"
click node_status_maintenance "https://github.com/ankitpolar/hms-final/blob/main/hms/include/update-appointment-status.php"

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_patient_auth,node_patient_dashboard,node_booking,node_availability,node_doctor_lookup,node_patient_history,node_patient_profile,node_payment,node_payment_confirm toneBlue
class node_doctor_auth,node_doctor_dashboard,node_doctor_history,node_doctor_profile toneAmber
class node_admin_auth,node_admin_dashboard,node_doctor_management,node_patient_management,node_admin_appointments,node_session_logs toneMint
class node_database,node_db_config,node_patient_guard,node_patient_ui,node_doctor_ui,node_admin_ui,node_status_maintenance toneRose
class node_patient_actor,node_payment_gateway,node_doctor_actor,node_admin_actor toneIndigo
```

## Components

### Patient services

- [Patient registration and login](https://github.com/ankitpolar/hms-final/blob/main/hms/registration.php): `hms/registration.php`
- [Patient dashboard](https://github.com/ankitpolar/hms-final/blob/main/hms/dashboard.php): `hms/dashboard.php`
- [Appointment booking](https://github.com/ankitpolar/hms-final/blob/main/hms/book-appointment.php): `hms/book-appointment.php`
- [Doctor availability](https://github.com/ankitpolar/hms-final/blob/main/hms/check_availability.php): `hms/check_availability.php`
- [Doctor lookup and fees](https://github.com/ankitpolar/hms-final/blob/main/hms/get_doctor.php): `hms/get_doctor.php`
- [Appointment history and cancellation](https://github.com/ankitpolar/hms-final/blob/main/hms/appointment-history.php): `hms/appointment-history.php`
- [Patient profile](https://github.com/ankitpolar/hms-final/blob/main/hms/edit-profile.php): `hms/edit-profile.php`
- [Payment handoff](https://github.com/ankitpolar/hms-final/blob/main/hms/pay.php): `hms/pay.php`
- [Payment confirmation](https://github.com/ankitpolar/hms-final/blob/main/hms/payment_success.php): `hms/payment_success.php`

### Doctor services

- [Doctor login](https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/index.php): `hms/doctor/index.php`
- [Doctor dashboard](https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/dashboard.php): `hms/doctor/dashboard.php`
- [Doctor appointment history](https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/appointment-history.php): `hms/doctor/appointment-history.php`
- [Doctor profile](https://github.com/ankitpolar/hms-final/blob/main/hms/doctor/edit-profile.php): `hms/doctor/edit-profile.php`

### Administration

- [Admin login](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/index.php): `hms/admin/index.php`
- [Admin dashboard](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/dashboard.php): `hms/admin/dashboard.php`
- [Doctor and specialization management](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/add-doctor.php): `hms/admin/add-doctor.php`
- [Patient management](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/manage-users.php): `hms/admin/manage-users.php`
- [Appointment history](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/appointment-history.php): `hms/admin/appointment-history.php`
- [Session logs](https://github.com/ankitpolar/hms-final/blob/main/hms/admin/doctor-logs.php): `hms/admin/doctor-logs.php`

### Shared infrastructure

- **MySQL database**
- [Database connection](https://github.com/ankitpolar/hms-final/blob/main/hms/include/config.php): `hms/include/config.php`
- [Patient login guard](https://github.com/ankitpolar/hms-final/blob/main/hms/include/checklogin.php): `hms/include/checklogin.php`
- [Patient shared interface](https://github.com/ankitpolar/hms-final/tree/main/hms/include): `hms/include`
- [Doctor shared interface](https://github.com/ankitpolar/hms-final/tree/main/hms/doctor/include): `hms/doctor/include`
- [Admin shared interface](https://github.com/ankitpolar/hms-final/tree/main/hms/admin/include): `hms/admin/include`
- [Appointment status maintenance](https://github.com/ankitpolar/hms-final/blob/main/hms/include/update-appointment-status.php): `hms/include/update-appointment-status.php`

### Other components

- **Patient**
- **Razorpay**
- **Doctor**
- **Administrator**

## Connections

- Patient → Patient registration and login: registers or signs in
- Patient → Appointment booking: books
- Appointment booking → Doctor lookup and fees: requests doctors (evidence: `hms/book-appointment.php`)
- Appointment booking → Doctor availability: checks availability
- Appointment booking → MySQL database: writes appointment (evidence: `hms/book-appointment.php`)
- Appointment booking → Payment handoff: redirects after insert (evidence: `hms/book-appointment.php`)
- Payment handoff → Razorpay: opens checkout
- Razorpay → Payment confirmation: submits payment result
- Payment confirmation → MySQL database: uses configured connection (evidence: `hms/payment_success.php`)
- Patient → Appointment history and cancellation: views appointments
- Appointment history and cancellation → MySQL database: reads and updates (evidence: `hms/appointment-history.php`)
- Patient → Patient profile: updates profile
- Patient → Patient dashboard: uses portal
- Doctor → Doctor login: signs in
- Doctor → Doctor dashboard: uses portal
- Doctor → Doctor appointment history: manages appointments
- Doctor → Doctor profile: updates profile
- Administrator → Admin login: signs in
- Administrator → Admin dashboard: views statistics
- Administrator → Doctor and specialization management: manages doctors
- Administrator → Patient management: manages patients
- Administrator → Appointment history: reviews appointments
- Administrator → Session logs: reviews sessions
- Database connection → MySQL database: connects to (evidence: `hms/include/config.php`)
- Patient login guard → Patient registration and login: redirects unauthenticated users (evidence: `hms/include/checklogin.php`)
- Appointment booking → Patient login guard: checks login (evidence: `hms/book-appointment.php`)
- Appointment history and cancellation → Appointment status maintenance: includes status update (evidence: `hms/appointment-history.php`)
- Appointment status maintenance → MySQL database: updates expired appointments (evidence: `hms/include/update-appointment-status.php`)
- Appointment booking → Patient shared interface: includes shared interface (evidence: `hms/book-appointment.php`)
- Doctor appointment history → Doctor shared interface: includes shared interface (evidence: `hms/doctor/appointment-history.php`)
- Admin dashboard → Admin shared interface: includes shared interface (evidence: `hms/admin/dashboard.php`)
