Skip to main content
Version: MNSR

Roster Scheduler

Author(s)

  • Ramit Ray

Last Updated Date

2025-03-21


SRS References


Version History

VersionDateChangesAuthor
1.02025-03-21Initial draftRamit 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

  1. Automatically create a new roster every Monday.
  2. Rotate employee shifts as per the defined pattern.
  3. Ensure that "Rest Reliever" assignments remain unchanged.
  4. 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:

  1. Every Monday, a new roster is generated based on the previous week's assignments.
  2. Employees' shifts are rotated according to the pattern A -> C -> B -> A.
  3. The system ensures each employee remains assigned to their designated roster table.

Automated Roster Scheduler Implementation

  1. 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.
  1. 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.
  1. Roster Generation Steps

Fetch Previous Week’s Roster

  • Retrieve all Roster records 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

NoTask NameEstimate (Hours)DependenciesNotes
1Implement shift rotation logic3 hoursDB structure
2Automate roster generation process2 hoursExisting data
3Testing and validation1 hoursTest cases
4Total6 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

RiskImpactLikelihoodMitigation Strategy
Incorrect shift rotationHighMediumImplement unit tests to verify logic
Database performance issuesMediumMediumOptimize queries, use indexing
Roster not generated on timeHighLowImplement 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.