The Rule Builder lets you choose exactly which shifts a rule applies to. Without it, every rule would affect every shift. With it, one rule can apply only to night shifts, another only to weekends, and another only to Pediatrics.
When a schedule is generated, YouShift checks each shift against your conditions. Only matching shifts are included in the rule.
How it works
A rule's shifts are defined with one or more expressions. Each expression combines filters (what to look for) with operators (how the filters relate).
Choose a filter from one of the tabs.
Drag it into the expression area, or click it to add it.
Add more filters if needed, connecting them with operators.
Click View matching shifts, where available, to check the result before saving.
Filters
Filter | What it targets | Examples |
Sections | Where the shift takes place: departments, clinics, hospitals. | Pediatrics, Emergency Department, ICU |
Labels | What kind of shift it is. A shift can have several labels. | Day, Night, Weekend, Holiday |
Time & Dates | When the shift takes place: day, start time, length, dates. | Monday shifts, shifts starting after 6:00 PM, shifts over 12 hours |
Advanced | Recurring patterns or custom attributes. | Even or odd weeks, first week of the month, custom counters |
Tip: There's often more than one way to build an expression. For weekend shifts, use the day of the week (Saturday Or Sunday) or, if your shifts have one, the Weekend label.
Operators
Operator | Meaning | Example |
And | Must match every condition. | Pediatrics And Night = night shifts in Pediatrics only |
Or | Can match any condition. | Pediatrics Or Emergency = every shift in either section |
EXCLUDE | Removes shifts from the selection. | Night EXCLUDE Holiday = night shifts, except holidays |
( ) | Groups conditions. | (Pediatrics Or Emergency) And Night |
Multiple expressions
Click Add another expression to add a separate group of shifts. It works like putting Or between two expressions, but keeps each group readable.
Example: Expression 1 = Pediatrics And Night, Expression 2 = Emergency And Weekend. The rule applies to both groups.
How much someone works
How much someone works
Monthly / weekly limit
Description: Cap or guarantee how much someone works each week, month, or year.
The Monthly / weekly limit rule sets the minimum and maximum work someone is assigned in a period that repeats. For example, no more than 40 hours a week, 3 night shifts a month, or 100 shifts a year. Measure it in hours, shifts, or custom counters.
How the period changes the rule
Period | How it's evaluated | Best for |
Weekly, every two weeks, monthly, personalized | Each period on its own. The count resets every period. | Controlling short-term workload |
Yearly | A running total across the year. Low periods can be made up later. | Annual contracts |
Example: A physician has a yearly target of 2,000 hours. If they work only 120 hours in July because of vacation, the engine spreads the missing hours over the following months.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates. Use a clear name, such as Max 40 hours per week.
Step 2: Select the rule period
Choose Weekly, Every two weeks, Monthly, Yearly, or Personalized. Check the calendar preview to confirm the periods match your scheduling cycle. Click a week in the calendar to adjust or remove it.
Step 3: Define where the rule applies
Use the Rule Builder to choose which shifts count toward the limit. For example, Night counts only night shifts.
Step 4: Select the measurement unit
Choose Hours, Shifts, or Custom counters.
Step 5: Configure user requirements
Add the users the rule applies to. For each user, set:
Min: The least work they should get each period.
Max: The most work they can get each period.
Priority: How strictly the limit is enforced.
Visibility: What the user sees about the rule.
Click Finish to save.
Example result: Period = Weekly, Shifts = All shifts, Unit = Hours, Max = 40. No user is scheduled for more than 40 hours in any week.
FAQ
Yearly or monthly for an annual contract?
Yearly. A monthly limit can't make up hours missed in an earlier month.
Can I combine a weekly and a yearly limit?
Yes. Create one rule for each, such as a 50-hour weekly maximum and a 2,000-hour yearly target.
Can I set only a maximum?
Yes. Set the minimum to 0.
Rest & recovery
Rest & recovery
Rule | Applies when | Blocks |
Rest after demanding shifts | After one trigger shift | Shifts for a set time |
Protected rest | Every repeating period | Guarantees whole blocks of time off |
Shifts once a streak is reached | As soon as a run reaches its length | Shifts for a set time |
Rest once a streak ends | When a run finishes | Whole days |
Rest after demanding shifts
Description: Block shifts for a set time after a demanding one, such as a night shift.
After someone works a shift you choose, this rule blocks certain shifts for a set time window, measured from the end of that shift. It helps reduce fatigue and enforce rest policies.
Example: After a night shift, a physician can't work any shift for the next 24 hours.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as 24 hours off after a night shift.
Step 2: Define the trigger and affected shifts
When (trigger shifts): The shifts that start the rest period, such as all night shifts.
Then (affected shifts): The shifts the user can't work during it, such as all shifts.
Use the Rule Builder on each side and click View matching shifts to check them.
Step 3: Configure the rest period
Units: Hours, days, or weeks.
After: How long to wait after the trigger shift ends. Enter 0 to start immediately.
For the next: How long the restriction lasts.
The visual timeline shows which affected shifts fall inside the window.
Step 4: Users selection
Click Add users, then set each user's Priority and Visibility. Click Finish to save.
Example result: Trigger = Night, Affected = All shifts, After = 0, For the next = 24 hours. After any night shift, the user gets no shifts for 24 hours.
FAQ
How is this different from Shifts once a streak is reached?
This rule applies after a single shift. The streak rule only applies after several days in a row.
Protected rest
Description: Guarantee complete blocks of time off, such as a full weekend each month.
This rule makes sure every user gets a minimum number of complete, uninterrupted blocks of time off in each repeating period. It works with rest period types, blocks of time off you define in advance, such as a full weekend.
Example: Every physician gets one long weekend off each month, from Friday 5:00 PM to Monday 7:00 AM.
Before you begin: Create at least one rest period type (Part 1). The rule is grayed out in the library until you do.
Part 1: Create a rest period type
Go to Group settings › Advanced › Rest period types and click to create one.
Name: For example, Golden Weekend.
Start and end time: If the end is earlier than the start, it falls the next day (+1d). Use +24h and -24h to add or remove days. For Friday 5:00 PM to Monday 7:00 AM: set 5:00 PM to 7:00 AM, then click +24h twice (62 hours).
Select dates: Choose the days the rest period can start. Tick a weekday at the top of the calendar to select it all year, such as F for every Friday.
Click Create.
Part 2: Configure the rule
Rule details: Name, start date, end date, such as One Golden Weekend per month.
Duration of periods: Weekly, every two weeks, every 15 days, monthly, quarterly, or yearly. Each period is evaluated on its own.
Rest periods: In the Rule Builder's Filters tab, pick your rest period type under Rest period types.
Measurement unit: Rest periods (count whole blocks) or Hours.
User requirements: Add users and set Min, Max, a priority for each, and Visibility. Click Finish.
Example result: Golden Weekend, Monthly, Rest periods, Min = 1. Every month, each user gets at least one full weekend off.
FAQ
Does unused rest carry over?
No. Each period is evaluated on its own.
Shifts once a streak is reached
Description: Block certain shifts as soon as someone works a set number of days in a row.
Once a run of trigger shifts reaches the length you set, this rule blocks the shifts you choose for a set time. It fires as soon as the streak is reached, even if the run continues.
Example: After 3 nights in a row, no morning shifts for the next 24 hours.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as No mornings after 3 nights in a row.
Step 2: Define the shifts the rule looks at
When (trigger shifts): The shifts that build the streak, such as Night.
Then (affected shifts): The shifts blocked once the streak is reached, such as Morning.
Step 3: Set the time window
Units: Hours, days, or weeks.
Quick options: Next 12 hours, Next 24 hours, or After 24 hours for the next 48 hours.
Trigger streak: Consecutive days needed to activate the rule.
After: Delay before the window starts. 0 = immediately.
For the next: How long the window lasts.
The window is measured from the end of the shift that completes the streak. A shift is blocked only if it starts inside the window.
Step 4: Users selection
Click Add users, then set each user's Priority and Visibility. Click Finish to save.
Example result: Trigger = Night, Affected = Morning, Streak = 3 days, After = 0, For the next = 24 hours. After a user's 3rd night in a row, they get no morning shift that starts in the next 24 hours.
FAQ
How is this different from Rest once a streak ends?
This rule fires when the streak is reached and blocks hours. Rest once a streak ends waits for the run to finish and blocks whole days.
Rest once a streak ends
Description: Keep whole days clear after a run of shifts ends.
This rule waits for a run of trigger shifts to finish, then keeps the shifts you choose clear for a number of whole days after the last one. However long the run lasts, the rest starts after its final shift.
Example: After 2 or more nights in a row, the 3 days after the final night are clear.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as 3 days off after 2+ nights.
Step 2: Define the shifts the rule looks at
When (trigger shifts): The shifts that build the streak, such as Night.
Then (affected shifts): The shifts kept clear afterward, such as All shifts.
Step 3: Set the time window
Minimum streak length (days): The fewest consecutive days needed. Longer runs count too. Set 1 to apply after any single shift.
Days off: Whole days kept clear after the last shift.
For overnight shifts, the days off count from the day the shift ends.
Step 4: Users selection
Click Add users, then set each user's Priority and Visibility. Click Finish to save.
Example result: Trigger = Night, Affected = All shifts, Minimum streak = 2, Days off = 3. After 2 or more nights in a row, the user gets no shifts for 3 days.
FAQ
When do the days off start after a night shift?
From the day it ends. After a Monday 7:00 PM to Tuesday 7:00 AM shift, they count from Tuesday.
Where someone can work
Where someone can work
Rule | Blocks | Leaves open |
Can't work these shifts | The shifts you choose | Everything else |
Can only work these shifts | Everything else | The shifts you choose |
Neither rule assigns shifts. To make sure someone always works a shift, use Fixed recurring assignment.
Can't work these shifts
Description: Keep specific people off certain shifts, days, or sections.
This rule keeps selected users off specific shifts. It reflects contract terms, personal arrangements, qualifications, or site restrictions.
Example: Dr. López has an agreement not to work weekends, so she's never assigned a weekend shift.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as Dr. López – No weekends.
Step 2: Shifts in which it applies
Use the Rule Builder to choose the shifts the users can't work. For example, Weekend for no weekends, or Weekend And Night for no weekend nights.
Step 3: Excluded users
Click Add users and search by name or role, or click Add everyone next to a role. Set each user's priority: Mandatory (the default) means the restriction always holds. A lower level lets the engine weigh it against other rules.
Click Finish to save.
Example result: Shifts = Weekend, User = Dr. López, Priority = Mandatory. Dr. López is never assigned a weekend shift.
FAQ
Can different users have different blocked shifts in one rule?
No. Create a separate rule for each set of shifts.
What if this conflicts with another rule?
Contradicting rules, such as a fixed recurring assignment on a blocked shift, can make a valid schedule impossible. Review your rules so they don't conflict.
Can only work these shifts
Description: Restrict someone to a specific set of shifts.
This rule limits selected users to the shifts you choose. Every other shift is off-limits for them. Combine conditions to make it precise.
Example: A physician can only work weekend shifts in the emergency room.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as Dr. García – Weekends in the ER only.
Step 2: Shifts in which it applies
Use the Rule Builder to choose the only shifts the users can work:
And narrows: a shift must match every condition. Weekend And Emergency Room = weekend ER shifts only.
Or widens: a shift can match any condition. Weekend Or Emergency Room = every weekend shift plus every ER shift.
EXCLUDE removes shifts. Night EXCLUDE Holiday = nights, except holidays.
Another example: Morning And Thursday = Thursday mornings only.
Step 3: Users this rule applies to
Click Add users and search by name or role, or click Add everyone next to a role. Set each user's priority: Mandatory means they're only ever assigned these shifts.
Click Finish to save.
Example result: Shifts = Morning And Thursday, User = Dr. García, Priority = Mandatory. Dr. García only works Thursday mornings.
FAQ
Does this rule guarantee the user gets these shifts?
No. It only limits eligibility. Use Fixed recurring assignment to guarantee a shift.
Can different users have different shifts in one rule?
No. Create a separate rule for each set of shifts.
Shift patterns
Shift patterns
Days in a row
Description: Set the minimum and maximum number of consecutive working days.
This rule controls how long each run of consecutive working days can be. A minimum avoids isolated single days; a maximum prevents too many days back-to-back.
Example: Physicians work in runs of 2 to 4 days.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as Between 2 and 4 days in a row.
Step 2: Shifts in which it applies
Use the Rule Builder to choose which shifts count. A day counts as worked if the user has at least one of them. All shifts limits any working day; Night limits consecutive nights only.
Step 3: Consecutive days requirements
Click Add users. For each user, set:
Min: Fewest days in a row per run. 0 = no minimum.
Max: Most days in a row.
Priority: Set separately for Min and Max.
Visibility: What the user sees.
Each user can have different values. Click Finish to save.
Example result: All shifts, Min = 2, Max = 4. Every run lasts 2 to 4 days.
FAQ
How is this different from the streak rest rules?
Days in a row limits how long a run can be. The streak rules block shifts after a run reaches a length or ends.
Shifts that go together
Description: Link shifts so the same person works both.
This rule links two sets of shifts so the same user works both. When a user is assigned a trigger shift, the engine also assigns them the linked shift if it falls within the time window.
Example: Whoever works Friday night also works Saturday night.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as Friday and Saturday nights together.
Step 2: Define the shifts
When (trigger shifts): The shifts that start the rule, such as Friday night.
Then (affected shifts): The shifts that go to the same user, such as Saturday night.
Click View matching shifts to check each side.
Step 3: Set the time window
After: Delay after the trigger shift ends. 0 = immediately.
For the next: How long the rule looks for linked shifts.
A linked shift counts only if it starts inside the window.
Step 4: Duration of periods
Choose Weekly, Every two weeks, Monthly, or Personalized.
Step 5: Configure user requirements
Click Add users and set each user's Min and Max linked shifts per period, Priority, and Visibility. Click Finish to save.
Example result: Trigger = Friday afternoon, Affected = Friday night, After = 0, For the next = 12 hours. The trigger ends at 8:00 PM, so a night shift starting at 11:00 PM goes to the same user. A shift at 9:00 AM the next day doesn't.
Fixed recurring assignment
Description: Lock a person into a shift that repeats every scheduling period.
This rule assigns users to a fully defined shift (who, when, and where) every time it comes up. The engine places it automatically and builds the rest of the schedule around it.
Example: A physician always works the weekend morning shift at Park City ED.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as Dr. Smith – Weekend mornings at Park City.
Step 2: User
Search for users, select a whole role, or click Select all. Every selected user gets the same assignment; users who need different shifts need a separate rule.
Step 3: Shifts in which it applies
Combine filters with And to narrow down to one shift, such as Morning And Park City ED And Weekend. Check the Shifts that match calendar: every highlighted shift is assigned automatically.
Step 4: Review and confirmation
Check the users, period, and shifts, then click Finish.
Example result: Dr. Smith is automatically assigned every weekend morning shift at Park City ED for the rule's dates.
FAQ
What if the expression selects too many shifts?
The user gets all of them. Narrow it with And until the preview shows only what you want.
What if the user has time off?
Time off takes priority. The assignment isn't placed on days off.
What if it conflicts with another rule?
Contradicting rules can make a valid schedule impossible. Review your rules so they don't conflict.
Rotation
Description: Set up a repeating on/off pattern where blocks of providers take turns.
This rule sets a repeating pattern of days on and days off. Providers are grouped into blocks that take turns covering the shifts you choose, handing over on a set day.
Example: A hospitalist works 7 days on, then 7 days off.
Before you begin: The shifts must exist with their staffing need set. The preview compares planned providers against it.
Step 1: Pattern
Pick a preset, such as 7 on / 7 off or Mon–Fri, or Custom to set your own. Set the First day: Block A starts then, and its weekday becomes the handover day. The End date is optional. The Next 4 weeks preview shows each block's days on.
Step 2: Shifts
Pick the shifts the providers work on their days on. Use the Section and Time range filters to find them.
Step 3: Providers
Click Add provider under each block. You can leave spots open and fill them later. The preview flags gaps or overstaffing.
Step 4: Review
Check the pattern, start date, shifts, and blocks. Keep or change the suggested Rule name, add a description, and click Create rotation.
Example result: 7 on / 7 off from a Friday, Day shift, Block A = Physician 1, Block B = Physician 2. They alternate weeks, handing over every Friday.
FAQ
How do I change the handover day?
Pick a first day on that weekday. For Monday handovers, start on a Monday.
Can a block have several providers?
Yes. Add as many as the shifts need.
Who works together
Who works together
Rule | Controls |
Keep groups apart | Whether two groups can share a shift at all |
Team composition per shift | How many people from one group can, or must, be on a shift |
Keep groups apart
Description: Stop two groups of people from sharing a shift.
This rule keeps users in one group off the same shifts as users in another. It helps keep the right mix of experience on each shift.
Example: Residents and interns never work the same shift.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as No residents and interns on the same shift.
Step 2: Shifts in which it applies
Use the Rule Builder to choose where the groups stay apart: All shifts everywhere, or Night for overnight only.
Step 3: Groups settings
Priority of incompatibility between groups: How strictly the rule is enforced.
Visibility: Visible with requirements, Visible, or Hidden.
Group A and Group B: Click Add users under each. Every rule has exactly two groups, each with one or more users.
Click Finish to save.
Example result: All shifts, Group A = Residents, Group B = Interns. A resident and an intern are never on the same shift.
FAQ
Can people in the same group work together?
Yes. The rule only keeps Group A apart from Group B.
Can I keep three groups apart?
Each rule has two groups. Create one rule for each pair.
Team composition per shift
Description: Control how many people from a group can, or must, be on a shift.
This rule sets the minimum and maximum number of users from one group on each shift. It helps guarantee supervision and avoid stacking one role on a shift.
Example: At least 1 attending on every shift.
Before you begin: Configure the required shifts, labels and sections in the configuration tab.
Step 1: Rule details
Enter the rule name, an optional description, and the start and end dates, such as At least 1 attending per shift.
Step 2: Shifts in which it applies
Use the Rule Builder to choose where the limits apply: All shifts, or Night for overnight only.
Step 3: Group settings
Min. simultaneous: Fewest users from the group per shift. 0 = no minimum.
Max. simultaneous: Most users from the group per shift.
Priority: Set separately for each limit.
Visibility: Visible with requirements, Visible, or Hidden.
Users: Click Add users to build the group.
Click Finish to save.
Example result: Night, Group = Residents, Min = 0, Max = 2. No night shift has more than two residents.
FAQ
How do I set limits for attendings and residents?
Create one rule per group.
What if the minimum is higher than the shift's staffing need?
The conflict is resolved by priority: the higher-priority requirement wins.
