Scheduling & Rostering
Complete guide to employee scheduling, roster management, shift patterns, and availability constraints in Timesheet.
Scheduling & Rostering
Timesheet provides comprehensive scheduling and rostering capabilities designed for Australian businesses. The system supports complex shift patterns, availability constraints, automatic roster generation, and integration with timesheet tracking.
Overview
The scheduling system includes:
- Roster Management - Create and manage employee rosters
- Shift Patterns - Define recurring shift templates
- Availability Constraints - Employee availability and preferences
- Automatic Scheduling - AI-powered roster generation
- Shift Swaps - Employee-initiated shift exchanges
- Compliance Checking - Award compliance and break rules
Key Features
Flexible Scheduling
- Multiple shift patterns and templates
- Recurring and one-off shifts
- Multi-location scheduling
- Role-based shift assignment
Employee Availability
- Availability preferences and constraints
- Time-off requests and approvals
- Blackout periods and restrictions
- Automatic conflict detection
Roster Automation
- Template-based roster generation
- Demand forecasting integration
- Fair distribution algorithms
- Compliance validation
Integration
- Seamless timesheet integration
- Award compliance checking
- Leave balance integration
- Real-time roster updates
Scheduling Data Structure
Roster Schema
interface IRoster {
employeeId: ObjectId // Reference to Employee
locationId: ObjectId // Reference to Location Category
roleId: ObjectId // Reference to Role Category
shiftDate: Date // Date of shift
startTime: string // Shift start time (HH:MM)
endTime: string // Shift end time (HH:MM)
breakDuration: number // Planned break minutes
status: RosterStatus // Shift status
notes?: string // Shift notes
createdBy: ObjectId // User who created shift
approvedBy?: ObjectId // User who approved shift
templateId?: ObjectId // Reference to shift template
}
type RosterStatus =
| "scheduled" // Shift is scheduled
| "confirmed" // Employee confirmed attendance
| "completed" // Shift completed with timesheet
| "no_show" // Employee didn't attend
| "cancelled" // Shift cancelledShift Template Schema
interface IShiftTemplate {
name: string // Template name
locationId: ObjectId // Location for shifts
roleId: ObjectId // Role for shifts
startTime: string // Default start time
endTime: string // Default end time
breakDuration: number // Default break minutes
daysOfWeek: number[] // Days template applies (0=Sunday)
effectiveFrom: Date // Template start date
effectiveTo?: Date // Template end date
isActive: boolean // Template status
}Availability Constraint Schema
interface IAvailabilityConstraint {
employeeId: ObjectId // Reference to Employee
type: ConstraintType // Type of constraint
dayOfWeek?: number // Day constraint (0=Sunday)
startTime?: string // Time constraint start
endTime?: string // Time constraint end
startDate?: Date // Date range start
endDate?: Date // Date range end
isRecurring: boolean // Weekly recurring constraint
priority: number // Constraint priority (1-10)
reason?: string // Constraint reason
}
type ConstraintType =
| "available" // Employee is available
| "unavailable" // Employee is not available
| "preferred" // Employee prefers this time
| "avoid" // Employee prefers to avoidRoster Management
Creating Rosters
Manual Roster Creation
Administrators can create rosters manually:
POST /api/rosters
Content-Type: application/json
{
"employeeId": "employee_object_id",
"locationId": "location_object_id",
"roleId": "role_object_id",
"shiftDate": "2024-01-15",
"startTime": "09:00",
"endTime": "17:00",
"breakDuration": 30,
"notes": "Training shift for new employee"
}Template-Based Creation
Use shift templates for recurring schedules:
POST /api/rosters/from-template
Content-Type: application/json
{
"templateId": "template_object_id",
"employeeIds": ["emp1", "emp2", "emp3"],
"startDate": "2024-01-15",
"endDate": "2024-01-21",
"overrides": {
"2024-01-17": {
"startTime": "10:00",
"endTime": "18:00"
}
}
}Bulk Roster Generation
Generate rosters for multiple employees and dates:
POST /api/rosters/bulk-generate
Content-Type: application/json
{
"locationId": "location_object_id",
"startDate": "2024-01-15",
"endDate": "2024-01-21",
"shiftRequirements": [
{
"roleId": "role_object_id",
"requiredStaff": 3,
"shiftPattern": {
"startTime": "09:00",
"endTime": "17:00",
"daysOfWeek": [1, 2, 3, 4, 5]
}
}
],
"preferences": {
"distributeEvenly": true,
"respectAvailability": true,
"minimiseOvertime": true
}
}Roster Status Management
Status Workflow
graph TD
A[Scheduled] --> B[Confirmed]
A --> C[Cancelled]
B --> D[Completed]
B --> E[No Show]
C --> F[Rescheduled]
F --> AStatus Updates
PATCH /api/rosters/{rosterId}
Content-Type: application/json
{
"status": "confirmed",
"notes": "Employee confirmed attendance via mobile app"
}Roster Approval Workflow
Approval Process
- Draft Creation - Manager creates draft roster
- Employee Review - Employees review assigned shifts
- Feedback Period - Employees can request changes
- Manager Approval - Final roster approval
- Publication - Roster published to employees
Approval API
POST /api/rosters/{rosterId}/approve
Content-Type: application/json
{
"approvedBy": "manager_user_id",
"approvalNotes": "Roster approved for week commencing 15/01/2024"
}Shift Patterns
Pattern Types
Fixed Patterns
Regular, repeating shift schedules:
- 9-5 Weekdays - Monday to Friday, 9:00 AM to 5:00 PM
- Weekend Shifts - Saturday and Sunday shifts
- Night Shifts - Evening and overnight shifts
- Split Shifts - Multiple shifts per day
Rotating Patterns
Shifts that rotate between employees:
- Weekly Rotation - Different shift each week
- Monthly Rotation - Different shift each month
- Seasonal Patterns - Shifts change by season
Flexible Patterns
Variable shifts based on demand:
- Demand-Based - Shifts created based on forecasted demand
- Employee-Driven - Employees choose from available shifts
- Hybrid Approach - Combination of fixed and flexible
Pattern Configuration
Creating Shift Templates
POST /api/shift-templates
Content-Type: application/json
{
"name": "Standard Weekday Shift",
"locationId": "location_object_id",
"roleId": "role_object_id",
"startTime": "09:00",
"endTime": "17:00",
"breakDuration": 30,
"daysOfWeek": [1, 2, 3, 4, 5],
"effectiveFrom": "2024-01-01",
"isActive": true
}Pattern Rules
- Minimum Rest - Minimum hours between shifts
- Maximum Hours - Maximum hours per day/week
- Consecutive Days - Maximum consecutive working days
- Break Requirements - Mandatory break periods
Advanced Patterns
Split Shifts
Shifts with breaks longer than standard meal breaks:
{
"name": "Split Shift - Restaurant",
"shifts": [
{
"startTime": "11:00",
"endTime": "14:00",
"breakDuration": 0
},
{
"startTime": "17:00",
"endTime": "22:00",
"breakDuration": 15
}
],
"totalBreakBetween": 180
}On-Call Shifts
Shifts where employees are on standby:
{
"name": "On-Call Weekend",
"type": "on_call",
"startTime": "18:00",
"endTime": "08:00",
"calloutRate": 2.0,
"minimumCallout": 3,
"availability": "phone_contact"
}Employee Availability
Availability Types
Regular Availability
Standard weekly availability patterns:
POST /api/availability-constraints
Content-Type: application/json
{
"employeeId": "employee_object_id",
"type": "available",
"dayOfWeek": 1,
"startTime": "09:00",
"endTime": "17:00",
"isRecurring": true,
"priority": 8
}Time-Off Requests
Specific dates when employee is unavailable:
POST /api/availability-constraints
Content-Type: application/json
{
"employeeId": "employee_object_id",
"type": "unavailable",
"startDate": "2024-01-15",
"endDate": "2024-01-19",
"isRecurring": false,
"reason": "Annual leave - family holiday",
"priority": 10
}Preferences
Employee shift preferences:
POST /api/availability-constraints
Content-Type: application/json
{
"employeeId": "employee_object_id",
"type": "preferred",
"dayOfWeek": 6,
"startTime": "10:00",
"endTime": "18:00",
"isRecurring": true,
"reason": "Prefers Saturday shifts",
"priority": 5
}Availability Management
Employee Self-Service
Employees can manage their own availability:
- Mobile App - Update availability on mobile devices
- Web Portal - Full availability management interface
- Bulk Updates - Set availability for multiple weeks
- Template Application - Apply availability templates
Manager Override
Managers can override employee availability:
- Business Needs - Override for critical shifts
- Approval Required - Employee notification and approval
- Audit Trail - Complete record of overrides
- Compensation - Additional pay for overrides
Conflict Resolution
Automatic Detection
System automatically detects scheduling conflicts:
- Double Booking - Employee scheduled for overlapping shifts
- Availability Conflicts - Shifts outside available hours
- Rest Period Violations - Insufficient rest between shifts
- Maximum Hours - Exceeding daily/weekly hour limits
Resolution Strategies
- Priority-Based - Higher priority constraints take precedence
- Manager Review - Flag conflicts for manual resolution
- Alternative Suggestions - Suggest alternative employees/times
- Automatic Rescheduling - Move shifts to resolve conflicts
Automatic Scheduling
Scheduling Algorithms
Fair Distribution
Ensure equitable shift distribution:
- Hour Balancing - Equal hours across employees
- Shift Type Distribution - Fair mix of desirable/undesirable shifts
- Weekend Rotation - Rotate weekend responsibilities
- Holiday Fairness - Equitable holiday shift distribution
Demand Matching
Match staffing to predicted demand:
- Historical Data - Use past data to predict requirements
- Seasonal Adjustments - Account for seasonal variations
- Event-Based - Special events and promotions
- Real-Time Adjustments - Adjust based on current trends
Constraint Satisfaction
Respect all scheduling constraints:
- Hard Constraints - Must be satisfied (availability, legal limits)
- Soft Constraints - Preferred but can be violated (preferences)
- Weighted Optimization - Balance multiple objectives
- Iterative Improvement - Continuously improve schedules
Auto-Generation Process
Step 1: Requirement Analysis
POST /api/scheduling/analyze-requirements
Content-Type: application/json
{
"locationId": "location_object_id",
"startDate": "2024-01-15",
"endDate": "2024-01-21",
"includeHistoricalData": true,
"considerSeasonality": true
}Step 2: Employee Pool Selection
POST /api/scheduling/select-employees
Content-Type: application/json
{
"locationId": "location_object_id",
"roleIds": ["role1", "role2"],
"dateRange": {
"start": "2024-01-15",
"end": "2024-01-21"
},
"includeAvailability": true,
"includePreferences": true
}Step 3: Schedule Generation
POST /api/scheduling/generate
Content-Type: application/json
{
"requirements": {...},
"employeePool": [...],
"constraints": [...],
"objectives": {
"fairDistribution": 0.8,
"demandMatching": 0.9,
"employeePreferences": 0.6,
"costMinimization": 0.7
}
}Step 4: Optimization
POST /api/scheduling/optimize
Content-Type: application/json
{
"scheduleId": "generated_schedule_id",
"iterations": 1000,
"improvementThreshold": 0.01
}Shift Swaps
Swap Process
Employee-Initiated Swaps
Employees can request shift swaps:
POST /api/shift-swaps
Content-Type: application/json
{
"originalShiftId": "roster_object_id",
"requestedEmployeeId": "employee_object_id",
"reason": "Family commitment on original shift date",
"offerCompensation": false
}Manager-Approved Swaps
Managers can approve or deny swap requests:
PATCH /api/shift-swaps/{swapId}
Content-Type: application/json
{
"status": "approved",
"managerNotes": "Swap approved - both employees qualified for shifts",
"approvedBy": "manager_user_id"
}Swap Rules and Validation
Eligibility Checks
- Role Compatibility - Both employees qualified for swapped shifts
- Availability - Employees available for swapped times
- Hour Limits - Swap doesn't violate maximum hour rules
- Rest Periods - Adequate rest between shifts maintained
Approval Workflow
- Employee Request - Initial swap request
- Peer Acceptance - Target employee accepts swap
- Manager Review - Manager approves/denies swap
- System Update - Roster automatically updated
- Notifications - All parties notified of outcome
API Endpoints
Roster Management
Get Rosters
GET /api/rosters?startDate=2024-01-15&endDate=2024-01-21&locationId=123Query Parameters:
startDate- Start date for roster queryendDate- End date for roster queryemployeeId- Filter by specific employeelocationId- Filter by locationroleId- Filter by rolestatus- Filter by roster status
Response:
{
"rosters": [
{
"id": "roster_id",
"employee": {
"id": "employee_id",
"name": "John Smith",
"pin": "1001"
},
"location": {
"id": "location_id",
"name": "Head Office"
},
"role": {
"id": "role_id",
"name": "Manager"
},
"shiftDate": "2024-01-15",
"startTime": "09:00",
"endTime": "17:00",
"breakDuration": 30,
"status": "scheduled",
"notes": "Regular shift"
}
],
"total": 50,
"summary": {
"totalHours": 400,
"totalShifts": 50,
"employeeCount": 10
}
}Create Roster Entry
POST /api/rosters
Content-Type: application/json
{
"employeeId": "employee_object_id",
"locationId": "location_object_id",
"roleId": "role_object_id",
"shiftDate": "2024-01-15",
"startTime": "09:00",
"endTime": "17:00",
"breakDuration": 30
}Availability Management
Get Employee Availability
GET /api/employees/{employeeId}/availability?startDate=2024-01-15&endDate=2024-01-21Update Availability
POST /api/availability-constraints
Content-Type: application/json
{
"employeeId": "employee_object_id",
"type": "available",
"dayOfWeek": 1,
"startTime": "09:00",
"endTime": "17:00",
"isRecurring": true
}Shift Templates
List Templates
GET /api/shift-templates?locationId=123&roleId=456Create Template
POST /api/shift-templates
Content-Type: application/json
{
"name": "Standard Day Shift",
"locationId": "location_object_id",
"roleId": "role_object_id",
"startTime": "09:00",
"endTime": "17:00",
"breakDuration": 30,
"daysOfWeek": [1, 2, 3, 4, 5]
}Best Practices
Roster Planning
- Advance Notice - Provide rosters 2-4 weeks in advance
- Consistency - Maintain consistent shift patterns where possible
- Flexibility - Allow for employee preferences and life balance
- Communication - Clear communication of roster changes
Employee Engagement
- Self-Service - Enable employee self-service for availability
- Feedback - Regular feedback on scheduling preferences
- Fairness - Ensure equitable distribution of shifts
- Transparency - Clear scheduling policies and procedures
Compliance Management
- Award Rules - Ensure compliance with modern award requirements
- Rest Periods - Maintain adequate rest between shifts
- Maximum Hours - Monitor and prevent excessive working hours
- Documentation - Maintain records for compliance auditing
System Optimization
- Regular Review - Review and optimize scheduling algorithms
- Data Analysis - Analyze scheduling patterns and outcomes
- Performance Monitoring - Monitor system performance and user satisfaction
- Continuous Improvement - Regularly update based on feedback
Troubleshooting
Common Issues
Scheduling Conflicts
- Double Booking - Check for overlapping shift assignments
- Availability Violations - Verify employee availability constraints
- Role Mismatches - Ensure employees are qualified for assigned roles
- Hour Limit Breaches - Check daily/weekly hour calculations
Auto-Generation Problems
- No Valid Solutions - Relax constraints or increase employee pool
- Poor Quality Schedules - Adjust algorithm weights and objectives
- Performance Issues - Optimize constraint complexity
- Incomplete Schedules - Check requirement specifications
Employee Complaints
- Unfair Distribution - Review fairness algorithms and metrics
- Preference Violations - Check preference weights and priorities
- Communication Issues - Improve notification and feedback systems
- Change Management - Better change communication processes
Next Steps
- Roster Management - Detailed roster creation and management
- Shift Patterns - Advanced shift pattern configuration
- Availability - Employee availability and constraint management