Case 08 / Healthcare + simulation
Orthopedic outpatient flow, modeled patient by patient.
A discrete-event simulation of the real outpatient workflow at Balta Limanı Kemik Hastanesi, developed using operational data collected at the hospital.
- Discrete-event Simulation
- Stochastic Arrivals
- Service-time Distributions
- Resource Queues
- SimPy
- NumPy
- Matplotlib
- 01 / ARRIVEAppointment or walk-inWalk-ins first pass through consultant registration
- 02 / EXAMFirst doctor visitPriority queue and doctor-specific service
- 03 / IMAGEX-ray if referredTwo rooms with their own queues
- 04 / FINISHFollow-up or departureReturn to the same doctor after imaging
- Hospital resources
- 7 + 2doctors and X-ray rooms in the model
- Patients generated
- 448in the documented seeded run
- Patients completed
- 448all generated patients finished the workflow
One hospital day is many connected queues.
Patients do not all follow the same route. Some arrive for scheduled appointments, while walk-ins need consultant registration before joining the doctor workflow. Doctors may refer a patient for X-ray, after which the patient returns for a second examination.
The project represents those events and resource constraints as patient-level processes. It focuses on the hospital's orthopedic outpatient workflow captured by the collected data, rather than an abstract clinic example.
Make the operating rules visible.
The configured model has seven doctors, two priority-based X-ray rooms, and one consultant. Appointment patients and walk-ins enter through different arrival processes. Each doctor has specific arrival, service, appointment, and imaging-referral distributions.
- Appointment priority and a separate walk-in priority offset shape doctor queues.
- Doctors pause for lunch from simulation minute 240 to 300.
- Pre-lunch X-ray service time uses a 1.25× multiplier.
- Walk-in generation stops at minute 420; scheduled appointment arrivals stop at minute 480.
- The model keeps running after arrivals stop until active patients and queues clear.
Queue lengths are sampled every simulated minute. The output records patient completions, X-ray referrals, doctor examinations, consultant registrations, and queue histories.
A seeded run that drains the system.
The repository fixes its random seed at 42 for its documented default scenario. The figures below describe that single simulated run.
| Measure | Recorded result |
|---|---|
| Scheduled appointments | 237 |
| Appointment arrivals / walk-in arrivals | 235 / 213 |
| Patients generated / completed | 448 / 448 |
| X-ray patients | 341 |
| Overall X-ray referral share | 76.12% |
| Consultant mean / maximum queue length | 2.76 / 10 patients |
| Simulation end time | 558 minutes |
The simulation continued 78 minutes beyond the final appointment-arrival horizon to let the remaining patients finish. No patients remained at termination in this run.
What this evidence supports.
The model reproduces the configured patient routes and resource rules, and its documented run completes all generated patients. The output exposes where queues form and how much work reaches each resource.