The nurse scheduling (or employee scheduling) problem is a well-known problem in the field of operations research (OR) and can be (approximately) solved efficiently by constrained optimization.
However, the constraints vary significantly across hospitals or wards. Therefore, in practice, the problem is often solved by hand or with the help of Excel, which is really time-consuming. The entire process requires several hours or even more than ten hours, depending on the problem complexity (e.g., multiple wards).
This project (Nurse Scheduling System, or 護理排班系統 in Mandarin) aims to develop a user-friendly web app to automate the nurse scheduling task.
This project is currently a Work in Progress, so it may not function as intended. A preliminary version (or a POC) of a command-line interface is implemented and verified by domain experts under a multi-ward scenario at 2023/08/20. We are currently refactoring the codebase along with test cases to make it more maintainable.
Since I'm not an expert in operations research, I've done some research on suitable (open-source) solvers for this problem. The most popular ones seem to be Timefold (previously OptaPlanner) and Google OR-Tools. There's also a comparison between the two.
Google OR-Tools is chosen due to the support of Python, which is the language I'm most familiar with this kind of project.
We prioritize human readability and ease of editing by hand over machine parsing simplicity.
To allow quick prototyping without defining data type classes, we choose to keep the YAML input intact in memory. This requires extracting data explicitly using utility functions.