From 845c463446272ea8ae303768938b8a7532508513 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Mon, 12 Feb 2024 20:22:07 +0000 Subject: [PATCH 01/37] Initial commit to add 3 functions to create synthetic data --- R/create_bulk_dataframe_sample.R | 10 ++++++++++ R/create_bulk_synthetic_data.R | 7 +++++++ R/create_waiting_list.R | 28 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 R/create_bulk_dataframe_sample.R create mode 100644 R/create_bulk_synthetic_data.R create mode 100644 R/create_waiting_list.R diff --git a/R/create_bulk_dataframe_sample.R b/R/create_bulk_dataframe_sample.R new file mode 100644 index 0000000..280c135 --- /dev/null +++ b/R/create_bulk_dataframe_sample.R @@ -0,0 +1,10 @@ +bulk <- data.frame(hospital_sites=c("ABC001","DHR70","JRW20","RFW002","DHR70"), + specialties = c(100,110,120,130,100), + opcs4_code = c("A","B","C","D","A"), + n= 366, + mean_arrival_rate= c(50,25,20,40,50), + mean_wait = c(21,20,10,30,21), + start_date = c("2024-01-01","2023-04-01","2024-04-01","2023-01-01","2024-01-01"), + sd=10, + rott=c(0,0.1,0.05,0.2,0.1) +) \ No newline at end of file diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R new file mode 100644 index 0000000..70da15a --- /dev/null +++ b/R/create_bulk_synthetic_data.R @@ -0,0 +1,7 @@ + +create_bulk_data <- function(bulk){ +result <- bulk |> + purrr::pmap(create_waiting_list) |> + dplyr::bind_rows() +return(result) +} \ No newline at end of file diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R new file mode 100644 index 0000000..7ae2aed --- /dev/null +++ b/R/create_waiting_list.R @@ -0,0 +1,28 @@ +create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), sd=0, rott=0, ...){ + + dots <- list(...) + + #Generate date range and number of referrals for each date (with or without random variation around mean_arrival_rate) + dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, by = "day") + counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) + referrals <- rep(dates, times = counts) + + #Set random waiting time in days for each referral received with exponential distribution rate 1/mean_waiting_time + values <- rexp(length(referrals),1/mean_wait) + + #Create dataframe of referrals and calculate removal date + df <- data.frame(addition_date = referrals, wait_length = values) + df$removal_date <- df$addition_date + round(df$wait_length,0) + df$wait_length <- round(df$wait_length,0) + + #Randomly flag user defined proportion of referrals as ROTT + df$rott <- FALSE + sample_list <- sample(1:nrow(df),nrow(df)*rott, replace = FALSE) + df$rott[sample_list] <- TRUE + + #Add a patient ID to each referral and prepare data for return + df$pat_id <- 1:nrow(df) + df <- df[order(df$addition_date),c("pat_id","addition_date","removal_date","wait_length","rott")] + + return( dplyr::as_tibble(c(dots, df)) ) +} \ No newline at end of file From 26cf40d8f7b5f471c6777d4053b66fe4ddb0d757 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Mon, 12 Feb 2024 20:31:48 +0000 Subject: [PATCH 02/37] Correct incorrect function name --- R/create_bulk_dataframe_sample.R | 6 +++++- R/create_bulk_synthetic_data.R | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/create_bulk_dataframe_sample.R b/R/create_bulk_dataframe_sample.R index 280c135..259e680 100644 --- a/R/create_bulk_dataframe_sample.R +++ b/R/create_bulk_dataframe_sample.R @@ -1,3 +1,5 @@ + +create_bulk_dataframe_sample <- function(){ bulk <- data.frame(hospital_sites=c("ABC001","DHR70","JRW20","RFW002","DHR70"), specialties = c(100,110,120,130,100), opcs4_code = c("A","B","C","D","A"), @@ -7,4 +9,6 @@ bulk <- data.frame(hospital_sites=c("ABC001","DHR70","JRW20","RFW002","DHR70"), start_date = c("2024-01-01","2023-04-01","2024-04-01","2023-01-01","2024-01-01"), sd=10, rott=c(0,0.1,0.05,0.2,0.1) -) \ No newline at end of file +) +return(bulk) +} \ No newline at end of file diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 70da15a..1f06191 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -1,5 +1,5 @@ -create_bulk_data <- function(bulk){ +create_bulk_synthetic_data <- function(bulk){ result <- bulk |> purrr::pmap(create_waiting_list) |> dplyr::bind_rows() From d3b14e3de934f5d9122c18f9ba282d22f3567930 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Wed, 1 May 2024 14:19:42 +0100 Subject: [PATCH 03/37] Tidy up comments --- R/create_bulk_synthetic_data.R | 11 ++++++++++ R/create_waiting_list.R | 40 +++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 1f06191..0a577de 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -1,4 +1,15 @@ +#' Title +#' @description +#' A short description... +#' +#' @param bulk +#' +#' @return +#' @export +#' +#' @examples + create_bulk_synthetic_data <- function(bulk){ result <- bulk |> purrr::pmap(create_waiting_list) |> diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 7ae2aed..819947d 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -1,13 +1,46 @@ +#' @title Create Waiting List +#' +#' @description +#' A function to create a waiting list using parameters +#' +#' Target Capacity = Demand + 2 * ( 1 + 4 * F ) / Target Wait +#' F defaults to 1. +#' +#' @param n Numeric value of rate of demand in same units as target wait - +#' e.g. if target wait is weeks, then demand in units of patients/week. +#' @param mean_arrival_date Numeric value of number of weeks that has been set +#' as the target within which the patient should be seen. +#' @param mean_wait Variability coefficient, F = V/C * (D/C)^2 where C is the +#' current number of operations per week; V is the current variance in the number +#' of operations per week; D is the observed demand. Defaults to 1. +#' @param start_date Variability coefficient, F = V/C * (D/C)^2 where C is the +#' current number of operations per week; V is the current variance in the number +#' of operations per week; D is the observed demand. Defaults to 1. +#' +#' @return A tibble blah blah +#' @export +#' +#' @examples +#' +#' # blah b;lah +#' # blah blah +#' +#' create_waiting_list(366,50,21,"2024-01-01",10,0.1) +#' + + create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), sd=0, rott=0, ...){ dots <- list(...) - #Generate date range and number of referrals for each date (with or without random variation around mean_arrival_rate) + #Generate date range and number of referrals for each date (with or without + #random variation around mean_arrival_rate) dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, by = "day") counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) - #Set random waiting time in days for each referral received with exponential distribution rate 1/mean_waiting_time + #Set random waiting time in days for each referral received with exponential + #distribution rate 1/mean_waiting_time values <- rexp(length(referrals),1/mean_wait) #Create dataframe of referrals and calculate removal date @@ -22,7 +55,8 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sy #Add a patient ID to each referral and prepare data for return df$pat_id <- 1:nrow(df) - df <- df[order(df$addition_date),c("pat_id","addition_date","removal_date","wait_length","rott")] + df <- df[order(df$addition_date),c("pat_id","addition_date","removal_date", + "wait_length","rott")] return( dplyr::as_tibble(c(dots, df)) ) } \ No newline at end of file From 228772cb4a1f7a750bdc23b8d33d68a31074f0fe Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Thu, 2 May 2024 16:01:52 +0100 Subject: [PATCH 04/37] Added ROxygen documentation --- R/create_bulk_dataframe_sample.R | 16 +++++++++ R/create_bulk_synthetic_data.R | 12 ++++--- R/create_waiting_list.R | 56 +++++++++++++++----------------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/R/create_bulk_dataframe_sample.R b/R/create_bulk_dataframe_sample.R index 259e680..e95b298 100644 --- a/R/create_bulk_dataframe_sample.R +++ b/R/create_bulk_dataframe_sample.R @@ -1,4 +1,20 @@ +#' @Title Create Bulk Dataframe Sample +#' +#' @Description +#' A function to create a bulk dataframe sample to test the +#' create_bulk_synthetic_data and create_waiting_list functions +#' +#' @return Dataframe for use with the create_waiting_list function and +#' create_bulk_synthetic_data to specify the sites and specialties and respective +#' mean wait and arrival rates. This dataframe could instead be generated outside +#' the package, using real data +#' @export +#' +#' @examples create_bulk_dataframe_sample() +#' +#' +#' create_bulk_dataframe_sample <- function(){ bulk <- data.frame(hospital_sites=c("ABC001","DHR70","JRW20","RFW002","DHR70"), specialties = c(100,110,120,130,100), diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 0a577de..97824a0 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -1,14 +1,18 @@ -#' Title +#' @Title Create Bulk Synthetic Data +#' #' @description -#' A short description... +#' Creates a series of waiting lists, one for each row in the dataframe +#' parameter and joins them together into one dataframe with relevant creation +#' criteria #' #' @param bulk #' -#' @return +#' @return Dataframe of waiting lists for each specified site and specialty, +#' opcs etc #' @export #' -#' @examples +#' @examples create_bulk_synthetic_data(bulk) create_bulk_synthetic_data <- function(bulk){ result <- bulk |> diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 819947d..bf580c2 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -1,62 +1,60 @@ #' @title Create Waiting List #' #' @description -#' A function to create a waiting list using parameters +#' Creates a waiting list using the parameters specified #' #' Target Capacity = Demand + 2 * ( 1 + 4 * F ) / Target Wait #' F defaults to 1. #' -#' @param n Numeric value of rate of demand in same units as target wait - -#' e.g. if target wait is weeks, then demand in units of patients/week. +#' @param n Numeric value of rate of demand in same units as target wait +#' - e.g. if target wait is weeks, then demand in units of patients/week. #' @param mean_arrival_date Numeric value of number of weeks that has been set #' as the target within which the patient should be seen. #' @param mean_wait Variability coefficient, F = V/C * (D/C)^2 where C is the -#' current number of operations per week; V is the current variance in the number -#' of operations per week; D is the observed demand. Defaults to 1. +#' current number of operations per week; V is the current variance in the +#' number of operations per week; D is the observed demand. Defaults to 1. #' @param start_date Variability coefficient, F = V/C * (D/C)^2 where C is the -#' current number of operations per week; V is the current variance in the number -#' of operations per week; D is the observed demand. Defaults to 1. +#' current number of operations per week; V is the current variance in the +#' number of operations per week; D is the observed demand. Defaults to 1. #' -#' @return A tibble blah blah +#' @return A tibble of a random generated list of patients with addition_date, +#' removal_date, wait_length and rott status for each patient #' @export #' -#' @examples -#' -#' # blah b;lah -#' # blah blah -#' -#' create_waiting_list(366,50,21,"2024-01-01",10,0.1) +#' @examples create_waiting_list(366,50,21,"2024-01-01",10,0.1) #' -create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), sd=0, rott=0, ...){ +create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), limit_removals = TRUE, sd = 0, rott = 0, ...){ dots <- list(...) - #Generate date range and number of referrals for each date (with or without - #random variation around mean_arrival_rate) + #Generate date range and number of referrals for each date (with or without random variation around mean_arrival_rate) dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, by = "day") counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) - #Set random waiting time in days for each referral received with exponential - #distribution rate 1/mean_waiting_time + #set random waiting time in days for each referral received with exponential distribution rate 1/mean_waiting_time values <- rexp(length(referrals),1/mean_wait) #Create dataframe of referrals and calculate removal date - df <- data.frame(addition_date = referrals, wait_length = values) - df$removal_date <- df$addition_date + round(df$wait_length,0) - df$wait_length <- round(df$wait_length,0) + test_df <- data.frame(addition_date = referrals, wait_length = values) + test_df$removal_date <- test_df$addition_date + round(test_df$wait_length,0) + + #Suppress removal dates that are greater than start date + 'n' days to simulate non-zero waitlist at end of simulated period. + if (limit_removals) { + test_df$removal_date[test_df$removal_date > (as.Date(start_date,format="%Y-%m-%d") + n)] <- NA + test_df$wait_length[is.na(test_df$removal_date)] <- NA + } #Randomly flag user defined proportion of referrals as ROTT - df$rott <- FALSE - sample_list <- sample(1:nrow(df),nrow(df)*rott, replace = FALSE) - df$rott[sample_list] <- TRUE + test_df$rott <- FALSE + sample_list <- sample(1:nrow(test_df),nrow(test_df)*rott, replace = FALSE) + test_df$rott[sample_list] <- TRUE #Add a patient ID to each referral and prepare data for return - df$pat_id <- 1:nrow(df) - df <- df[order(df$addition_date),c("pat_id","addition_date","removal_date", - "wait_length","rott")] + test_df$pat_id <- 1:nrow(test_df) + test_df <- test_df[order(test_df$addition_date),c("pat_id","addition_date","removal_date","wait_length","rott")] - return( dplyr::as_tibble(c(dots, df)) ) + return( dplyr::as_tibble(c(dots, test_df)) ) } \ No newline at end of file From 7be92c11052b6853d0aacaf1866f127b2bcebaf6 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 14:24:29 +0100 Subject: [PATCH 05/37] Finaised documentation and created sample data as external-data --- .Rbuildignore | 1 + DESCRIPTION | 5 +- NAMESPACE | 2 + R/create_bulk_synthetic_data.R | 12 +++-- R/create_waiting_list.R | 43 +++++++++------- R/demo-data.R | 23 +++++++++ data-raw/demo-data.R | 13 +++++ data/demo_df.rda | Bin 0 -> 399 bytes man/create_bulk_synthetic_data.Rd | 25 ++++++++++ man/create_waiting_list.Rd | 46 ++++++++++++++++++ man/demo_df.Rd | 33 +++++++++++++ man/target_capacity.Rd | 7 ++- .../create_bulk_dataframe_sample_old.R | 8 +-- 13 files changed, 186 insertions(+), 32 deletions(-) create mode 100644 R/demo-data.R create mode 100644 data-raw/demo-data.R create mode 100644 data/demo_df.rda create mode 100644 man/create_bulk_synthetic_data.Rd create mode 100644 man/create_waiting_list.Rd create mode 100644 man/demo_df.Rd rename R/create_bulk_dataframe_sample.R => secret/create_bulk_dataframe_sample_old.R (72%) diff --git a/.Rbuildignore b/.Rbuildignore index 3371f62..9a92dad 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ cran-comments.md ^pkgdown$ ^\.github$ ^codecov\.yml$ +^data-raw$ diff --git a/DESCRIPTION b/DESCRIPTION index cf21125..96ffc44 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Description: R-package to implement the waiting list management approach describ License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Suggests: knitr, rmarkdown, @@ -24,3 +24,6 @@ Suggests: VignetteBuilder: knitr URL: https://nhs-r-community.github.io/NHSRwaitinglist/ Config/testthat/edition: 3 +Depends: + R (>= 2.10) +LazyData: true diff --git a/NAMESPACE b/NAMESPACE index 326692a..931eba6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,8 @@ # Generated by roxygen2: do not edit by hand export(average_wait) +export(create_bulk_synthetic_data) +export(create_waiting_list) export(queue_load) export(relief_capacity) export(target_capacity) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 97824a0..b6e6e57 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -1,21 +1,23 @@ -#' @Title Create Bulk Synthetic Data +#' @title Create Bulk Synthetic Data #' #' @description #' Creates a series of waiting lists, one for each row in the dataframe #' parameter and joins them together into one dataframe with relevant creation #' criteria #' -#' @param bulk +#' @param bulk_data A dataframe object, each row being a waiting list with +#' parameters to generate the synthetic data. A sample data.frame is available +#' as demo-data #' #' @return Dataframe of waiting lists for each specified site and specialty, #' opcs etc #' @export #' -#' @examples create_bulk_synthetic_data(bulk) +#' @examples create_bulk_synthetic_data(demo_df) -create_bulk_synthetic_data <- function(bulk){ -result <- bulk |> +create_bulk_synthetic_data <- function(bulk_data){ +result <- bulk_data |> purrr::pmap(create_waiting_list) |> dplyr::bind_rows() return(result) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index bf580c2..618da3e 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -3,19 +3,16 @@ #' @description #' Creates a waiting list using the parameters specified #' -#' Target Capacity = Demand + 2 * ( 1 + 4 * F ) / Target Wait -#' F defaults to 1. #' #' @param n Numeric value of rate of demand in same units as target wait #' - e.g. if target wait is weeks, then demand in units of patients/week. -#' @param mean_arrival_date Numeric value of number of weeks that has been set -#' as the target within which the patient should be seen. -#' @param mean_wait Variability coefficient, F = V/C * (D/C)^2 where C is the -#' current number of operations per week; V is the current variance in the -#' number of operations per week; D is the observed demand. Defaults to 1. -#' @param start_date Variability coefficient, F = V/C * (D/C)^2 where C is the -#' current number of operations per week; V is the current variance in the -#' number of operations per week; D is the observed demand. Defaults to 1. +#' @param mean_arrival_date Numeric value of mean daily arrival rate. +#' @param mean_wait Numeric value of mean wait time for treatment/on waiting list. +#' @param start_date Character value of date from which to start generated +#' waiting list. +#' @param sd Numeric value, standard deviation. Defaults to 0. +#' @param rott Numeric value, proportion of referrals to be randomly flagged +#' as ROTT. Defaults to 0. #' #' @return A tibble of a random generated list of patients with addition_date, #' removal_date, wait_length and rott status for each patient @@ -25,25 +22,32 @@ #' -create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), limit_removals = TRUE, sd = 0, rott = 0, ...){ +create_waiting_list <- function(n, mean_arrival_rate, mean_wait, + start_date = Sys.Date(), limit_removals = TRUE, + sd = 0, rott = 0, ...){ dots <- list(...) - #Generate date range and number of referrals for each date (with or without random variation around mean_arrival_rate) - dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, by = "day") + #Generate date range and number of referrals for each date (with or without + #random variation around mean_arrival_rate) + dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, + by = "day") counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) - #set random waiting time in days for each referral received with exponential distribution rate 1/mean_waiting_time + #set random waiting time in days for each referral received with exponential + #distribution rate 1/mean_waiting_time values <- rexp(length(referrals),1/mean_wait) #Create dataframe of referrals and calculate removal date test_df <- data.frame(addition_date = referrals, wait_length = values) test_df$removal_date <- test_df$addition_date + round(test_df$wait_length,0) - #Suppress removal dates that are greater than start date + 'n' days to simulate non-zero waitlist at end of simulated period. + #Suppress removal dates that are greater than start date + 'n' days to + #simulate non-zero waitlist at end of simulated period. if (limit_removals) { - test_df$removal_date[test_df$removal_date > (as.Date(start_date,format="%Y-%m-%d") + n)] <- NA + test_df$removal_date[test_df$removal_date > + (as.Date(start_date,format="%Y-%m-%d") + n)] <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } @@ -54,7 +58,10 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sy #Add a patient ID to each referral and prepare data for return test_df$pat_id <- 1:nrow(test_df) - test_df <- test_df[order(test_df$addition_date),c("pat_id","addition_date","removal_date","wait_length","rott")] + test_df <- test_df[order(test_df$addition_date),c("pat_id","addition_date", + "removal_date","wait_length", + "rott")] return( dplyr::as_tibble(c(dots, test_df)) ) -} \ No newline at end of file +} + diff --git a/R/demo-data.R b/R/demo-data.R new file mode 100644 index 0000000..cceb627 --- /dev/null +++ b/R/demo-data.R @@ -0,0 +1,23 @@ +#' @title A Demo 'data.frame' Object +#' +#' @description A pre-created data.frame ready to be used to test the create_bulk_synthetic_data +#' and create_waiting_list functions. Each row of the data.frame represents an +#' individual waiting list for which the site, specialty, OPCS code(s) and +#' respective mean wait, arrival rate, start_date, sd and rott can be specified. +#' It allows the user to see an example of the structure of the data.frame +#' required by the create_bulk_synthetic_data function to create your +#' synthetic dataset. +#' +#' @format A dataframe with 5 rows and 9 columns: +#' \describe{ +#' \item{hospital_site}{Character. Hospital site code of the waiting list.} +#' \item{main_spec_code}{Numeric. Main specialty code of the waiting list.} +#' \item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting list.} +#' \item{n}{Numeric. Number of days for which to create synthetic waiting list data.} +#' \item{mean_arrival_rate}{Numeric. Mean number of arrivals per day.} +#' \item{mean_wait}{Numeric. Mean wait time for treatment/on waiting list.} +#' \item{start_date}{Character. Date from which to start generated waiting list in format yyyy-mm-dd.} +#' \item{sd}{Numeric. Standard deviation.} +#' \item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} +#' } +"demo_df" \ No newline at end of file diff --git a/data-raw/demo-data.R b/data-raw/demo-data.R new file mode 100644 index 0000000..a3bcaae --- /dev/null +++ b/data-raw/demo-data.R @@ -0,0 +1,13 @@ +## code to prepare `demo-data` dataset goes here +demo_df <- data.frame(hospital_site=c("ABC001","DHR70","JRW20","RFW002","DHR70"), + main_spec_code = c(100,110,120,130,100), + opcs4_code = c("T202","W401","F344","C866","T272"), + n= 366, + mean_arrival_rate= c(50,25,20,40,50), + mean_wait = c(21,20,10,30,21), + start_date = c("2024-01-01","2023-04-01","2024-04-01","2023-01-01","2024-01-01"), + sd=10, + rott=c(0,0.1,0.05,0.2,0.1) + ) + +usethis::use_data(demo_df, overwrite = TRUE) diff --git a/data/demo_df.rda b/data/demo_df.rda new file mode 100644 index 0000000000000000000000000000000000000000..b98915c13fda3e2d4762ee5b53bdf515e3acc44d GIT binary patch literal 399 zcmV;A0dW38T4*^jL0KkKS!LyaTL1w?fBpZnXaEEQf8qUb6zT70-GD#<05AX`03ZM$ zKmY&+is%;$poVkY~R@FlBvi!EGNw96+hT;PTEOcm2SDD}>9O5y%%7BH^iE9E#y5gQ-kf$e+ zsA`A6oyTPgO?3v}eGDDRi+CL5C?J96;g}|mngkpQZG<1bO*_yrVg}L`SR$}oEK&?8 tjU5VuCcUbwl!hQ8Xy8B*U&iJFAHmOT1A%=X-eVv5yOJrwgo7_D`q)r^r?vn9 literal 0 HcmV?d00001 diff --git a/man/create_bulk_synthetic_data.Rd b/man/create_bulk_synthetic_data.Rd new file mode 100644 index 0000000..91ec3b2 --- /dev/null +++ b/man/create_bulk_synthetic_data.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/create_bulk_synthetic_data.R +\name{create_bulk_synthetic_data} +\alias{create_bulk_synthetic_data} +\title{Create Bulk Synthetic Data} +\usage{ +create_bulk_synthetic_data(bulk_data) +} +\arguments{ +\item{bulk_data}{A dataframe object, each row being a waiting list with +parameters to generate the synthetic data. A sample data.frame is available +as demo-data} +} +\value{ +Dataframe of waiting lists for each specified site and specialty, +opcs etc +} +\description{ +Creates a series of waiting lists, one for each row in the dataframe +parameter and joins them together into one dataframe with relevant creation +criteria +} +\examples{ +create_bulk_synthetic_data(demo_df) +} diff --git a/man/create_waiting_list.Rd b/man/create_waiting_list.Rd new file mode 100644 index 0000000..e7673b7 --- /dev/null +++ b/man/create_waiting_list.Rd @@ -0,0 +1,46 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/create_waiting_list.R +\name{create_waiting_list} +\alias{create_waiting_list} +\title{Create Waiting List} +\usage{ +create_waiting_list( + n, + mean_arrival_rate, + mean_wait, + start_date = Sys.Date(), + limit_removals = TRUE, + sd = 0, + rott = 0, + ... +) +} +\arguments{ +\item{n}{Numeric value of rate of demand in same units as target wait +\itemize{ +\item e.g. if target wait is weeks, then demand in units of patients/week. +}} + +\item{mean_wait}{Numeric value of mean wait time for treatment/on waiting list.} + +\item{start_date}{Character value of date from which to start generated +waiting list.} + +\item{sd}{Numeric value, standard deviation. Defaults to 0.} + +\item{rott}{Numeric value, proportion of referrals to be randomly flagged +as ROTT. Defaults to 0.} + +\item{mean_arrival_date}{Numeric value of mean daily arrival rate.} +} +\value{ +A tibble of a random generated list of patients with addition_date, +removal_date, wait_length and rott status for each patient +} +\description{ +Creates a waiting list using the parameters specified +} +\examples{ +create_waiting_list(366,50,21,"2024-01-01",10,0.1) + +} diff --git a/man/demo_df.Rd b/man/demo_df.Rd new file mode 100644 index 0000000..5dfb092 --- /dev/null +++ b/man/demo_df.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/demo-data.R +\docType{data} +\name{demo_df} +\alias{demo_df} +\title{A Demo 'data.frame' Object} +\format{ +A dataframe with 5 rows and 9 columns: +\describe{ +\item{hospital_site}{Character. Hospital site code of the waiting list.} +\item{main_spec_code}{Numeric. Main specialty code of the waiting list.} +\item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting list.} +\item{n}{Numeric. Number of days for which to create synthetic waiting list data.} +\item{mean_arrival_rate}{Numeric. Mean number of arrivals per day.} +\item{mean_wait}{Numeric. Mean wait time for treatment/on waiting list.} +\item{start_date}{Character. Date from which to start generated waiting list in format yyyy-mm-dd.} +\item{sd}{Numeric. Standard deviation.} +\item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} +} +} +\usage{ +demo_df +} +\description{ +A pre-created data.frame ready to be used to test the create_bulk_synthetic_data +and create_waiting_list functions. Each row of the data.frame represents an +individual waiting list for which the site, specialty, OPCS code(s) and +respective mean wait, arrival rate, start_date, sd and rott can be specified. +It allows the user to see an example of the structure of the data.frame +required by the create_bulk_synthetic_data function to create your +synthetic dataset. +} +\keyword{datasets} diff --git a/man/target_capacity.Rd b/man/target_capacity.Rd index 05d379a..cf50ff8 100644 --- a/man/target_capacity.Rd +++ b/man/target_capacity.Rd @@ -11,17 +11,16 @@ target_capacity(demand, target_wait, F = 1) \item{target_wait}{Numeric value of number of weeks that has been set as the target within which the patient should be seen.} -\item{F}{Holding value, needs definition of F adding.} +\item{F}{Variability coefficient, F = V/C * (D/C)^2 where C is the current number of operations per week; V is the current variance in the number of operations per week; D is the observed demand. Defaults to 1.} } \value{ A numeric value of target capacity required to achieve a target waiting time. } \description{ -Calculates the target capacity to achieve a given target waiting time as a function of observed demand, target waiting time and a variability of demand parameter F. - -F defaults to 1. +Calculates the target capacity to achieve a given target waiting time as a function of observed demand, target waiting time and a variability coefficient F. Target Capacity = Demand + 2 * ( 1 + 4 * F ) / Target Wait +F defaults to 1. } \examples{ diff --git a/R/create_bulk_dataframe_sample.R b/secret/create_bulk_dataframe_sample_old.R similarity index 72% rename from R/create_bulk_dataframe_sample.R rename to secret/create_bulk_dataframe_sample_old.R index e95b298..841eb3e 100644 --- a/R/create_bulk_dataframe_sample.R +++ b/secret/create_bulk_dataframe_sample_old.R @@ -6,7 +6,7 @@ #' create_bulk_synthetic_data and create_waiting_list functions #' #' @return Dataframe for use with the create_waiting_list function and -#' create_bulk_synthetic_data to specify the sites and specialties and respective +#' create_bulk_synthetic_data function to specify the sites and specialties and respective #' mean wait and arrival rates. This dataframe could instead be generated outside #' the package, using real data #' @export @@ -16,9 +16,9 @@ #' #' create_bulk_dataframe_sample <- function(){ -bulk <- data.frame(hospital_sites=c("ABC001","DHR70","JRW20","RFW002","DHR70"), - specialties = c(100,110,120,130,100), - opcs4_code = c("A","B","C","D","A"), +bulk <- data.frame(hospital_site=c("ABC001","DHR70","JRW20","RFW002","DHR70"), + main_spec_code = c(100,110,120,130,100), + opcs4_code = c("T202","W401","F344","C866","T272"), n= 366, mean_arrival_rate= c(50,25,20,40,50), mean_wait = c(21,20,10,30,21), From 7e756c96d2e90d037b434752392e45672c3f503c Mon Sep 17 00:00:00 2001 From: Jacqueline Grout <103451105+jacgrout@users.noreply.github.com> Date: Fri, 3 May 2024 14:55:59 +0100 Subject: [PATCH 06/37] Update DESCRIPTION removed duplicate lines and added purrr package --- DESCRIPTION | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0551b8c..fb237a0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,14 +23,12 @@ Config/testthat/edition: 3 Imports: cli, dplyr, - rlang + rlang, + purrr Suggests: knitr, rmarkdown, testthat (>= 3.0.0) -VignetteBuilder: knitr -URL: https://nhs-r-community.github.io/NHSRwaitinglist/ -Config/testthat/edition: 3 Depends: R (>= 2.10) LazyData: true From c4794da063fd150de3a30a9ee5c9df2ec0ed8dab Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 15:23:00 +0100 Subject: [PATCH 07/37] Removed as now replaced by different approach --- secret/create_bulk_dataframe_sample_old.R | 30 ----------------------- 1 file changed, 30 deletions(-) delete mode 100644 secret/create_bulk_dataframe_sample_old.R diff --git a/secret/create_bulk_dataframe_sample_old.R b/secret/create_bulk_dataframe_sample_old.R deleted file mode 100644 index 841eb3e..0000000 --- a/secret/create_bulk_dataframe_sample_old.R +++ /dev/null @@ -1,30 +0,0 @@ - -#' @Title Create Bulk Dataframe Sample -#' -#' @Description -#' A function to create a bulk dataframe sample to test the -#' create_bulk_synthetic_data and create_waiting_list functions -#' -#' @return Dataframe for use with the create_waiting_list function and -#' create_bulk_synthetic_data function to specify the sites and specialties and respective -#' mean wait and arrival rates. This dataframe could instead be generated outside -#' the package, using real data -#' @export -#' -#' @examples create_bulk_dataframe_sample() -#' -#' -#' -create_bulk_dataframe_sample <- function(){ -bulk <- data.frame(hospital_site=c("ABC001","DHR70","JRW20","RFW002","DHR70"), - main_spec_code = c(100,110,120,130,100), - opcs4_code = c("T202","W401","F344","C866","T272"), - n= 366, - mean_arrival_rate= c(50,25,20,40,50), - mean_wait = c(21,20,10,30,21), - start_date = c("2024-01-01","2023-04-01","2024-04-01","2023-01-01","2024-01-01"), - sd=10, - rott=c(0,0.1,0.05,0.2,0.1) -) -return(bulk) -} \ No newline at end of file From 295fa91cce8467f3433f80b94e833bb3ed7a4ba4 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 15:25:16 +0100 Subject: [PATCH 08/37] Added packages used in new functions --- DESCRIPTION | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index fb237a0..8792763 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,7 +24,14 @@ Imports: cli, dplyr, rlang, - purrr + purrr, + sd, + utils, + rpois, + rnorm, + rexp, + stats, + tail Suggests: knitr, rmarkdown, From 65eaa7270ca568ef444487d4cacd292c82668665 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 15:34:36 +0100 Subject: [PATCH 09/37] Corrected error in package names --- DESCRIPTION | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8792763..1e98ea1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,13 +25,8 @@ Imports: dplyr, rlang, purrr, - sd, utils, - rpois, - rnorm, - rexp, - stats, - tail + stats Suggests: knitr, rmarkdown, From daffc597c24c5eb2d097ea944d4c23b181af4787 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 15:45:38 +0100 Subject: [PATCH 10/37] Corrected parameter name and added missing parameter --- R/create_waiting_list.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 618da3e..de228ce 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -6,10 +6,11 @@ #' #' @param n Numeric value of rate of demand in same units as target wait #' - e.g. if target wait is weeks, then demand in units of patients/week. -#' @param mean_arrival_date Numeric value of mean daily arrival rate. +#' @param mean_arrival_rate Numeric value of mean daily arrival rate. #' @param mean_wait Numeric value of mean wait time for treatment/on waiting list. #' @param start_date Character value of date from which to start generated #' waiting list. +#' @param limit_removals Defaults to TRUE #' @param sd Numeric value, standard deviation. Defaults to 0. #' @param rott Numeric value, proportion of referrals to be randomly flagged #' as ROTT. Defaults to 0. From fc99f611ca4e8cde338f18bedc3292ee32199bed Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 16:04:37 +0100 Subject: [PATCH 11/37] Updated documentation --- man/create_waiting_list.Rd | 6 ++++-- man/queue_load.Rd | 2 +- man/relief_capacity.Rd | 22 ++++++++++++++-------- man/target_capacity.Rd | 25 ++++++++++++++----------- man/target_queue_size.Rd | 21 ++++++++++++++------- man/wl_insert.Rd | 14 ++++++++------ man/wl_queue_size.Rd | 6 +++--- man/wl_referral_stats.Rd | 11 +++++++++-- man/wl_removal_stats.Rd | 11 +++++++++-- man/wl_schedule.Rd | 15 ++++++++++----- man/wl_simulator.Rd | 14 +++++++++----- man/wl_stats.Rd | 5 +++-- 12 files changed, 98 insertions(+), 54 deletions(-) diff --git a/man/create_waiting_list.Rd b/man/create_waiting_list.Rd index e7673b7..301246f 100644 --- a/man/create_waiting_list.Rd +++ b/man/create_waiting_list.Rd @@ -21,17 +21,19 @@ create_waiting_list( \item e.g. if target wait is weeks, then demand in units of patients/week. }} +\item{mean_arrival_rate}{Numeric value of mean daily arrival rate.} + \item{mean_wait}{Numeric value of mean wait time for treatment/on waiting list.} \item{start_date}{Character value of date from which to start generated waiting list.} +\item{limit_removals}{Defaults to TRUE} + \item{sd}{Numeric value, standard deviation. Defaults to 0.} \item{rott}{Numeric value, proportion of referrals to be randomly flagged as ROTT. Defaults to 0.} - -\item{mean_arrival_date}{Numeric value of mean daily arrival rate.} } \value{ A tibble of a random generated list of patients with addition_date, diff --git a/man/queue_load.Rd b/man/queue_load.Rd index 128727b..0792025 100755 --- a/man/queue_load.Rd +++ b/man/queue_load.Rd @@ -26,5 +26,5 @@ by the capacity: queue_load = demand / capacity. \examples{ # If 30 patients are added to the waiting list each week (demand) and 27 # removed (capacity) this results in a queue load of 1.11 (30/27). -queue_load(30,27) +queue_load(30, 27) } diff --git a/man/relief_capacity.Rd b/man/relief_capacity.Rd index 6715106..6e03263 100755 --- a/man/relief_capacity.Rd +++ b/man/relief_capacity.Rd @@ -7,23 +7,29 @@ relief_capacity(demand, queue_size, target_queue_size, time_to_target = 26) } \arguments{ -\item{demand}{Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week.} +\item{demand}{Numeric value of rate of demand in same units as target wait +e.g. if target wait is weeks, then demand in units of patients/week.} -\item{queue_size}{Numeric value of current number of patients in queue.} +\item{queue_size}{Numeric value of current number of patients in queue.} -\item{target_queue_size}{Numeric value of desired number of patients in queue.} +\item{target_queue_size}{Numeric value of desired number of patients +in queue.} -\item{time_to_target}{Numeric value of desired number of time-steps to reach the target queue size by.} +\item{time_to_target}{Numeric value of desired number of time-steps to reach +the target queue size by.} } \value{ -A numeric value of the required rate of capacity to achieve a target queue size in a given period of time. +A numeric value of the required rate of capacity to achieve a target +queue size in a given period of time. } \description{ -Calculates required relief capacity to achieve target queue size in a given period of time as a function of demand, queue size, target queue size and time period. - +Calculates required relief capacity to achieve target queue size +in a given period of time as a function of demand, queue size, target queue +size and time period. Relief Capacity is required if Queue Size > 2 * Target Queue Size. -Relief Capacity = Current Demand + (Queue Size - Target Queue Size)/Time Steps +Relief Capacity = +Current Demand + (Queue Size - Target Queue Size)/Time Steps WARNING!: make sure units match. I.e. if demand is measured per week then time_to_target should be weeks diff --git a/man/target_capacity.Rd b/man/target_capacity.Rd index 2239636..1ccc171 100644 --- a/man/target_capacity.Rd +++ b/man/target_capacity.Rd @@ -13,22 +13,24 @@ target_capacity( ) } \arguments{ -\item{demand}{Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week.} +\item{demand}{Numeric value of rate of demand in same units as target wait +e.g. if target wait is weeks, then demand in units of patients/week.} -\item{target_wait}{Numeric value of number of weeks that has been set as the target within which the patient should be seen.} +\item{target_wait}{Numeric value of number of weeks that has been set as the +target within which the patient should be seen.} - -\item{factor}{the amount we divide the target by in the waiting list e.g. if target is 52 weeks the mean wait should be 13 for a factor of 4} +\item{factor}{the amount we divide the target by in the waiting list +e.g. if target is 52 weeks the mean wait should be 13 for a factor of 4} \item{cv_demand}{coefficient of variation of time between arrivals} -\item{cv_capacity}{coefficient of variation between removals due to operations completed} +\item{cv_capacity}{coefficient of variation between removals due to +operations completed} } \value{ -A numeric value of target capacity required to achieve a target waiting time. +numeric. The capacity required to achieve a target waiting time. } \description{ - Applies Kingman/Marchal's Formula : \if{html}{\out{
}}\preformatted{ capacity = demand + (cvd**2 + cvc**2) / waiting_time @@ -41,10 +43,11 @@ waiting_time = target_wait / factor } \examples{ -demand = 4 # weeks -target_wait = 52 # weeks +demand <- 4 # weeks +target_wait <- 52 # weeks -target_capacity(demand, target_wait) # number of operations per week to have mean wait of 52/4 +# number of operations per week to have mean wait of 52/4 +target_capacity(demand, target_wait) -#TODO: Include a couple of standard deviations for errors in the mean demand +# TODO: Include a couple of standard deviations for errors in the mean demand } diff --git a/man/target_queue_size.Rd b/man/target_queue_size.Rd index 4252822..4579942 100644 --- a/man/target_queue_size.Rd +++ b/man/target_queue_size.Rd @@ -7,17 +7,25 @@ target_queue_size(demand, target_wait, factor = 4) } \arguments{ -\item{demand}{Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week.} +\item{demand}{Numeric value of rate of demand in same units as target wait +e.g. if target wait is weeks, then demand in units of patients/week.} -\item{target_wait}{Numeric value of number of weeks that has been set as the target within which the patient should be seen.} +\item{target_wait}{Numeric value of number of weeks that has been set as the +target within which the patient should be seen.} -\item{factor}{Numeric factor used in average wait calculation - to get a quarter of the target use factor=4 and one sixth of the target use factor = 6 etc. Defaults to 4.} +\item{factor}{Numeric factor used in average wait calculation +\itemize{ +\item to get a quarter of the target use factor=4 +\item to get one sixth of the target use factor = 6 etc. Defaults to 4. +}} } \value{ Numeric target queue length. } \description{ -Uses Little's Law to calculate the target queue size to achieve a target waiting time as a function of observed demand, target wait and a variability factor used in the target mean waiting time calculation. +Uses Little's Law to calculate the target queue size to achieve +a target waiting time as a function of observed demand, target wait and a +variability factor used in the target mean waiting time calculation. Target Queue Size = Demand * Target Wait / 4. @@ -28,10 +36,9 @@ The factor defaults to 4. Only applicable when Capacity > Demand. } \examples{ -# If demand is 30 patients per week and the target wait is 52 weeks, then the +# If demand is 30 patients per week and the target wait is 52 weeks, then the # Target queue size = 30 * 52/4 = 390 patients. -target_queue_size(30,52,4) - +target_queue_size(30, 52, 4) } diff --git a/man/wl_insert.Rd b/man/wl_insert.Rd index 83ffb3f..8d6c3e9 100755 --- a/man/wl_insert.Rd +++ b/man/wl_insert.Rd @@ -9,9 +9,11 @@ wl_insert(waiting_list, additions, referral_index = 1) \arguments{ \item{waiting_list}{dataframe. A df of referral dates and removals} -\item{additions}{character vector. A list of referral dates to add to the waiting list} +\item{additions}{character vector. A list of referral dates to add to the +waiting list} -\item{referral_index}{integer. The column number in the waiting_list which contains the referral dates} +\item{referral_index}{integer. The column number in the waiting_list which +contains the referral dates} } \value{ dataframe. A df of the updated waiting list @@ -20,10 +22,10 @@ dataframe. A df of the updated waiting list adds new referrals (removal date is set as NA) } \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 ) -additions <- c.Date("2024-01-03","2024-01-05","2024-01-18") +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) +additions <- c.Date("2024-01-03", "2024-01-05", "2024-01-18") longer_waiting_list <- wl_insert(waiting_list, additions) # TODO: What if more columns diff --git a/man/wl_queue_size.Rd b/man/wl_queue_size.Rd index fd7160e..6677ea2 100755 --- a/man/wl_queue_size.Rd +++ b/man/wl_queue_size.Rd @@ -20,8 +20,8 @@ a list of dates and queue sizes Calculates queue sizes from a waiting list } \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 ) +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) wl_queue_size(waiting_list) } diff --git a/man/wl_referral_stats.Rd b/man/wl_referral_stats.Rd index f61a525..1f0d3de 100644 --- a/man/wl_referral_stats.Rd +++ b/man/wl_referral_stats.Rd @@ -14,7 +14,8 @@ wl_referral_stats(waiting_list, start_date = NULL, end_date = NULL) \item{end_date}{date. The end date to calculate to} } \value{ -dataframe. A df containing number of referrals, mean demand, and the coefficient of variation of referrals +dataframe. A df containing number of referrals, mean demand, +and the coefficient of variation of referrals } \description{ Calculate some stats about referrals @@ -22,6 +23,12 @@ Calculate some stats about referrals \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) +waiting_list <- data.frame("referral" = referrals, "removal" = removals) referral_stats <- wl_referral_stats(waiting_list) + +# TODO : referral <- arrival +# debug and test +# simplify notation +# add detail to params above +# arrival mean and variance } diff --git a/man/wl_removal_stats.Rd b/man/wl_removal_stats.Rd index 51c1e70..d4299be 100644 --- a/man/wl_removal_stats.Rd +++ b/man/wl_removal_stats.Rd @@ -14,7 +14,8 @@ wl_removal_stats(waiting_list, start_date = NULL, end_date = NULL) \item{end_date}{date. The end date to calculate to} } \value{ -dataframe. A df containing number of removals, mean capacity, and the coefficient of variation of removals +dataframe. A df containing number of removals, mean capacity, +and the coefficient of variation of removals } \description{ Calculate some stats about removals @@ -22,6 +23,12 @@ Calculate some stats about removals \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) +waiting_list <- data.frame("referral" = referrals, "removal" = removals) removal_stats <- wl_removal_stats(waiting_list) + +# TODO : referral <- arrival +# debug and test +# simplify notation +# add detail to params above +# arrival mean and variance } diff --git a/man/wl_schedule.Rd b/man/wl_schedule.Rd index 2e25e88..0311c0e 100755 --- a/man/wl_schedule.Rd +++ b/man/wl_schedule.Rd @@ -9,19 +9,24 @@ wl_schedule(waiting_list, schedule, referral_index = 1, removal_index = 2) \arguments{ \item{waiting_list}{dataframe. A df of referral dates and removals} -\item{schedule}{vector of dates. The dates to schedule open referrals into (ie. dates of unbooked future capacity)} +\item{schedule}{vector of dates. The dates to schedule open referrals into +(ie. dates of unbooked future capacity)} -\item{referral_index}{integer. The column number in the waiting_list which contains the referral dates} +\item{referral_index}{integer. The column number in the waiting_list which +contains the referral dates} -\item{removal_index}{integer. The column number in the waiting_list which contains the removal dates} +\item{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 +dataframe. A df of the updated waiting list with removal dates added +according to the schedule } \description{ 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). +This is done in referral date order, +I.e. earlier referrals are scheduled first (FIFO). } \examples{ referrals <- c.Date("2024-01-01", "2024-01-04", "2024-01-10", "2024-01-16") diff --git a/man/wl_simulator.Rd b/man/wl_simulator.Rd index d91f161..22d7a74 100644 --- a/man/wl_simulator.Rd +++ b/man/wl_simulator.Rd @@ -24,19 +24,23 @@ wl_simulator( \item{waiting_list}{integer. The number of patients on the waiting list} -\item{referral_index}{integer. The column number in the waiting_list which contains the referral dates} +\item{referral_index}{integer. The column number in the waiting_list which +contains the referral dates} } \value{ dataframe. A df of simulated referrals and removals } \description{ -Creates a simulated waiting list comprising referral dates, and removal dates +Creates a simulated waiting list comprising referral dates, +and removal dates } \examples{ -over_capacity_simulation <- wl_simulator("2024-01-01", "2024-03-31", 100, 110) -under_capacity_simulation <- wl_simulator("2024-01-01", "2024-03-31", 100, 90) +over_capacity_simulation <- + wl_simulator("2024-01-01", "2024-03-31", 100, 110) +under_capacity_simulation <- + wl_simulator("2024-01-01", "2024-03-31", 100, 90) -#TODO +# TODO # error messages (e.g. start_date > end_date) } diff --git a/man/wl_stats.Rd b/man/wl_stats.Rd index 96f1a72..29418bf 100755 --- a/man/wl_stats.Rd +++ b/man/wl_stats.Rd @@ -19,13 +19,13 @@ wl_stats(waiting_list, target_wait = 4, start_date = NULL, end_date = NULL) dataframe. A df of important waiting list statistics } \description{ -A summary of all the key statistics associated with a waiting list +A summary of all the key stats associated with a waiting list } \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) +waiting_list <- data.frame("referral" = referrals, "removal" = removals) waiting_list_stats <- wl_stats(waiting_list) # TO DO!! @@ -33,6 +33,7 @@ waiting_list_stats <- wl_stats(waiting_list) # Error if dates are in the wrong order # Calculate the number of missed operations # Start date and end date calculations not working well +# # MAKE CONSISTENT NOTATION # default start and end date if empty # make units of output weekly operations not daily From 7d88592d5dd1681ca3115693ed6652b58acb3c2f Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 16:14:44 +0100 Subject: [PATCH 12/37] Corrected errors in layout of code --- R/create_bulk_synthetic_data.R | 2 +- R/create_waiting_list.R | 20 +++++++++++--------- data-raw/demo-data.R | 20 +++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index b6e6e57..89591a7 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -16,7 +16,7 @@ #' #' @examples create_bulk_synthetic_data(demo_df) -create_bulk_synthetic_data <- function(bulk_data){ +create_bulk_synthetic_data <- function(bulk_data) { result <- bulk_data |> purrr::pmap(create_waiting_list) |> dplyr::bind_rows() diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index de228ce..99b30b3 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -7,7 +7,8 @@ #' @param n Numeric value of rate of demand in same units as target wait #' - e.g. if target wait is weeks, then demand in units of patients/week. #' @param mean_arrival_rate Numeric value of mean daily arrival rate. -#' @param mean_wait Numeric value of mean wait time for treatment/on waiting list. +#' @param mean_wait Numeric value of mean wait time for treatment/on waiting +#' list. #' @param start_date Character value of date from which to start generated #' waiting list. #' @param limit_removals Defaults to TRUE @@ -25,20 +26,21 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, start_date = Sys.Date(), limit_removals = TRUE, - sd = 0, rott = 0, ...){ + sd = 0, rott = 0, ...) { dots <- list(...) #Generate date range and number of referrals for each date (with or without #random variation around mean_arrival_rate) - dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"),length.out = n, + dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"), + length.out = n, by = "day") counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) #set random waiting time in days for each referral received with exponential #distribution rate 1/mean_waiting_time - values <- rexp(length(referrals),1/mean_wait) + values <- rexp(length(referrals), 1/mean_wait) #Create dataframe of referrals and calculate removal date test_df <- data.frame(addition_date = referrals, wait_length = values) @@ -48,20 +50,20 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #simulate non-zero waitlist at end of simulated period. if (limit_removals) { test_df$removal_date[test_df$removal_date > - (as.Date(start_date,format="%Y-%m-%d") + n)] <- NA + (as.Date(start_date, format="%Y-%m-%d") + n)] <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } #Randomly flag user defined proportion of referrals as ROTT test_df$rott <- FALSE - sample_list <- sample(1:nrow(test_df),nrow(test_df)*rott, replace = FALSE) + sample_list <- sample(1:nrow(test_df), nrow(test_df)*rott, replace = FALSE) test_df$rott[sample_list] <- TRUE #Add a patient ID to each referral and prepare data for return test_df$pat_id <- 1:nrow(test_df) - test_df <- test_df[order(test_df$addition_date),c("pat_id","addition_date", - "removal_date","wait_length", - "rott")] + test_df <- test_df[order(test_df$addition_date), + c("pat_id", "addition_date", + "removal_date", "wait_length", "rott")] return( dplyr::as_tibble(c(dots, test_df)) ) } diff --git a/data-raw/demo-data.R b/data-raw/demo-data.R index a3bcaae..b9b55dd 100644 --- a/data-raw/demo-data.R +++ b/data-raw/demo-data.R @@ -1,13 +1,15 @@ ## code to prepare `demo-data` dataset goes here -demo_df <- data.frame(hospital_site=c("ABC001","DHR70","JRW20","RFW002","DHR70"), - main_spec_code = c(100,110,120,130,100), - opcs4_code = c("T202","W401","F344","C866","T272"), - n= 366, - mean_arrival_rate= c(50,25,20,40,50), - mean_wait = c(21,20,10,30,21), - start_date = c("2024-01-01","2023-04-01","2024-04-01","2023-01-01","2024-01-01"), - sd=10, - rott=c(0,0.1,0.05,0.2,0.1) +demo_df <- data.frame(hospital_site = c("ABC001", "DHR70", "JRW20", "RFW002", + "DHR70"), + main_spec_code = c(100, 110, 120, 130, 100), + opcs4_code = c("T202", "W401", "F344", "C866", "T272"), + n = 366, + mean_arrival_rate = c(50, 25, 20, 40, 50), + mean_wait = c(21, 20, 10, 30, 21), + start_date = c("2024-01-01", "2023-04-01", "2024-04-01", + "2023-01-01", "2024-01-01"), + sd = 10, + rott = c(0, 0.1, 0.05, 0.2, 0.1) ) usethis::use_data(demo_df, overwrite = TRUE) From 77363efd9e2baa3bb8f905707a4c72fe2a983c5f Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 18:14:42 +0100 Subject: [PATCH 13/37] Corrected errors with missing namespacing and documentation in roxygen --- R/create_waiting_list.R | 5 +++-- R/wl_referral_stats.R | 2 +- R/wl_removal_stats.R | 2 +- R/wl_simulator.R | 2 +- R/wl_stats.R | 2 +- man/create_waiting_list.Rd | 5 ++++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 99b30b3..f51c55d 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -15,6 +15,7 @@ #' @param sd Numeric value, standard deviation. Defaults to 0. #' @param rott Numeric value, proportion of referrals to be randomly flagged #' as ROTT. Defaults to 0. +#' @param ... Container for the list #' #' @return A tibble of a random generated list of patients with addition_date, #' removal_date, wait_length and rott status for each patient @@ -35,12 +36,12 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"), length.out = n, by = "day") - counts <- pmax(0,rnorm(n, mean = mean_arrival_rate, sd = sd)) + counts <- pmax(0,stats::rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) #set random waiting time in days for each referral received with exponential #distribution rate 1/mean_waiting_time - values <- rexp(length(referrals), 1/mean_wait) + values <- stats::rexp(length(referrals), 1/mean_wait) #Create dataframe of referrals and calculate removal date test_df <- data.frame(addition_date = referrals, wait_length = values) diff --git a/R/wl_referral_stats.R b/R/wl_referral_stats.R index b19aab6..affba62 100644 --- a/R/wl_referral_stats.R +++ b/R/wl_referral_stats.R @@ -46,7 +46,7 @@ wl_referral_stats <- function(waiting_list, inter_arrival_times <- diff(arrival_dates, lags = -1) mean_arrival <- as.numeric(mean(inter_arrival_times)) - sd_arrival <- sd(inter_arrival_times) + sd_arrival <- stats::sd(inter_arrival_times) cv_arrival <- sd_arrival / mean_arrival num_arrivals <- length(inter_arrival_times) demand <- 1 / mean_arrival diff --git a/R/wl_removal_stats.R b/R/wl_removal_stats.R index b1a917d..c923dad 100644 --- a/R/wl_removal_stats.R +++ b/R/wl_removal_stats.R @@ -61,7 +61,7 @@ wl_removal_stats <- function(waiting_list, differences <- removals_and_zeros[which(removals_and_zeros[, 2] == TRUE), 4] mean_removal <- as.numeric(mean(differences, na.rm = TRUE)) - sd_removal <- sd(differences, na.rm = TRUE) + sd_removal <- stats::sd(differences, na.rm = TRUE) cv_removal <- sd_removal / mean_removal num_removals <- length(differences) capacity <- 1 / mean_removal diff --git a/R/wl_simulator.R b/R/wl_simulator.R index e2e6eae..b514c8b 100755 --- a/R/wl_simulator.R +++ b/R/wl_simulator.R @@ -38,7 +38,7 @@ wl_simulator <- function( daily_capacity <- capacity / 7 # allowing for fluctuations in predicted demand give a arrival list - realized_demand <- rpois(1, total_demand) + realized_demand <- stats::rpois(1, total_demand) referral <- sample( seq(as.Date(start_date), as.Date(end_date), by = "day"), diff --git a/R/wl_stats.R b/R/wl_stats.R index 9052540..c89cb47 100755 --- a/R/wl_stats.R +++ b/R/wl_stats.R @@ -104,7 +104,7 @@ wl_stats <- function(waiting_list, q_load_too_big <- (q_load >= 1.) # final queue_size - q_size <- tail(queue_sizes, n = 1)[, 2] + q_size <- utils::tail(queue_sizes, n = 1)[, 2] # target queue size q_target <- target_queue_size(referral_stats$demand.weekly, target_wait) diff --git a/man/create_waiting_list.Rd b/man/create_waiting_list.Rd index 301246f..6061b40 100644 --- a/man/create_waiting_list.Rd +++ b/man/create_waiting_list.Rd @@ -23,7 +23,8 @@ create_waiting_list( \item{mean_arrival_rate}{Numeric value of mean daily arrival rate.} -\item{mean_wait}{Numeric value of mean wait time for treatment/on waiting list.} +\item{mean_wait}{Numeric value of mean wait time for treatment/on waiting +list.} \item{start_date}{Character value of date from which to start generated waiting list.} @@ -34,6 +35,8 @@ waiting list.} \item{rott}{Numeric value, proportion of referrals to be randomly flagged as ROTT. Defaults to 0.} + +\item{...}{Container for the list} } \value{ A tibble of a random generated list of patients with addition_date, From 8bcfd2ec20d11fae86d81235823624480b7f4e9a Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 18:33:31 +0100 Subject: [PATCH 14/37] Fixed layout of create_bulk_synthetic_data, create_waiting_list and demo_data --- R/create_bulk_synthetic_data.R | 2 +- R/create_waiting_list.R | 19 +++++++++--------- R/demo-data.R | 35 ++++++++++++++++++---------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 89591a7..109ed1e 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -17,7 +17,7 @@ #' @examples create_bulk_synthetic_data(demo_df) create_bulk_synthetic_data <- function(bulk_data) { -result <- bulk_data |> + result <- bulk_data |> purrr::pmap(create_waiting_list) |> dplyr::bind_rows() return(result) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index f51c55d..dd0cd23 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -33,39 +33,38 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #Generate date range and number of referrals for each date (with or without #random variation around mean_arrival_rate) - dates <- seq.Date(from = as.Date(start_date,format="%Y-%m-%d"), + dates <- seq.Date(from = as.Date(start_date, format = "%Y-%m-%d"), length.out = n, by = "day") - counts <- pmax(0,stats::rnorm(n, mean = mean_arrival_rate, sd = sd)) + counts <- pmax(0, stats::rnorm(n, mean = mean_arrival_rate, sd = sd)) referrals <- rep(dates, times = counts) #set random waiting time in days for each referral received with exponential #distribution rate 1/mean_waiting_time - values <- stats::rexp(length(referrals), 1/mean_wait) + values <- stats::rexp(length(referrals), 1 / mean_wait) #Create dataframe of referrals and calculate removal date test_df <- data.frame(addition_date = referrals, wait_length = values) - test_df$removal_date <- test_df$addition_date + round(test_df$wait_length,0) + test_df$removal_date <- test_df$addition_date + round(test_df$wait_length, 0) #Suppress removal dates that are greater than start date + 'n' days to #simulate non-zero waitlist at end of simulated period. if (limit_removals) { test_df$removal_date[test_df$removal_date > - (as.Date(start_date, format="%Y-%m-%d") + n)] <- NA + (as.Date(start_date, format = "%Y-%m-%d") + n)] <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } #Randomly flag user defined proportion of referrals as ROTT test_df$rott <- FALSE - sample_list <- sample(1:nrow(test_df), nrow(test_df)*rott, replace = FALSE) + sample_list <- sample(1:seq_len(nrow(test_df)), nrow(test_df) * rott, replace = FALSE) test_df$rott[sample_list] <- TRUE #Add a patient ID to each referral and prepare data for return - test_df$pat_id <- 1:nrow(test_df) + test_df$pat_id <- 1:seq_len(nrow(test_df)) test_df <- test_df[order(test_df$addition_date), c("pat_id", "addition_date", "removal_date", "wait_length", "rott")] - return( dplyr::as_tibble(c(dots, test_df)) ) -} - + return(dplyr::as_tibble(c(dots, test_df))) +} \ No newline at end of file diff --git a/R/demo-data.R b/R/demo-data.R index cceb627..271e14e 100644 --- a/R/demo-data.R +++ b/R/demo-data.R @@ -1,23 +1,26 @@ #' @title A Demo 'data.frame' Object #' -#' @description A pre-created data.frame ready to be used to test the create_bulk_synthetic_data -#' and create_waiting_list functions. Each row of the data.frame represents an -#' individual waiting list for which the site, specialty, OPCS code(s) and -#' respective mean wait, arrival rate, start_date, sd and rott can be specified. -#' It allows the user to see an example of the structure of the data.frame -#' required by the create_bulk_synthetic_data function to create your -#' synthetic dataset. +#' @description A pre-created data.frame ready to be used to test the +#' create_bulk_synthetic_data and create_waiting_list functions. Each row of +#' the data.frame represents an individual waiting list for which the site, +#' specialty, OPCS code(s) and respective mean wait, arrival rate, start_date, +#' sd and rott can be specified. It allows the user to see an example of the +#' structure of the data.frame required by the create_bulk_synthetic_data +#' function to create your synthetic dataset. #' #' @format A dataframe with 5 rows and 9 columns: #' \describe{ -#' \item{hospital_site}{Character. Hospital site code of the waiting list.} -#' \item{main_spec_code}{Numeric. Main specialty code of the waiting list.} -#' \item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting list.} -#' \item{n}{Numeric. Number of days for which to create synthetic waiting list data.} -#' \item{mean_arrival_rate}{Numeric. Mean number of arrivals per day.} -#' \item{mean_wait}{Numeric. Mean wait time for treatment/on waiting list.} -#' \item{start_date}{Character. Date from which to start generated waiting list in format yyyy-mm-dd.} -#' \item{sd}{Numeric. Standard deviation.} -#' \item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} +#'\item{hospital_site}{Character. Hospital site code of the waiting list.} +#'\item{main_spec_code}{Numeric. Main specialty code of the waiting list.} +#'\item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting +#' list.} +#'\item{n}{Numeric. Number of days for which to create synthetic waiting +#' list data.} +#'\item{mean_arrival_rate}{Numeric. Mean number of arrivals per day.} +#'\item{mean_wait}{Numeric. Mean wait time for treatment/on waiting list.} +#'\item{start_date}{Character. Date from which to start generated waiting +#' list in format yyyy-mm-dd.} +#'\item{sd}{Numeric. Standard deviation.} +#'\item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} #' } "demo_df" \ No newline at end of file From d8ab96eb5c1e8e4b33b9147ca917a8e052c7f175 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 18:39:33 +0100 Subject: [PATCH 15/37] Fixed loop --- R/create_waiting_list.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index dd0cd23..a7226f1 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -57,11 +57,11 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #Randomly flag user defined proportion of referrals as ROTT test_df$rott <- FALSE - sample_list <- sample(1:seq_len(nrow(test_df)), nrow(test_df) * rott, replace = FALSE) + sample_list <- sample(seq_len(nrow(test_df)), nrow(test_df) * rott, replace = FALSE) test_df$rott[sample_list] <- TRUE #Add a patient ID to each referral and prepare data for return - test_df$pat_id <- 1:seq_len(nrow(test_df)) + test_df$pat_id <- seq_len(nrow(test_df)) test_df <- test_df[order(test_df$addition_date), c("pat_id", "addition_date", "removal_date", "wait_length", "rott")] From 628ffab6c138404282fc4e4d045f8920691ed03f Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 18:42:21 +0100 Subject: [PATCH 16/37] Further fixes --- man/demo_df.Rd | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/man/demo_df.Rd b/man/demo_df.Rd index 5dfb092..d0210d3 100644 --- a/man/demo_df.Rd +++ b/man/demo_df.Rd @@ -9,11 +9,14 @@ A dataframe with 5 rows and 9 columns: \describe{ \item{hospital_site}{Character. Hospital site code of the waiting list.} \item{main_spec_code}{Numeric. Main specialty code of the waiting list.} -\item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting list.} -\item{n}{Numeric. Number of days for which to create synthetic waiting list data.} +\item{opcs4_code}{Character. OPCS4 code(s) of the procedure(s) on the waiting +list.} +\item{n}{Numeric. Number of days for which to create synthetic waiting +list data.} \item{mean_arrival_rate}{Numeric. Mean number of arrivals per day.} \item{mean_wait}{Numeric. Mean wait time for treatment/on waiting list.} -\item{start_date}{Character. Date from which to start generated waiting list in format yyyy-mm-dd.} +\item{start_date}{Character. Date from which to start generated waiting +list in format yyyy-mm-dd.} \item{sd}{Numeric. Standard deviation.} \item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} } @@ -22,12 +25,12 @@ A dataframe with 5 rows and 9 columns: demo_df } \description{ -A pre-created data.frame ready to be used to test the create_bulk_synthetic_data -and create_waiting_list functions. Each row of the data.frame represents an -individual waiting list for which the site, specialty, OPCS code(s) and -respective mean wait, arrival rate, start_date, sd and rott can be specified. -It allows the user to see an example of the structure of the data.frame -required by the create_bulk_synthetic_data function to create your -synthetic dataset. +A pre-created data.frame ready to be used to test the +create_bulk_synthetic_data and create_waiting_list functions. Each row of +the data.frame represents an individual waiting list for which the site, +specialty, OPCS code(s) and respective mean wait, arrival rate, start_date, +sd and rott can be specified. It allows the user to see an example of the +structure of the data.frame required by the create_bulk_synthetic_data +function to create your synthetic dataset. } \keyword{datasets} From 2a08d2898faa79b4140fceb36a6ed5b5c3430b47 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 19:04:52 +0100 Subject: [PATCH 17/37] Further indentation fixes --- R/create_bulk_synthetic_data.R | 4 ++-- R/create_waiting_list.R | 6 ++++-- data-raw/demo-data.R | 22 ++++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 109ed1e..4514a39 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -18,7 +18,7 @@ create_bulk_synthetic_data <- function(bulk_data) { result <- bulk_data |> - purrr::pmap(create_waiting_list) |> - dplyr::bind_rows() + purrr::pmap(create_waiting_list) |> + dplyr::bind_rows() return(result) } \ No newline at end of file diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index a7226f1..7a246e0 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -51,13 +51,15 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #simulate non-zero waitlist at end of simulated period. if (limit_removals) { test_df$removal_date[test_df$removal_date > - (as.Date(start_date, format = "%Y-%m-%d") + n)] <- NA + (as.Date(start_date, format = "%Y-%m-%d") + n)] + <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } #Randomly flag user defined proportion of referrals as ROTT test_df$rott <- FALSE - sample_list <- sample(seq_len(nrow(test_df)), nrow(test_df) * rott, replace = FALSE) + sample_list <- sample(seq_len(nrow(test_df)), nrow(test_df) * rott, + replace = FALSE) test_df$rott[sample_list] <- TRUE #Add a patient ID to each referral and prepare data for return diff --git a/data-raw/demo-data.R b/data-raw/demo-data.R index b9b55dd..fba99f5 100644 --- a/data-raw/demo-data.R +++ b/data-raw/demo-data.R @@ -1,15 +1,13 @@ -## code to prepare `demo-data` dataset goes here +## code to prepare `demo-data` dataset demo_df <- data.frame(hospital_site = c("ABC001", "DHR70", "JRW20", "RFW002", "DHR70"), - main_spec_code = c(100, 110, 120, 130, 100), - opcs4_code = c("T202", "W401", "F344", "C866", "T272"), - n = 366, - mean_arrival_rate = c(50, 25, 20, 40, 50), - mean_wait = c(21, 20, 10, 30, 21), - start_date = c("2024-01-01", "2023-04-01", "2024-04-01", + main_spec_code = c(100, 110, 120, 130, 100), + opcs4_code = c("T202", "W401", "F344", "C866", "T272"), + n = 366, + mean_arrival_rate = c(50, 25, 20, 40, 50), + mean_wait = c(21, 20, 10, 30, 21), + start_date = c("2024-01-01", "2023-04-01", "2024-04-01", "2023-01-01", "2024-01-01"), - sd = 10, - rott = c(0, 0.1, 0.05, 0.2, 0.1) - ) - -usethis::use_data(demo_df, overwrite = TRUE) + sd = 10, + rott = c(0, 0.1, 0.05, 0.2, 0.1)) +usethis::use_data(demo_df, overwrite = TRUE) \ No newline at end of file From cb21a2f07c20e013f44a96fba7312a1048b9cb59 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 19:12:26 +0100 Subject: [PATCH 18/37] Space fix --- R/create_waiting_list.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 7a246e0..bbf2363 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -51,8 +51,7 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #simulate non-zero waitlist at end of simulated period. if (limit_removals) { test_df$removal_date[test_df$removal_date > - (as.Date(start_date, format = "%Y-%m-%d") + n)] - <- NA + (as.Date(start_date, format = "%Y-%m-%d") + n)] <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } From c416ac7576c7337a240338b9ecd5aa95f1caa170 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 19:18:29 +0100 Subject: [PATCH 19/37] Fix more indents --- R/create_bulk_synthetic_data.R | 2 +- R/create_waiting_list.R | 2 +- data-raw/demo-data.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 4514a39..546dff7 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -20,5 +20,5 @@ create_bulk_synthetic_data <- function(bulk_data) { result <- bulk_data |> purrr::pmap(create_waiting_list) |> dplyr::bind_rows() -return(result) + return(result) } \ No newline at end of file diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index bbf2363..965f450 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -51,7 +51,7 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, #simulate non-zero waitlist at end of simulated period. if (limit_removals) { test_df$removal_date[test_df$removal_date > - (as.Date(start_date, format = "%Y-%m-%d") + n)] <- NA + (as.Date(start_date, format = "%Y-%m-%d") + n)] <- NA test_df$wait_length[is.na(test_df$removal_date)] <- NA } diff --git a/data-raw/demo-data.R b/data-raw/demo-data.R index fba99f5..33b8293 100644 --- a/data-raw/demo-data.R +++ b/data-raw/demo-data.R @@ -7,7 +7,7 @@ demo_df <- data.frame(hospital_site = c("ABC001", "DHR70", "JRW20", "RFW002", mean_arrival_rate = c(50, 25, 20, 40, 50), mean_wait = c(21, 20, 10, 30, 21), start_date = c("2024-01-01", "2023-04-01", "2024-04-01", - "2023-01-01", "2024-01-01"), + "2023-01-01", "2024-01-01"), sd = 10, rott = c(0, 0.1, 0.05, 0.2, 0.1)) usethis::use_data(demo_df, overwrite = TRUE) \ No newline at end of file From 29f310dce94aecc4a0fc21ac2934301e307aefe3 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 19:22:34 +0100 Subject: [PATCH 20/37] Added newlines to scripts --- R/create_bulk_synthetic_data.R | 2 +- R/create_waiting_list.R | 2 +- R/demo-data.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/create_bulk_synthetic_data.R b/R/create_bulk_synthetic_data.R index 546dff7..7d7f317 100644 --- a/R/create_bulk_synthetic_data.R +++ b/R/create_bulk_synthetic_data.R @@ -21,4 +21,4 @@ create_bulk_synthetic_data <- function(bulk_data) { purrr::pmap(create_waiting_list) |> dplyr::bind_rows() return(result) -} \ No newline at end of file +} diff --git a/R/create_waiting_list.R b/R/create_waiting_list.R index 965f450..d85badd 100644 --- a/R/create_waiting_list.R +++ b/R/create_waiting_list.R @@ -68,4 +68,4 @@ create_waiting_list <- function(n, mean_arrival_rate, mean_wait, "removal_date", "wait_length", "rott")] return(dplyr::as_tibble(c(dots, test_df))) -} \ No newline at end of file +} diff --git a/R/demo-data.R b/R/demo-data.R index 271e14e..eb9bdac 100644 --- a/R/demo-data.R +++ b/R/demo-data.R @@ -23,4 +23,4 @@ #'\item{sd}{Numeric. Standard deviation.} #'\item{rott}{Numeric. Proportion of referrals to be randomly flagged as ROTT} #' } -"demo_df" \ No newline at end of file +"demo_df" From ec01d7bfe2b02042cea92eb5ab4a96f6359bce17 Mon Sep 17 00:00:00 2001 From: Jacqueline Date: Fri, 3 May 2024 19:27:36 +0100 Subject: [PATCH 21/37] Added terminal newline --- data-raw/demo-data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-raw/demo-data.R b/data-raw/demo-data.R index 33b8293..1b0bd3f 100644 --- a/data-raw/demo-data.R +++ b/data-raw/demo-data.R @@ -10,4 +10,4 @@ demo_df <- data.frame(hospital_site = c("ABC001", "DHR70", "JRW20", "RFW002", "2023-01-01", "2024-01-01"), sd = 10, rott = c(0, 0.1, 0.05, 0.2, 0.1)) -usethis::use_data(demo_df, overwrite = TRUE) \ No newline at end of file +usethis::use_data(demo_df, overwrite = TRUE) From f55f2a5bf9249219fb99bc2b1c9eb870a8de2f49 Mon Sep 17 00:00:00 2001 From: Lextuga007 Date: Mon, 13 May 2024 21:31:13 +0100 Subject: [PATCH 22/37] Added remotes to package installation prompt and updated contributing in line with NHS-R Way --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3d04f7a..c00e1d7 100755 --- a/README.md +++ b/README.md @@ -12,18 +12,26 @@ An R-package to implement the waiting list management approach described in the paper [Understanding Waiting Lists Pressures](https://www.medrxiv.org/content/10.1101/2022.08.23.22279117v1) by Fong et al. -## To install the package, run: -``` r +# Installation + +You can install the current version of {name of package} from GitHub with: + +```{r} + +# install.packages("remotes") remotes::install_github("nhs-r-community/NHSRwaitinglist", build_vignettes = TRUE) + ``` +## Contributing -## Contribution +If you want to learn more about this project, please join the discussion at the [NHS-R Community Slack](https://nhsrway.nhsrcommunity.com/community-handbook.html#slack) group and the specific channel #managing-waiting-lists. -This is an NHS-R Community project that is open for anyone to contribute to in any way that they are able. Please see the [NHS-R Way](https://nhsrway.nhsrcommunity.com/style-guides.html) to read more on the style guides and for [Code of Conduct](https://nhsrway.nhsrcommunity.com/code-of-conduct.html) related to any activity or contribution to the NHS-R Community as well as the Code of Conduct in this repository which is generated using `usethis::use_code_of_conduct(contact = "nhs.rcommunity@nhs.net")`. -By contributing to this project, you agree to abide by these terms. +Please see our +[guidance on how to contribute](https://tools.nhsrcommunity.com/contribution.html). -If you want to learn more about this project, please join the discussion at the [NHS-R Community Slack](https://nhsrway.nhsrcommunity.com/community-handbook.html#slack) group and the specific channel #managing-waiting-lists. +This project is released with a Contributor [Code of Conduct](./CODE_OF_CONDUCT.md). +By contributing to this project, you agree to abide by its terms. The simplest way to contribute is to raise an issue detailing the feature or functionality you would like to see added, or any unexpected behaviour or bugs you have experienced. @@ -35,4 +43,5 @@ You are welcome to also submit Pull Requests and, as the `main` branch is protec * Commit to the new branch (add code or delete code or make changes) * Push the commits * Create a pull-request in GitHub to signal that your work is ready to be merged -* Tag one or more reviewers so that your contribution can be reviewed and merged into `main` +* Tag one or more reviewers (@ThomUK and @ChrisMainey) so that your contribution can be reviewed and merged into main + From 822ea321c4a775b0b668e7f8530549c9c99c84d1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 21:23:40 +0000 Subject: [PATCH 23/37] docs: update README.md [skip ci] --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index c00e1d7..9541c77 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ + +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) + [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/nhs-r-community/NHSRwaitinglist/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nhs-r-community/NHSRwaitinglist?branch=main) @@ -45,3 +48,25 @@ You are welcome to also submit Pull Requests and, as the `main` branch is protec * Create a pull-request in GitHub to signal that your work is ready to be merged * Tag one or more reviewers (@ThomUK and @ChrisMainey) so that your contribution can be reviewed and merged into main + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + +
Jacqueline Grout
Jacqueline Grout

🤔
+ + + + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file From 471917a1f937cf9d258d17521804377bab0913bd Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 21:23:41 +0000 Subject: [PATCH 24/37] docs: create .all-contributorsrc [skip ci] --- .all-contributorsrc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .all-contributorsrc diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000..be66adc --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,26 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "commitType": "docs", + "commitConvention": "angular", + "contributors": [ + { + "login": "jacgrout", + "name": "Jacqueline Grout", + "avatar_url": "https://avatars.githubusercontent.com/u/103451105?v=4", + "profile": "https://github.com/jacgrout", + "contributions": [ + "ideas" + ] + } + ], + "contributorsPerLine": 7, + "skipCi": true, + "repoType": "github", + "repoHost": "https://github.com", + "projectName": "NHSRwaitinglist", + "projectOwner": "nhs-r-community" +} From f44fc4faf43e92b38a74aca6b38af4bb89eadfaa Mon Sep 17 00:00:00 2001 From: Tom Smith Date: Wed, 17 Jul 2024 19:19:56 +0100 Subject: [PATCH 25/37] modifying contributors list --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1e98ea1..1ab674d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,9 +3,10 @@ Title: R-package to implement a waiting list management approach Version: 0.0.0.9000 Authors@R: c( person("Neil", "Walton", ,"neil.walton@durham.ac.uk", c("cre", "aut"), comment = c(ORCID ="0000-0002-5241-9765")), - person("Yasser", "Mustaq", ,"yasser.mushtaq@mft.nhs.uk", "aut"), person("Jacqueline", "Grout", ,"jacqueline.grout1@nhs.net", "aut"), person("Zoë", "Turner", , "zoe.turner3@nhs.net", "aut", comment = c(ORCID = "0000-0003-1033-9158")), + person("Matt", "Dray", , "matt.dray@nhs.net", "aut"), + person("Paul", "Fenton", , "paul.fenton@nca.nhs.uk", "aut"), person("Marcos", "Fabietti", ,"marcos.fabietti@nuh.nhs.uk", "aut"), person("Tom", "Smith", ,"thomas.smith5@nuh.nhs.uk", "aut"), person("Chris", "Mainey", ,"c.mainey1@nhs.net", "aut", comment = c(ORCID ="0000-0002-3018-6171")), From f40cdc1ede3219ed0d770b0e0df6fa72b6f49635 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:23:21 +0000 Subject: [PATCH 26/37] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9541c77..ef60ab8 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) @@ -60,6 +60,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Jacqueline Grout
Jacqueline Grout

