Roster Scheduler
Author(s)
- Ramit Ray
Last Updated Date
2025-03-21
SRS References
Version History
| Version | Date | Changes | Author |
|---|---|---|---|
| 1.0 | 2025-03-21 | Initial draft | Ramit Ray |
Feature Overview
Objective:
Automate the creation of employee rosters each week based on predefined shift rotation rules.
Scope:
- The system will automatically generate a new roster every Monday.
- Employees' shifts will rotate in the order: A -> C -> B -> A.
- "Rest Reliever" assignments will remain unchanged.
- The system will support multiple roster tables per designation.
Dependencies:
- Database tables containing employee roster information.
- Shift management system.
Requirements
- Automatically create a new roster every Monday.
- Rotate employee shifts as per the defined pattern.
- Ensure that "Rest Reliever" assignments remain unchanged.
- Support multiple roster tables per designation.
Design Specifications
- Data Models:
public record Roster
{
public Guid RosterId { get; set; }
public string? RosterName { get; init; }
public List<ShiftRoster>? ShiftRosters { get; init; }
public required Guid DesignationId { get; init; }
public required Guid GeoZoneId { get; init; }
public required DateTime RosterStartDate { get; set; }
public DateTime? RosterEndDate { get; set; }
[JsonIgnore]
public List<string>? ListOfEmployees { get; set; }
[JsonIgnore]
public List<EmployeeRestDay>? EmployeesRestDayDetails { get; set; }
}
public record ShiftRoster : EmployeeRestDay
{
public required Guid ShiftId { get; init; }
public required string ShiftName { get; init; }
}
public record EmployeeRestDay
{
public required string EmployeeCode { get; init; }
public required List<Day> RestDays { get; set; }
public string? Remarks { get; init; }
}
public enum Day
{
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
All = 99
}
Workflow:
- Every Monday, a new roster is generated based on the previous week's assignments.
- Employees' shifts are rotated according to the pattern A -> C -> B -> A.
- The system ensures each employee remains assigned to their designated roster table.
Automated Roster Scheduler Implementation
- Initial Manual Roster Creation (Week 1)
- The admin manually creates the first roster for employees.
- Employees are assigned one of the shifts: A, B, C, or Rest Reliever.
- The roster is saved in the database.
- Automated Weekly Roster Creation (From Week 2 Onwards)
- Every Monday, a new roster is generated automatically based on the previous week’s roster.
- The system follows the predefined shift rotation rule:
- A → C → B → A
- Employees with Shift A last week move to Shift C.
- Employees with Shift C last week move to Shift B.
- Employees with Shift B last week move to Shift A.
- Employees in Rest Reliever remain unchanged.
- Roster Generation Steps
Fetch Previous Week’s Roster
- Retrieve all
Rosterrecords for the previous week.
Rotate Shifts Based on Rules
- Apply the rotation rule: A → C → B → A.
- Keep Rest Relievers unchanged.
Save the New Roster
- Create a new roster with the updated shifts.
- Assign a new RosterStartDate (Monday of the current week).
- Store the new roster in the database.
Development Tasks & Estimates
| No | Task Name | Estimate (Hours) | Dependencies | Notes |
|---|---|---|---|---|
| 1 | Implement shift rotation logic | 3 hours | DB structure | |
| 2 | Automate roster generation process | 2 hours | Existing data | |
| 3 | Testing and validation | 1 hours | Test cases | |
| 4 | Total | 6 hours |
Testing & Quality Assurance
-
Unit Tests:
- Verify that shift rotation follows the pattern A -> C -> B -> A.
- Ensure "Rest Reliever" assignments are maintained.
-
Integration Tests:
- Validate database updates for new roster creation.
-
Acceptance Criteria:
- The system generates a new roster every Monday.
- Shift rotations occur as expected.
Deployment Considerations
-
Configuration Changes:
- Ensure database changes are applied before deployment.
-
Rollout Plan:
- Deploy in a test environment first.
- Monitor logs for errors.
- Deploy to production after successful validation.
Risks & Mitigations
| Risk | Impact | Likelihood | Mitigation Strategy |
|---|---|---|---|
| Incorrect shift rotation | High | Medium | Implement unit tests to verify logic |
| Database performance issues | Medium | Medium | Optimize queries, use indexing |
| Roster not generated on time | High | Low | Implement logging and monitoring |
Review & Approval
-
Reviewer:
Ramit Ray -
Approval Date:
(2025-03-21)
Notes
- Additional features like manual override can be planned for future updates.