From f8ae40fb87b1370e11f6c0f8955788db0ff49d58 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 09:50:06 +0100 Subject: [PATCH 1/5] Add {future} and {future.callr} as required packages --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 31b205b36..02b87f21b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,6 +28,8 @@ Imports: dtplyr (>= 1.3.0), fs (>= 1.6.1), fst (>= 0.9.8), + future (>= 1.33.0), + future.callr (>= 0.8.1), glue (>= 1.6.2), haven (>= 2.5.2), hms (>= 1.1.0), From dc0564a3b17a2cd4e6d0856be1d748cb8f6fa628 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 09:50:28 +0100 Subject: [PATCH 2/5] Use `.data$` --- R/produce_test_comparison.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/produce_test_comparison.R b/R/produce_test_comparison.R index dda1f2411..624623806 100644 --- a/R/produce_test_comparison.R +++ b/R/produce_test_comparison.R @@ -23,7 +23,7 @@ produce_test_comparison <- function(old_data, new_data, recid = FALSE) { dplyr::mutate( difference = round(.data$value_new - .data$value_old, digits = 2L), pct_change = .data$difference / .data$value_old, - issue = !dplyr::between(pct_change, -0.05, 0.05) + issue = !dplyr::between(.data$pct_change, -0.05, 0.05) ) } else { dplyr::full_join(old_data, @@ -34,7 +34,7 @@ produce_test_comparison <- function(old_data, new_data, recid = FALSE) { dplyr::mutate( difference = round(.data$value_new - .data$value_old, digits = 2L), pct_change = .data$difference / .data$value_old, - issue = !dplyr::between(pct_change, -0.05, 0.05) + issue = !dplyr::between(.data$pct_change, -0.05, 0.05) ) } } From 9828b897c06b67ca4107f8062475c93347b9156a Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 09:50:51 +0100 Subject: [PATCH 3/5] Document all parameters --- R/run_episode_file.R | 1 + man/join_cohort_lookups.Rd | 2 ++ 2 files changed, 3 insertions(+) diff --git a/R/run_episode_file.R b/R/run_episode_file.R index 00e864f40..df51d430d 100644 --- a/R/run_episode_file.R +++ b/R/run_episode_file.R @@ -340,6 +340,7 @@ create_cohort_lookups <- function(data, year, update = latest_update()) { #' Join cohort lookups #' #' @inheritParams store_ep_file_vars +#' @inheritParams get_demographic_cohorts_path #' #' @return The data including the Demographic and Service Use lookups. join_cohort_lookups <- function(data, year, update = latest_update()) { diff --git a/man/join_cohort_lookups.Rd b/man/join_cohort_lookups.Rd index 21f376bdc..fcd419a1b 100644 --- a/man/join_cohort_lookups.Rd +++ b/man/join_cohort_lookups.Rd @@ -10,6 +10,8 @@ join_cohort_lookups(data, year, update = latest_update()) \item{data}{The in progress episode file data.} \item{year}{The year to process, in FY format.} + +\item{update}{The update to use} } \value{ The data including the Demographic and Service Use lookups. From 26765169b7a67bba2052e10e6efd3ba53a8f87b8 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 09:51:18 +0100 Subject: [PATCH 4/5] Simplify the code and avoid using `runif` --- R/write_tests_xlsx.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/write_tests_xlsx.R b/R/write_tests_xlsx.R index c517e496e..e187149d5 100644 --- a/R/write_tests_xlsx.R +++ b/R/write_tests_xlsx.R @@ -47,7 +47,7 @@ write_tests_xlsx <- function(comparison_data, sheet_name, year = NULL) { while (fs::file_exists(path = in_use_path) && seconds < max_wait) { # While the tests are in use (wait a random number of seconds from 1 to 30) cli::cli_progress_update() - wait <- round(runif(1, 1, 15)) + wait <- sample(x = 3:15, size = 1) Sys.sleep(wait) seconds <- seconds + wait @@ -56,7 +56,7 @@ write_tests_xlsx <- function(comparison_data, sheet_name, year = NULL) { } # Final check to maybe avoid corrupting the workbook - Sys.sleep(round(runif(1, 1, 3))) + Sys.sleep(sample(x = 1:3, size = 1)) if (!fs::file_exists(path = in_use_path)) { fs::file_create(path = in_use_path) } else { From ce570062c0f3e3079d5475915d7db0d27fec0be7 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Mon, 17 Jul 2023 09:01:16 +0000 Subject: [PATCH 5/5] [check-spelling] Update metadata Update for https://github.com/Public-Health-Scotland/source-linkage-files/actions/runs/5573642848/attempts/1 Accepted in https://github.com/Public-Health-Scotland/source-linkage-files/pull/743#issuecomment-1637643299 Signed-off-by: check-spelling-bot --- .github/actions/spelling/expect.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 50162e23f..23691cb31 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -94,6 +94,7 @@ itle iwalk jaccard jan +jennifer jul keydate keyring @@ -104,6 +105,8 @@ ltc ltcs lubridate magrittr +Mcbride +mcmahon MMMYY monthflag mpat @@ -200,5 +203,6 @@ xintercept xlsx yearstay YYYYQX +zihao zsav zstd