🤔 + Tom Smith
Tom Smith

💻 From 1ba37586c21373d425010e9a8ae2d50462a2b055 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:23:22 +0000 Subject: [PATCH 27/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index be66adc..00486d0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -15,6 +15,15 @@ "contributions": [ "ideas" ] + }, + { + "login": "ThomUK", + "name": "Tom Smith", + "avatar_url": "https://avatars.githubusercontent.com/u/10871342?v=4", + "profile": "https://github.com/ThomUK", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 214521630beb05d2d35ab79b1c5f79bd521346d4 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:25:12 +0000 Subject: [PATCH 28/37] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ef60ab8..7ede161 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) @@ -61,6 +61,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Jacqueline Grout
Jacqueline Grout

🤔 Tom Smith
Tom Smith

💻 + Matt Dray
Matt Dray

💻 From e9c258296b28816379311d1abf3080924ad398b9 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:25:13 +0000 Subject: [PATCH 29/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 00486d0..4503027 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -24,6 +24,15 @@ "contributions": [ "code" ] + }, + { + "login": "matt-dray", + "name": "Matt Dray", + "avatar_url": "https://avatars.githubusercontent.com/u/18232097?v=4", + "profile": "http://matt-dray.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From e70be89e32649e31fdbc253185f1d5aa42babc8f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:26:53 +0000 Subject: [PATCH 30/37] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ede161..cb2a744 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) @@ -62,6 +62,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Jacqueline Grout
Jacqueline Grout

🤔 Tom Smith
Tom Smith

💻 Matt Dray
Matt Dray

💻 + kaituna
kaituna

📖 From bc0454085906b59e21a28baea493f60ea27a03d0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:26:54 +0000 Subject: [PATCH 31/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4503027..a79971f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -33,6 +33,15 @@ "contributions": [ "code" ] + }, + { + "login": "kaituna", + "name": "kaituna", + "avatar_url": "https://avatars.githubusercontent.com/u/151142766?v=4", + "profile": "https://github.com/kaituna", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, From f93aafd39be9b013251a5fd8b596dac15494de0f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:28:54 +0000 Subject: [PATCH 32/37] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb2a744..655b851 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) @@ -63,6 +63,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Tom Smith
Tom Smith

💻 Matt Dray
Matt Dray

💻 kaituna
kaituna

📖 + Chris Mainey
Chris Mainey

💻 📖 From 7321e84f249360bba7261ecbd7c3d6fa180009b5 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:28:55 +0000 Subject: [PATCH 33/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index a79971f..ae8fb65 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -42,6 +42,16 @@ "contributions": [ "doc" ] + }, + { + "login": "chrismainey", + "name": "Chris Mainey", + "avatar_url": "https://avatars.githubusercontent.com/u/39626211?v=4", + "profile": "https://github.com/chrismainey", + "contributions": [ + "code", + "doc" + ] } ], "contributorsPerLine": 7, From bc598ce0688325d46ce5ef03ccc7a032d4a1c932 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:30:22 +0000 Subject: [PATCH 34/37] docs: update README.md [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 655b851..928b133 100755 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Tom Smith
Tom Smith

💻 Matt Dray
Matt Dray

💻 kaituna
kaituna

📖 - Chris Mainey
Chris Mainey

💻 📖 + Chris Mainey
Chris Mainey

💻 📖 ⚠️ From b88ee25da7c5dd7483b24bc3b8984a31d0c1ea40 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:30:23 +0000 Subject: [PATCH 35/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index ae8fb65..7df4b4a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -50,7 +50,8 @@ "profile": "https://github.com/chrismainey", "contributions": [ "code", - "doc" + "doc", + "test" ] } ], From 12f3f25a2e76064a5f2e6c620ebe708bf6bdbc15 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:31:39 +0000 Subject: [PATCH 36/37] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 928b133..f029b42 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRwaitinglist/actions/workflows/R-CMD-check.yaml) @@ -64,6 +64,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Matt Dray
Matt Dray

💻 kaituna
kaituna

📖 Chris Mainey
Chris Mainey

💻 📖 ⚠️ + PeterSNHS
PeterSNHS

📖 From 58b2a70ce39e21196ebdc2308af8f6ac602521c0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:31:40 +0000 Subject: [PATCH 37/37] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7df4b4a..ba319dc 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -53,6 +53,15 @@ "doc", "test" ] + }, + { + "login": "PeterSNHS", + "name": "PeterSNHS", + "avatar_url": "https://avatars.githubusercontent.com/u/67410797?v=4", + "profile": "https://github.com/PeterSNHS", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7,