diff --git a/R/anon_chi.R b/R/anon_chi.R deleted file mode 100644 index 3bc0a2535..000000000 --- a/R/anon_chi.R +++ /dev/null @@ -1,33 +0,0 @@ -#' Convert anon_chi to CHI numbers -#' -#' @param anon_chi a character vector of anon_chi. -#' -#' @return a character vector of the corresponding CHI numbers. -#' @family anon_chi -convert_anon_chi_to_chi <- Vectorize(function(anon_chi) { - openssl::base64_decode(anon_chi) %>% - substr(2, 2) %>% - paste0(collapse = "") -}) - -#' Convert CHI numbers to anon_chi -#' -#' @param chi a character vector of CHI numbers. -#' -#' @return a character vector of the corresponding anon_chi. -#' @family anon_chi -convert_chi_to_anon_chi <- Vectorize(function(chi) { - if (!all(phsmethods::chi_check(chi) %in% c( - "Valid CHI", - "Missing (Blank)", - "Missing (NA)" - ))) { - cli::cli_abort( - c("There were bad CHI numbers according to {.help {.fun phsmethods::chi_check}}.", - "i" = "{.param chi} must contain only valid or missing CHI numbers." - ) - ) - } - - openssl::base64_encode(chi) -}) diff --git a/man/convert_anon_chi_to_chi.Rd b/man/convert_anon_chi_to_chi.Rd deleted file mode 100644 index 292a8f3fe..000000000 --- a/man/convert_anon_chi_to_chi.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/anon_chi.R -\name{convert_anon_chi_to_chi} -\alias{convert_anon_chi_to_chi} -\title{Convert anon_chi to CHI numbers} -\usage{ -convert_anon_chi_to_chi(anon_chi) -} -\arguments{ -\item{anon_chi}{a character vector of anon_chi.} -} -\value{ -a character vector of the corresponding CHI numbers. -} -\description{ -Convert anon_chi to CHI numbers -} -\seealso{ -Other anon_chi: -\code{\link{convert_chi_to_anon_chi}()} -} -\concept{anon_chi} diff --git a/man/convert_chi_to_anon_chi.Rd b/man/convert_chi_to_anon_chi.Rd deleted file mode 100644 index bec9d8875..000000000 --- a/man/convert_chi_to_anon_chi.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/anon_chi.R -\name{convert_chi_to_anon_chi} -\alias{convert_chi_to_anon_chi} -\title{Convert CHI numbers to anon_chi} -\usage{ -convert_chi_to_anon_chi(chi) -} -\arguments{ -\item{chi}{a character vector of CHI numbers.} -} -\value{ -a character vector of the corresponding anon_chi. -} -\description{ -Convert CHI numbers to anon_chi -} -\seealso{ -Other anon_chi: -\code{\link{convert_anon_chi_to_chi}()} -} -\concept{anon_chi} diff --git a/tests/testthat/_snaps/anon_chi.md b/tests/testthat/_snaps/anon_chi.md deleted file mode 100644 index 577ba2368..000000000 --- a/tests/testthat/_snaps/anon_chi.md +++ /dev/null @@ -1,30 +0,0 @@ -# convert from anon_chi to CHI - - Code - tibble::tibble(anon_chi = anon_chi) %>% dplyr::mutate(chi = convert_anon_chi_to_chi( - anon_chi)) - Output - # A tibble: 5 x 2 - anon_chi chi - - 1 MDkwMTk2NTI4Ng== 0901965286 - 2 MDYwODYyNjgwNQ== 0608626805 - 3 MDkwNDc0NjIxNg== 0904746216 - 4 MTgxMjYzMTE0Ng== 1812631146 - 5 MjAwNDUzMzQ0Nw== 2004533447 - -# convert from CHI to anon_chi - - Code - tibble::tibble(chi = chi) %>% dplyr::mutate(anon_chi = convert_chi_to_anon_chi( - chi)) - Output - # A tibble: 5 x 2 - chi anon_chi - - 1 0901965286 MDkwMTk2NTI4Ng== - 2 0608626805 MDYwODYyNjgwNQ== - 3 0904746216 MDkwNDc0NjIxNg== - 4 1812631146 MTgxMjYzMTE0Ng== - 5 2004533447 MjAwNDUzMzQ0Nw== - diff --git a/tests/testthat/_snaps/get_lookup_paths.new.md b/tests/testthat/_snaps/get_lookup_paths.new.md new file mode 100644 index 000000000..dc4fbaa2c --- /dev/null +++ b/tests/testthat/_snaps/get_lookup_paths.new.md @@ -0,0 +1,9 @@ +# gpprac reference file path returns as expected + + Code + names(read_file(get_gpprac_ref_path())) + Output + [1] "cypher" "praccode" "add 1" "add 2" "add 3" "add 4" + [7] "postcode" "telephone" "gms" "chp" "start" "end" + [13] "chpstart" "hci" + diff --git a/tests/testthat/test-anon_chi.R b/tests/testthat/test-anon_chi.R deleted file mode 100644 index 8004a71e4..000000000 --- a/tests/testthat/test-anon_chi.R +++ /dev/null @@ -1,47 +0,0 @@ -test_that("convert from anon_chi to CHI", { - anon_chi <- c( - "MDkwMTk2NTI4Ng==", - "MDYwODYyNjgwNQ==", - "MDkwNDc0NjIxNg==", - "MTgxMjYzMTE0Ng==", - "MjAwNDUzMzQ0Nw==" - ) - - expect_equal(convert_anon_chi_to_chi(anon_chi), - c( - "0901965286", - "0608626805", - "0904746216", - "1812631146", - "2004533447" - ), - ignore_attr = TRUE - ) - - expect_snapshot(tibble::tibble(anon_chi = anon_chi) %>% - dplyr::mutate(chi = convert_anon_chi_to_chi(anon_chi))) -}) - -test_that("convert from CHI to anon_chi", { - chi <- c( - "0901965286", - "0608626805", - "0904746216", - "1812631146", - "2004533447" - ) - - expect_equal(convert_chi_to_anon_chi(chi), - c( - "MDkwMTk2NTI4Ng==", - "MDYwODYyNjgwNQ==", - "MDkwNDc0NjIxNg==", - "MTgxMjYzMTE0Ng==", - "MjAwNDUzMzQ0Nw==" - ), - ignore_attr = TRUE - ) - - expect_snapshot(tibble::tibble(chi = chi) %>% - dplyr::mutate(anon_chi = convert_chi_to_anon_chi(chi))) -})