The Physician Task Scheduler is a Python-based application designed to manage and schedule tasks for physicians. It ensures that tasks are assigned based on physician availability, preferences, and task requirements.
- Task Management: Define and manage different categories of tasks.
- Physician Management: Add and manage physician profiles, including their preferences and availability.
- Scheduling: Automatically generate schedules based on defined tasks and physician availability.
- Conflict Checking: Identify and resolve scheduling conflicts.
- Statistics: Generate statistics on physician workloads and task assignments.
- Export: Save schedules to JSON and generate iCalendar files.
- Clone the repository:
git clone https://github.com/yourusername/physician-task-scheduler.git cd physician-task-scheduler
- Install the required dependencies:
pip install -r requirements.txt
-
Initialize Managers:
from config.managers import TaskManager, PhysicianManager from models.calendar import Calendar from models.schedule import Schedule from datetime import date task_manager = TaskManager() physician_manager = PhysicianManager(task_manager)
-
Add Task Categories and Tasks:
from models.task import TaskCategory, Task, TaskDaysParameter ctu_category = TaskCategory( name="CTU", days_parameter=TaskDaysParameter.MULTI_WEEK, number_of_weeks=2, weekday_revenue=2000, call_revenue=4000, restricted=False ) task_manager.add_category(ctu_category) task_manager.add_task(Task.create(ctu_category, 'Main', 'CTU_A', heaviness=4))
-
Link Tasks:
task_manager.link_tasks('CTU_A', 'CTU_AB_CALL')
-
Add Physicians:
from models.physician import Physician john_doe = Physician("John", "Doe", ["CTU", "ER"], True, 0.75, ["CTU"], ["CTU"]) physician_manager.add_physician(john_doe) # Set Unavailability: unavailability_periods = { "John Doe": [ (date(2023, 1, 1), date(2023, 1, 7)), # Jan 1-7 date(2023, 1, 9), # Jan 9 ] } physician_manager.set_unavailability_periods(unavailability_periods)
-
Create Calendar:
start_date = date(2023, 1, 1) end_date = date(2023, 1, 31) region = 'Canada/QC' calendar = Calendar.create_calendar(start_date, end_date, region) # Add Holidays: calendar.add_holiday(date(2023, 1, 2)
-
Generate Schedule:
schedule = Schedule(physician_manager, task_manager, calendar) schedule.set_scheduling_period(start_date, end_date) schedule.generate_schedule() schedule.print_schedule() # Save/Load Schedule: schedule.save_schedule("schedule.json") schedule.load_schedule("schedule.json") # Export to ICS: schedule.generate_ics_calendar("schedule.ics"
-
Save and Load Configurations:
task_manager.save_config("task_config.json") physician_manager.save_config("physician_config.json") calendar.save_calendar("calendar.json")
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License.
- TaskCategory: Represents a category of tasks with shared properties and behaviors.
- Task: Represents an individual task instance, automatically created based on category settings.
- LinkageManager: Manages the linkage of tasks.
- Physician: Represents a physician profile with attributes like name, preferred tasks, and availability.
- Calendar: Represents a scheduling calendar with methods to load holidays, determine periods, and save/load calendar state.
- ConfigurableManager: Base class for managing configurations.
- TaskManager: Manages task categories and tasks.
- PhysicianManager: Manages physician profiles and their availability.
- Initializes and configures the
TaskManager
andPhysicianManager
. - Adds task categories, tasks, and physicians.
- Creates a calendar and generates a schedule.
- Saves and loads configurations.
- Placeholder for dynamic utility functions (to be fetched via API).
- Fix the scheduling algorithm
- Calls should always follow main tasks if those are linked
- For CTU (tasks of two weeks), the linked call should occur between the two 'main' periods
- Allocation score must be reviewed:
- There are some elements that should always
- Add additional elements in decision rule:
- task.is_mandatory (parameter should be included)
- Add discontinuity principle
- Break main period and call tasks if multiple physicians with this preference.
This feature provides detailed statistics for each physician based on the current schedule. It allows you to analyze the distribution of tasks and workload.
To retrieve statistics:
# Retrieve scheduling statistics for each physician
stats = schedule.get_statistics()
# Print statistics for each physician
for physician, stat in stats.items():
print(f"{physician}: {stat}")
This feature lists tasks that have not been assigned to any physician. It helps identify scheduling gaps and ensures all tasks are allocated.
To get unassigned tasks:
# Retrieve unassigned tasks
unassigned_tasks = schedule.get_unassigned_tasks()
# Print each unassigned task
for task in unassigned_tasks: print(task)