Skip to contents

Takes a list of dates and schedules them to a waiting list, by adding a removal date to the dataframe. This is done in referral date order, I.e. earlier referrals are scheduled first (FIFO).

Usage

wl_schedule(waiting_list, schedule, referral_index = 1, removal_index = 2)

Arguments

waiting_list

dataframe. A df of referral dates and removals

schedule

vector of dates. The dates to schedule open referrals into (ie. dates of unbooked future capacity)

referral_index

integer. The column number in the waiting_list which contains the referral dates

removal_index

integer. The column number in the waiting_list which contains the removal dates

Value

dataframe. A df of the updated waiting list with removal dates added according to the schedule

Examples

referrals <- c.Date("2024-01-01", "2024-01-04", "2024-01-10", "2024-01-16")
removals <- c.Date("2024-01-08", NA, NA, NA)
waiting_list <- data.frame("referral" = referrals, "removal" = removals)
schedule <- c.Date("2024-01-03", "2024-01-05", "2024-01-18")
updated_waiting_list <- wl_schedule(waiting_list, schedule)

# TODO ALLOW:
# schedule to be a dataframe or vector