From ceebb3e1a0cbfaa34a6412c3742abc7f8b3aa3dd Mon Sep 17 00:00:00 2001 From: Katy Sadowski Date: Mon, 16 Oct 2023 12:19:42 -0400 Subject: [PATCH 1/2] add readr local edition downgrade --- R/convertResultsCase.R | 3 +++ R/executeDqChecks.R | 3 +++ R/listChecks.R | 4 ++++ man/executeDqChecks.Rd | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/R/convertResultsCase.R b/R/convertResultsCase.R index 0668b211..92c77f77 100644 --- a/R/convertResultsCase.R +++ b/R/convertResultsCase.R @@ -46,6 +46,9 @@ convertJsonResultsFileCase <- function( if (writeToFile && is.na(outputFolder)) { stop("You must specify an output folder if writing to file.") } + + # temporary patch to work around vroom 1.6.4 bug + readr::local_edition(1) results <- jsonlite::fromJSON(jsonFilePath) diff --git a/R/executeDqChecks.R b/R/executeDqChecks.R index 500de89c..aa38ee5e 100644 --- a/R/executeDqChecks.R +++ b/R/executeDqChecks.R @@ -118,6 +118,9 @@ executeDqChecks <- function(connectionDetails, warning(sprintf("Missing check names to calculate the 'Not Applicable' status: %s", missingNACheckNames)) } } + + # temporary patch to work around vroom 1.6.4 bug + readr::local_edition(1) # capture metadata ----------------------------------------------------------------------- if (!sqlOnly) { diff --git a/R/listChecks.R b/R/listChecks.R index ddeccbb4..db7ff3b3 100644 --- a/R/listChecks.R +++ b/R/listChecks.R @@ -28,6 +28,10 @@ #' #' @export listDqChecks <- function(cdmVersion = "5.3", tableCheckThresholdLoc = "default", fieldCheckThresholdLoc = "default", conceptCheckThresholdLoc = "default") { + + # temporary patch to work around vroom 1.6.4 bug + readr::local_edition(1) + dqChecks <- {} dqChecks$checkDescriptions <- read_csv(system.file( diff --git a/man/executeDqChecks.Rd b/man/executeDqChecks.Rd index 1ae7d2e2..0b7b5f7f 100644 --- a/man/executeDqChecks.Rd +++ b/man/executeDqChecks.Rd @@ -92,5 +92,5 @@ with the fields cohort_definition_id and subject_id.} If sqlOnly = FALSE, a list object of results } \description{ -This function will connect to the database, generate the sql scripts, and run the data quality checks against the database. +This function will connect to the database, generate the sql scripts, and run the data quality checks against the database. By default, results will be written to a json file as well as a database table. } From ca1a9419a48b060a8531c0f6b071dee999dbc031 Mon Sep 17 00:00:00 2001 From: Katy Sadowski Date: Mon, 16 Oct 2023 12:35:04 -0400 Subject: [PATCH 2/2] fix naming conflict, add imports --- NAMESPACE | 1 + R/convertResultsCase.R | 1 + R/executeDqChecks.R | 2 +- R/listChecks.R | 2 +- tests/testthat/test-executeDqChecks.R | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 69aad71c..690105a7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ importFrom(jsonlite,fromJSON) importFrom(jsonlite,parse_json) importFrom(jsonlite,toJSON) importFrom(magrittr,"%>%") +importFrom(readr,local_edition) importFrom(readr,read_csv) importFrom(rlang,.data) importFrom(stats,na.omit) diff --git a/R/convertResultsCase.R b/R/convertResultsCase.R index 92c77f77..73aa5954 100644 --- a/R/convertResultsCase.R +++ b/R/convertResultsCase.R @@ -30,6 +30,7 @@ #' @importFrom SqlRender snakeCaseToCamelCase camelCaseToSnakeCase #' @importFrom dplyr rename_with #' @importFrom tools file_path_sans_ext +#' @importFrom readr local_edition #' #' @export diff --git a/R/executeDqChecks.R b/R/executeDqChecks.R index aa38ee5e..9cfd44fc 100644 --- a/R/executeDqChecks.R +++ b/R/executeDqChecks.R @@ -54,7 +54,7 @@ #' @importFrom utils packageVersion write.table #' @importFrom rlang .data #' @importFrom tidyselect all_of -#' @importFrom readr read_csv +#' @importFrom readr read_csv local_edition #' @importFrom dplyr mutate case_when #' #' @export diff --git a/R/listChecks.R b/R/listChecks.R index db7ff3b3..29ca602f 100644 --- a/R/listChecks.R +++ b/R/listChecks.R @@ -24,7 +24,7 @@ #' @param fieldCheckThresholdLoc The location of the threshold file for evaluating the field checks. If not specified the default thresholds will be applied. #' @param conceptCheckThresholdLoc The location of the threshold file for evaluating the concept checks. If not specified the default thresholds will be applied. #' -#' @importFrom readr read_csv +#' @importFrom readr read_csv local_edition #' #' @export listDqChecks <- function(cdmVersion = "5.3", tableCheckThresholdLoc = "default", fieldCheckThresholdLoc = "default", conceptCheckThresholdLoc = "default") { diff --git a/tests/testthat/test-executeDqChecks.R b/tests/testthat/test-executeDqChecks.R index e7cb2abf..01cb11b3 100644 --- a/tests/testthat/test-executeDqChecks.R +++ b/tests/testthat/test-executeDqChecks.R @@ -1,5 +1,5 @@ library(testthat) -local_edition(3) +testthat::local_edition(3) test_that("Execute a single DQ check on Synthea/Eunomia", { outputFolder <- tempfile("dqd_")