Refactor gen.py and gen_proc.py to improve shift handling and add constraints; update leave.py to fetch new leave data source.
This commit is contained in:
+6
-2
@@ -4,7 +4,7 @@ import datetime
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from rota_generator.shifts import MaxShiftsPerWeekConstraint, NoWorkers, PostShiftConstraint, PreShiftConstraint, RotaBuilder, SingleShift, WorkerRequirement, days, RotaConstraintOptions
|
||||
from rota_generator.shifts import MaxShiftsPerWeekConstraint, NoWorkers, PostShiftConstraint, PreShiftConstraint, RotaBuilder, SingleShift, WorkerRequirement, days, RotaConstraintOptions, MaxShiftsPerWeekBlockConstraint
|
||||
import typer
|
||||
import subprocess
|
||||
import pandas as pd
|
||||
@@ -404,6 +404,9 @@ def load_workers():
|
||||
previous_shifts=priors_map.get(initial, {}),
|
||||
)
|
||||
|
||||
if initial == "LB":
|
||||
w.start_date = datetime.date(2026, 6, 15)
|
||||
|
||||
#if initial == "L1":
|
||||
# w.oop = [OutOfProgramme(
|
||||
# start_date="2025-09-15",
|
||||
@@ -482,7 +485,7 @@ def main(
|
||||
weeks_to_rota=weeks,
|
||||
balance_offset_modifier=bom,
|
||||
use_previous_shifts=True,
|
||||
name="cons rota feb 2026 run 2",
|
||||
name="cons rota feb 2026 run 5",
|
||||
allow_force_assignment_with_leave_conflict=True,
|
||||
constraint_options=RotaConstraintOptions(
|
||||
balance_weekends=True,
|
||||
@@ -551,6 +554,7 @@ def main(
|
||||
constraints=[
|
||||
PreShiftConstraint(days=1, start_date="2025-11-17", ignore_shifts=["oncall"], exclude_days=("Sat", "Sun")),
|
||||
MaxShiftsPerWeekConstraint(max_shifts=1),
|
||||
MaxShiftsPerWeekBlockConstraint(week_block=3,max_shifts=1)
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user