# codedloaded/medicare-hospital-system architecture

> Architecture diagram of the GitHub repository codedloaded/medicare-hospital-system, 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/codedloaded/medicare-hospital-system
- Repository: https://github.com/codedloaded/medicare-hospital-system

## Overview

This Laravel hospital-appointments application supports patient self-service and admin/medical-assistant operations. Users authenticate and are routed by role; patients browse doctors and departments, book or cancel appointments, review appointment history, and edit profiles, while staff manage appointments and administrators maintain clinic records. The appointment controllers validate scheduling against working hours and existing bookings. Source excerpts establish the appointment and model interactions; other role-based capabilities are represented from the route index and tree, so their internal details are not inferred.

Main entry points: [`routes/web.php`](https://github.com/codedloaded/medicare-hospital-system/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/Patient/AppointmentController.php`](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Patient/AppointmentController.php) (Patient appointments), [`app/Http/Controllers/Assistant/AppointmentController.php`](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Assistant/AppointmentController.php) (Assistant appointments), [`app/Http/Controllers/admin/AppointmentController.php`](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/admin/AppointmentController.php) (Admin appointments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry and access"]
  node_routes["Web routes<br/>[web.php]"]
  node_login["Authentication"]
  node_access["Role access checks"]
end

subgraph group_patient["Patient services"]
  node_patient_browse["Clinic discovery"]
  node_patient_appt["Patient appointments"]
  node_profile["Patient profile"]
  node_patient_views["Patient screens"]
end

subgraph group_staff["Staff and administration"]
  node_assistant_appt["Assistant appointments"]
  node_assistant_ops["Assistant clinic tools"]
  node_admin_appt["Admin appointments"]
  node_admin_ops["Admin clinic management"]
  node_staff_views["Staff screens"]
end

subgraph group_domain["Clinic records"]
  node_appointment[("Appointments<br/>[Appointment.php]")]
  node_doctor[("Doctors and hours<br/>[Doctor.php]")]
  node_hours[("Doctor working hours")]
  node_department[("Departments<br/>[Department.php]")]
  node_user[("Users and patients<br/>[User.php]")]
end

node_visitor(("Patient or staff"))

node_visitor -->|"opens pages"| node_routes
node_routes -->|"routes login"| node_login
node_routes -->|"routes patient pages"| node_patient_browse
node_routes -->|"routes bookings"| node_patient_appt
node_routes -->|"routes profile"| node_profile
node_routes -->|"routes assistant bookings"| node_assistant_appt
node_routes -->|"routes assistant tools"| node_assistant_ops
node_routes -->|"routes admin bookings"| node_admin_appt
node_routes -->|"routes admin tools"| node_admin_ops
node_routes -->|"applies role checks"| node_access
node_login -.->|"authenticates users"| node_user
node_patient_browse -.->|"renders screens"| node_patient_views
node_patient_appt -->|"renders appointments"| node_patient_views
node_patient_appt -->|"creates and queries"| node_appointment
node_patient_appt -->|"queries availability"| node_hours
node_patient_appt -->|"loads departments"| node_department
node_patient_appt -.->|"uses patient identity"| node_user
node_profile -.->|"updates account"| node_user
node_assistant_appt -->|"creates and updates"| node_appointment
node_assistant_appt -->|"checks schedules"| node_hours
node_assistant_appt -->|"loads doctors"| node_doctor
node_assistant_appt -->|"loads patients"| node_user
node_assistant_appt -->|"renders assistant pages"| node_staff_views
node_admin_appt -->|"creates and updates"| node_appointment
node_admin_appt -->|"checks schedules"| node_hours
node_admin_appt -->|"loads doctors"| node_doctor
node_admin_appt -->|"loads patients"| node_user
node_admin_appt -->|"renders admin pages"| node_staff_views
node_assistant_ops -.->|"renders staff pages"| node_staff_views
node_admin_ops -.->|"renders admin pages"| node_staff_views
node_appointment -->|"belongs to patient"| node_user
node_appointment -->|"belongs to doctor"| node_doctor
node_doctor -->|"belongs to department"| node_department
node_doctor -->|"has working hours"| node_hours

click node_routes "https://github.com/codedloaded/medicare-hospital-system/blob/main/routes/web.php"
click node_login "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Auth/LoginController.php"
click node_access "https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Middleware"
click node_patient_browse "https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/Patient"
click node_patient_appt "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Patient/AppointmentController.php"
click node_profile "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Patient/ProfileController.php"
click node_patient_views "https://github.com/codedloaded/medicare-hospital-system/tree/main/resources/views/patients"
click node_assistant_appt "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Assistant/AppointmentController.php"
click node_assistant_ops "https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/Assistant"
click node_admin_appt "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/admin/AppointmentController.php"
click node_admin_ops "https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/admin"
click node_staff_views "https://github.com/codedloaded/medicare-hospital-system/tree/main/resources/views"
click node_appointment "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Appointment.php"
click node_doctor "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Doctor.php"
click node_hours "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/DoctorWorkingHour.php"
click node_department "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Department.php"
click node_user "https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/User.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_routes,node_login,node_access toneBlue
class node_patient_browse,node_patient_appt,node_profile,node_patient_views toneAmber
class node_assistant_appt,node_assistant_ops,node_admin_appt,node_admin_ops,node_staff_views toneMint
class node_appointment,node_doctor,node_hours,node_department,node_user toneRose
class node_visitor toneIndigo
```

## Components

### Web entry and access

- [Web routes](https://github.com/codedloaded/medicare-hospital-system/blob/main/routes/web.php): `routes/web.php`
- [Authentication](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Auth/LoginController.php): `app/Http/Controllers/Auth/LoginController.php`
- [Role access checks](https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Middleware): `app/Http/Middleware`

### Patient services

- [Clinic discovery](https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/Patient): `app/Http/Controllers/Patient`
- [Patient appointments](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Patient/AppointmentController.php): `app/Http/Controllers/Patient/AppointmentController.php`
- [Patient profile](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Patient/ProfileController.php): `app/Http/Controllers/Patient/ProfileController.php`
- [Patient screens](https://github.com/codedloaded/medicare-hospital-system/tree/main/resources/views/patients): `resources/views/patients`

### Staff and administration

- [Assistant appointments](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/Assistant/AppointmentController.php): `app/Http/Controllers/Assistant/AppointmentController.php`
- [Assistant clinic tools](https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/Assistant): `app/Http/Controllers/Assistant`
- [Admin appointments](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Http/Controllers/admin/AppointmentController.php): `app/Http/Controllers/admin/AppointmentController.php`
- [Admin clinic management](https://github.com/codedloaded/medicare-hospital-system/tree/main/app/Http/Controllers/admin): `app/Http/Controllers/admin`
- [Staff screens](https://github.com/codedloaded/medicare-hospital-system/tree/main/resources/views): `resources/views`

### Clinic records

- [Appointments](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Appointment.php): `app/Models/Appointment.php`
- [Doctors and hours](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Doctor.php): `app/Models/Doctor.php`
- [Doctor working hours](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/DoctorWorkingHour.php): `app/Models/DoctorWorkingHour.php`
- [Departments](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/Department.php): `app/Models/Department.php`
- [Users and patients](https://github.com/codedloaded/medicare-hospital-system/blob/main/app/Models/User.php): `app/Models/User.php`

### Other components

- **Patient or staff**

## Connections

- Patient or staff → Web routes: opens pages (evidence: `routes/web.php`)
- Web routes → Authentication: routes login (evidence: `routes/web.php`)
- Web routes → Clinic discovery: routes patient pages (evidence: `routes/web.php`)
- Web routes → Patient appointments: routes bookings (evidence: `routes/web.php`)
- Web routes → Patient profile: routes profile (evidence: `routes/web.php`)
- Web routes → Assistant appointments: routes assistant bookings (evidence: `routes/web.php`)
- Web routes → Assistant clinic tools: routes assistant tools (evidence: `routes/web.php`)
- Web routes → Admin appointments: routes admin bookings (evidence: `routes/web.php`)
- Web routes → Admin clinic management: routes admin tools (evidence: `routes/web.php`)
- Web routes → Role access checks: applies role checks
- Authentication → Users and patients: authenticates users
- Clinic discovery → Patient screens: renders screens
- Patient appointments → Patient screens: renders appointments (evidence: `app/Http/Controllers/Patient/AppointmentController.php`)
- Patient appointments → Appointments: creates and queries (evidence: `app/Http/Controllers/Patient/AppointmentController.php`)
- Patient appointments → Doctor working hours: queries availability (evidence: `app/Http/Controllers/Patient/AppointmentController.php`)
- Patient appointments → Departments: loads departments (evidence: `app/Http/Controllers/Patient/AppointmentController.php`)
- Patient appointments → Users and patients: uses patient identity
- Patient profile → Users and patients: updates account
- Assistant appointments → Appointments: creates and updates (evidence: `app/Http/Controllers/Assistant/AppointmentController.php`)
- Assistant appointments → Doctor working hours: checks schedules (evidence: `app/Http/Controllers/Assistant/AppointmentController.php`)
- Assistant appointments → Doctors and hours: loads doctors (evidence: `app/Http/Controllers/Assistant/AppointmentController.php`)
- Assistant appointments → Users and patients: loads patients (evidence: `app/Http/Controllers/Assistant/AppointmentController.php`)
- Assistant appointments → Staff screens: renders assistant pages (evidence: `app/Http/Controllers/Assistant/AppointmentController.php`)
- Admin appointments → Appointments: creates and updates (evidence: `app/Http/Controllers/admin/AppointmentController.php`)
- Admin appointments → Doctor working hours: checks schedules (evidence: `app/Http/Controllers/admin/AppointmentController.php`)
- Admin appointments → Doctors and hours: loads doctors (evidence: `app/Http/Controllers/admin/AppointmentController.php`)
- Admin appointments → Users and patients: loads patients (evidence: `app/Http/Controllers/admin/AppointmentController.php`)
- Admin appointments → Staff screens: renders admin pages (evidence: `app/Http/Controllers/admin/AppointmentController.php`)
- Assistant clinic tools → Staff screens: renders staff pages
- Admin clinic management → Staff screens: renders admin pages
- Appointments → Users and patients: belongs to patient (evidence: `app/Models/Appointment.php`)
- Appointments → Doctors and hours: belongs to doctor (evidence: `app/Models/Appointment.php`)
- Doctors and hours → Departments: belongs to department (evidence: `app/Models/Doctor.php`)
- Doctors and hours → Doctor working hours: has working hours (evidence: `app/Models/Doctor.php`)
