From 7e3215da42b2c92f395de458500deb23b1952d54 Mon Sep 17 00:00:00 2001 From: Jennit07 <67372904+Jennit07@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:21:05 +0100 Subject: [PATCH] Amend `get_boxi_extract_path` function for archiving DN and CMH data (#785) * Update `get_boxi_extract_path` for DN/CMH data * Remove extra function * [check-spelling] Update metadata Update for https://github.com/Public-Health-Scotland/source-linkage-files/actions/runs/5856792420/attempts/1 Accepted in https://github.com/Public-Health-Scotland/source-linkage-files/pull/785#issuecomment-1677400900 Signed-off-by: check-spelling-bot --------- Signed-off-by: check-spelling-bot Co-authored-by: Jennit07 Co-authored-by: James McMahon --- .github/actions/spelling/expect.txt | 1 + R/get_boxi_extract_path.R | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 87300a6a1..51c0a6c6b 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -91,6 +91,7 @@ hjust hms homecare homev +hscdiip hscp hscpnames IDPC diff --git a/R/get_boxi_extract_path.R b/R/get_boxi_extract_path.R index 60dd7857a..6096525e5 100644 --- a/R/get_boxi_extract_path.R +++ b/R/get_boxi_extract_path.R @@ -29,7 +29,11 @@ get_boxi_extract_path <- function( )) { type <- match.arg(type) - year_dir <- get_year_dir(year, extracts_dir = TRUE) + if (type %in% c("DN", "CMH")) { + dir <- fs::path(get_slf_dir(), "Archived_data") + } else { + dir <- get_year_dir(year, extracts_dir = TRUE) + } if (!check_year_valid(year, type)) { return(get_dummy_boxi_extract_path()) @@ -53,11 +57,12 @@ get_boxi_extract_path <- function( ) boxi_extract_path_csv_gz <- fs::path( - year_dir, + dir, stringr::str_glue("{file_name}-20{year}.csv.gz") ) + boxi_extract_path_csv <- fs::path( - year_dir, + dir, stringr::str_glue("{file_name}-20{year}.csv") )