Input Data Models
- Panel:
panel
: Objectid
: string
panellists
: Array of Objectsid
: string
date
: DatetotalSlots
: number
- Candidate Info:
candidate
: Objectid
: string
availableDates
: Array of Date
- Reasonable Adjustments:
reasonableAdjustments
: Array of strings (candidate IDs)
- Panel Conflicts:
panelConflicts
: Array of Objectscandidate
: Objectid
: string
panellist
: Objectid
: string
Output Data Models
- Timetable Data Model:
timetable
: Array of ObjectscandidateRef
: string (candidate ID)date
: Datepanel
: string (panel ID)reasonableAdjustment
: booleanslot
: number
- Unassigned Candidates Data Model:
unassignedCandidates
: Array of Objectscandidate
: Objectid
: string
availableDates
: Array of Date
Examples:
Input Example:
const panelData = [
{
panel: { id: 'panel1' },
panellists: [{ id: 'panellist1' }],
date: new Date('2024-01-01'),
totalSlots: 3,
},
// ... other panels
];
const candidateInfo = [
{
candidate: { id: 'candidate1' },
availableDates: [new Date('2024-01-01'), new Date('2024-01-02')],
},
// ... other candidates
];
const reasonableAdjustments = ['candidate2', 'candidate4'];
const panelConflicts = [
{
candidate: { id: 'candidate3' },
panellist: { id: 'panellist1' },
},
// ... other conflicts
];
selectionDayTimetable(panelData, candidateInfo, reasonableAdjustments, panelConflicts);
Output Example:
{
timetable: [
{ CandidateRef: 'candidate1', Date: new Date('2024-01-01'), Panel: 'panel1', ReasonableAdjustment: true, Slot: 1 },
// ... other timetable entries
],
unassignedCandidates: [
{ candidate: { id: 'candidate5' }, availableDates: [new Date('2024-01-01')] },
// ... other unassigned candidates
],
}
Overview:
- The
selectionDayTimetable
function manages the scheduling of candidates for panels on specific dates.
Input Parameters:
- The function takes four main inputs:
panelData
: Information about panels, including their ID, panellists, date, and the total available slots.candidateInfo
: Details about candidates, such as their ID and the dates they are available for.reasonableAdjustments
: A list of candidate IDs eligible for reasonable adjustments.panelConflicts
: Information about conflicts between candidates and panellists on specific panels.
Timetable Generation:
- The function generates a timetable that assigns candidates to panels on available dates.
- For each panel, it assigns candidates based on their availability and the total available slots.
The function achieves this in 5 main steps
- Matching ‘suitable’ Candidates to panels and matching ‘suitable’ panels to candidates.
- Assign candidates with only one ‘suitable’ panel to a slot
- Assign candidates with more than one ‘suitable’ panel to a slot
- Collect a list of the unassigned candidates
- Output the result
Reasonable Adjustments: - Candidates eligible for reasonable adjustments are given priority in the assignment process. - These candidates are flagged in the timetable to indicate they received special considerations.
Handling Conflicts: - The function considers conflicts between candidates and panellists on specific panels. - Candidates with conflicts are appropriately handled to ensure fair and conflict-free assignments.
Output:
- The function produces a timetable with details such as the candidate reference, date, panel ID, reasonable adjustment status, and assigned slot.
- Additionally, it provides a list of unassigned candidates with their details.
Edge Cases:
- The function accounts for various scenarios, including no available candidates, no panels, no conflicts, and a combination of conflicts and reasonable adjustments.
- It handles performance testing with larger datasets efficiently.
Conclusion:
selectionDayTimetable
assigns candidates to panels while considering conflicts and listing reasonable adjustments, aiming to fill the most slots possible.