Given the configuration and prediction data frame, build a prediction table

build_prediction_table(config, start_date, end_date = Sys.Date() + 2,
  generate_report = TRUE, offset = config$start - 1,
  min_inventory = config$min_inventory)

Arguments

config

the site configuration

start_date

the starting date in YYYY-mm-dd format

end_date

the end date in YYYY-mm-dd format, by default today plus 2 days

generate_report

a flag indicating whether a report needs to be generated as a side effect

offset

the offset to use to line up the initial settings for expiry and collection units; default is config$start - 1, which matches the usage in training the model, but can be any non-negative number less than the number of predictions made

min_inventory

the minimum that needs to be in inventory, by default what was used in the training, which is config$c0.

Value

a tibble of several variables, including all columns of prediction_df, plus units expiring in a day (r1), units expiring in 2 days (r2), waste (w), collection units (x), shortage (s) and y prediction and the platelet usage for that date, suggested values in case of inventory minimum is not met, inventory columns if available