Skip to content

A python script to create a monthly shift assignment for hospital staff with google OR-Tools

Notifications You must be signed in to change notification settings

TaroAndMulan/HospitalDoctorScheduling-OR-tools-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hospital Doctor Scheduler

pic1

  • This python script provides a monthly optimal shift assignment for doctors in the hospital.

  • Near the end of each month, doctors submit their availability for the upcoming month, The script then generates an optimal monthly schedules, considering both doctor preferences and hospital requirements.

  • Prior to implementation, it took 2-3 days for hospital staff to finalize a schedule that contained no major conflict. My program solves this scheduling problem within SECONDS and WITHOUT any conflict.

  • See pdf file for hospital requirement

How it works?

Hospital requirements and doctor availability are translated into mathematics equations (constraints), then solved using a constraint programming solver ORTOOLS. This project is inspired by google Nurse Scheduling example.

Here is an example of a constraint saying that doctors are not allow to work both shift on a single day

pic3

Another example, a constraint saything that each doctor should have approximately the same monthly workload

pic2

Most requirement can be turn into contraints like the above examples except the constraint that are not linear. The hard part of this project is thinking about how each hospital requirement can be turn into linear equation.

Example output

Optimal Schedule

pic2

Summary

pic2

Usage

Python requirement: Python 3.10

Package: pip install ortools, pip install termcolor

Excel integration is not included in this repo, you can still run this project manually by editing the first few line in or_all.py to change doctors name, absent list, and etc.

python or_all.py

About

A python script to create a monthly shift assignment for hospital staff with google OR-Tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages