# ahzer0coder/clinic-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/ahzer0coder/clinic-management-system
- Repository: https://github.com/ahzer0coder/clinic-management-system

## Overview

This is a WPF clinic-management app. Its main workflow spans patient registration, appointment booking, reception check-in and priority ordering, then doctor consultation and visit recording; reports provide a separate summary capability. Startup loads clinic data and initializes the in-memory services, while text files persist patients, appointments, visits, and waiting-room state. The shown excerpts establish startup, persistence, patient operations, and heap behavior; some screen-to-service links are documented by the README rather than shown in source.

Main entry points: [`Datastructure_project/Services/StorageService.cs`](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/StorageService.cs) (Text-file storage), [`Datastructure_project/Services/WaitingRoomService.cs`](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/WaitingRoomService.cs) (Waiting room), [`Datastructure_project/App.xaml.cs`](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/App.xaml.cs) (Application startup), [`Datastructure_project/Views/PatientsView.xaml.cs`](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/PatientsView.xaml.cs) (Patient management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Clinic screens"]
  node_patients_screen["Patient management"]
  node_appointments_screen["Appointment booking"]
  node_reception_screen["Reception check-in"]
  node_doctor_screen["Doctor consultation<br/>[DoctorView.xaml.cs]"]
  node_reports_screen["Clinic reports"]
end

subgraph group_services["Clinic services"]
  node_patient_service["Patient records<br/>[PatientService.cs]"]
  node_appointment_service["Appointment scheduling"]
  node_waiting_service["Waiting room"]
  node_heap["Priority min-heap<br/>[MinHeap.cs]"]
  node_storage["Text-file storage<br/>[StorageService.cs]"]
end

subgraph group_models["Domain data"]
  node_patient["Patient<br/>[Patient.cs]"]
  node_appointment["Appointment<br/>[Appointment.cs]"]
  node_priority["Priority levels<br/>[Priority.cs]"]
  node_queue_entry["Queue entry<br/>[QueueEntry.cs]"]
  node_visit["Visit record<br/>[Visit.cs]"]
  node_priority_report["Priority report data<br/>[PriorityReport.cs]"]
end

subgraph group_runtime["Runtime and persistence"]
  node_app["Application startup<br/>[App.xaml.cs]"]
  node_clinic_files[("Clinic data files")]
end

node_staff(("Clinic staff"))

node_staff -->|"manages patients"| node_patients_screen
node_staff -->|"books appointments"| node_appointments_screen
node_staff -->|"checks in"| node_reception_screen
node_staff -->|"records visits"| node_doctor_screen
node_staff -->|"views totals"| node_reports_screen
node_patients_screen -->|"adds or deletes"| node_patient_service
node_patients_screen -->|"removes appointments"| node_appointment_service
node_patients_screen -->|"removes from queue"| node_waiting_service
node_appointments_screen -.->|"books or edits"| node_appointment_service
node_reception_screen -.->|"checks in patients"| node_waiting_service
node_doctor_screen -.->|"calls next"| node_waiting_service
node_reports_screen -.->|"shows summaries"| node_priority_report
node_app -->|"loads and saves"| node_storage
node_app -->|"initializes"| node_patient_service
node_app -->|"initializes"| node_appointment_service
node_app -->|"initializes"| node_waiting_service
node_storage -->|"reads and writes"| node_clinic_files
node_waiting_service -->|"orders arrivals"| node_heap
node_heap -->|"prioritizes"| node_queue_entry
node_heap -->|"compares levels"| node_priority
node_patient_service -->|"manages records"| node_patient
node_appointment_service -->|"manages bookings"| node_appointment
node_storage -->|"loads and saves"| node_patient
node_storage -->|"loads and saves"| node_appointment
node_storage -->|"loads and saves"| node_visit
node_storage -->|"loads and saves"| node_queue_entry
node_storage -->|"serializes levels"| node_priority

click node_patients_screen "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/PatientsView.xaml.cs"
click node_appointments_screen "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/AppointmentsView.xaml.cs"
click node_reception_screen "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/ReceptionView.xaml.cs"
click node_doctor_screen "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/DoctorView.xaml.cs"
click node_reports_screen "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/ReportsView.xaml.cs"
click node_patient_service "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/PatientService.cs"
click node_appointment_service "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/AppointmentService.cs"
click node_waiting_service "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/WaitingRoomService.cs"
click node_heap "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/DataStructures/MinHeap.cs"
click node_storage "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/StorageService.cs"
click node_patient "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Patient.cs"
click node_appointment "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Appointment.cs"
click node_priority "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Priority.cs"
click node_queue_entry "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/QueueEntry.cs"
click node_visit "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Visit.cs"
click node_priority_report "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/PriorityReport.cs"
click node_app "https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/App.xaml.cs"
click node_clinic_files "https://github.com/ahzer0coder/clinic-management-system/tree/master/Datastructure_project/DATA"

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_patients_screen,node_appointments_screen,node_reception_screen,node_doctor_screen,node_reports_screen toneBlue
class node_patient_service,node_appointment_service,node_waiting_service,node_heap,node_storage toneAmber
class node_patient,node_appointment,node_priority,node_queue_entry,node_visit,node_priority_report toneMint
class node_app,node_clinic_files toneRose
class node_staff toneIndigo
```

## Components

### Clinic screens

- [Patient management](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/PatientsView.xaml.cs): `Datastructure_project/Views/PatientsView.xaml.cs`
- [Appointment booking](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/AppointmentsView.xaml.cs): `Datastructure_project/Views/AppointmentsView.xaml.cs`
- [Reception check-in](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/ReceptionView.xaml.cs): `Datastructure_project/Views/ReceptionView.xaml.cs`
- [Doctor consultation](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/DoctorView.xaml.cs): `Datastructure_project/Views/DoctorView.xaml.cs`
- [Clinic reports](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Views/ReportsView.xaml.cs): `Datastructure_project/Views/ReportsView.xaml.cs`

### Clinic services

- [Patient records](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/PatientService.cs): `Datastructure_project/Services/PatientService.cs`
- [Appointment scheduling](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/AppointmentService.cs): `Datastructure_project/Services/AppointmentService.cs`
- [Waiting room](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/WaitingRoomService.cs): `Datastructure_project/Services/WaitingRoomService.cs`
- [Priority min-heap](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/DataStructures/MinHeap.cs): `Datastructure_project/DataStructures/MinHeap.cs`
- [Text-file storage](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Services/StorageService.cs): `Datastructure_project/Services/StorageService.cs`

### Domain data

- [Patient](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Patient.cs): `Datastructure_project/Models/Patient.cs`
- [Appointment](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Appointment.cs): `Datastructure_project/Models/Appointment.cs`
- [Priority levels](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Priority.cs): `Datastructure_project/Models/Priority.cs`
- [Queue entry](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/QueueEntry.cs): `Datastructure_project/Models/QueueEntry.cs`
- [Visit record](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/Visit.cs): `Datastructure_project/Models/Visit.cs`
- [Priority report data](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/Models/PriorityReport.cs): `Datastructure_project/Models/PriorityReport.cs`

### Runtime and persistence

- [Application startup](https://github.com/ahzer0coder/clinic-management-system/blob/master/Datastructure_project/App.xaml.cs): `Datastructure_project/App.xaml.cs`
- [Clinic data files](https://github.com/ahzer0coder/clinic-management-system/tree/master/Datastructure_project/DATA): `Datastructure_project/DATA`

### Other components

- **Clinic staff**

## Connections

- Clinic staff → Patient management: manages patients (evidence: `README.md`)
- Clinic staff → Appointment booking: books appointments (evidence: `README.md`)
- Clinic staff → Reception check-in: checks in (evidence: `README.md`)
- Clinic staff → Doctor consultation: records visits (evidence: `README.md`)
- Clinic staff → Clinic reports: views totals (evidence: `README.md`)
- Patient management → Patient records: adds or deletes (evidence: `Datastructure_project/Views/PatientsView.xaml.cs`)
- Patient management → Appointment scheduling: removes appointments (evidence: `Datastructure_project/Views/PatientsView.xaml.cs`)
- Patient management → Waiting room: removes from queue (evidence: `Datastructure_project/Views/PatientsView.xaml.cs`)
- Appointment booking → Appointment scheduling: books or edits (evidence: `README.md`)
- Reception check-in → Waiting room: checks in patients (evidence: `README.md`)
- Doctor consultation → Waiting room: calls next (evidence: `README.md`)
- Clinic reports → Priority report data: shows summaries (evidence: `README.md`)
- Application startup → Text-file storage: loads and saves (evidence: `Datastructure_project/App.xaml.cs`)
- Application startup → Patient records: initializes (evidence: `Datastructure_project/App.xaml.cs`)
- Application startup → Appointment scheduling: initializes (evidence: `Datastructure_project/App.xaml.cs`)
- Application startup → Waiting room: initializes (evidence: `Datastructure_project/App.xaml.cs`)
- Text-file storage → Clinic data files: reads and writes (evidence: `Datastructure_project/Services/StorageService.cs`)
- Waiting room → Priority min-heap: orders arrivals (evidence: `Datastructure_project/Services/WaitingRoomService.cs`)
- Priority min-heap → Queue entry: prioritizes (evidence: `Datastructure_project/DataStructures/MinHeap.cs`)
- Priority min-heap → Priority levels: compares levels (evidence: `Datastructure_project/DataStructures/MinHeap.cs`)
- Patient records → Patient: manages records (evidence: `Datastructure_project/Services/PatientService.cs`)
- Appointment scheduling → Appointment: manages bookings (evidence: `Datastructure_project/Services/AppointmentService.cs`)
- Text-file storage → Patient: loads and saves (evidence: `Datastructure_project/Services/StorageService.cs`)
- Text-file storage → Appointment: loads and saves (evidence: `Datastructure_project/Services/StorageService.cs`)
- Text-file storage → Visit record: loads and saves (evidence: `Datastructure_project/Services/StorageService.cs`)
- Text-file storage → Queue entry: loads and saves (evidence: `Datastructure_project/Services/StorageService.cs`)
- Text-file storage → Priority levels: serializes levels (evidence: `Datastructure_project/Services/StorageService.cs`)
