diff --git a/DESCRIPTION b/DESCRIPTION index 910a09e7..0f0e746c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: DataQualityDashboard Type: Package Title: Execute and View Data Quality Checks on OMOP CDM Database -Version: 2.4.1 -Date: 2023-10-18 +Version: 2.5.0 +Date: 2023-11-04 Authors@R: c( person("Katy", "Sadowski", email = "sadowski@ohdsi.org", role = c("aut", "cre")), person("Clair", "Blacketer", role = c("aut")), diff --git a/R/executeDqChecks.R b/R/executeDqChecks.R index 29082f33..178e0ab4 100644 --- a/R/executeDqChecks.R +++ b/R/executeDqChecks.R @@ -93,7 +93,7 @@ executeDqChecks <- function(connectionDetails, if (!str_detect(cdmVersion, regex(acceptedCdmRegex))) { stop("cdmVersion must contain a version of the form '5.X' where X is an integer between 2 and 4 inclusive.") } - + if (sqlOnlyIncrementalInsert == TRUE && sqlOnly == FALSE) { stop("Set `sqlOnly` to TRUE in order to use `sqlOnlyIncrementalInsert` mode.") } @@ -139,7 +139,7 @@ executeDqChecks <- function(connectionDetails, stop("Please populate the cdm_source table before executing data quality checks.") } if (nrow(metadata) > 1) { - metadata <- metadata[1,] + metadata <- metadata[1, ] warning("The cdm_source table has more than 1 row. A single row from this table has been selected to populate DQD metadata.") } metadata$dqdVersion <- as.character(packageVersion("DataQualityDashboard")) diff --git a/R/writeDBResultsTo.R b/R/writeDBResultsTo.R index 39ef902f..2b4e446a 100644 --- a/R/writeDBResultsTo.R +++ b/R/writeDBResultsTo.R @@ -27,52 +27,51 @@ #' writeDBResultsToJson <- function(connection, - resultsDatabaseSchema, - cdmDatabaseSchema, - writeTableName, - outputFolder, - outputFile) { - metadata <- DatabaseConnector::renderTranslateQuerySql( - connection, - sql = "select * from @cdmDatabaseSchema.cdm_source;", - snakeCaseToCamelCase = TRUE, - cdmDatabaseSchema = cdmDatabaseSchema - ) + resultsDatabaseSchema, + cdmDatabaseSchema, + writeTableName, + outputFolder, + outputFile) { + metadata <- DatabaseConnector::renderTranslateQuerySql( + connection, + sql = "select * from @cdmDatabaseSchema.cdm_source;", + snakeCaseToCamelCase = TRUE, + cdmDatabaseSchema = cdmDatabaseSchema + ) - checkResults <- DatabaseConnector::renderTranslateQuerySql( - connection, - sql = "select * from @resultsDatabaseSchema.@writeTableName;", - snakeCaseToCamelCase = TRUE, - resultsDatabaseSchema = resultsDatabaseSchema, - writeTableName = writeTableName - ) + checkResults <- DatabaseConnector::renderTranslateQuerySql( + connection, + sql = "select * from @resultsDatabaseSchema.@writeTableName;", + snakeCaseToCamelCase = TRUE, + resultsDatabaseSchema = resultsDatabaseSchema, + writeTableName = writeTableName + ) - # Quick patch for missing value issues related to SQL Only Implementation - checkResults["error"][checkResults["error"] == ''] <- NA - checkResults["warning"][checkResults["warning"] == ''] <- NA - checkResults["executionTime"][checkResults["executionTime"] == ''] <- '0 secs' - checkResults["queryText"][checkResults["queryText"] == ''] <- '[Generated via SQL Only]' + # Quick patch for missing value issues related to SQL Only Implementation + checkResults["error"][checkResults["error"] == ""] <- NA + checkResults["warning"][checkResults["warning"] == ""] <- NA + checkResults["executionTime"][checkResults["executionTime"] == ""] <- "0 secs" + checkResults["queryText"][checkResults["queryText"] == ""] <- "[Generated via SQL Only]" - overview <- .summarizeResults( - checkResults = checkResults - ) + overview <- .summarizeResults( + checkResults = checkResults + ) - # Quick patch for non-camel-case column name - names(checkResults)[names(checkResults) == "checkid"] <- "checkId" + # Quick patch for non-camel-case column name + names(checkResults)[names(checkResults) == "checkid"] <- "checkId" - allResults <- list( - startTimestamp = Sys.time(), - endTimestamp = Sys.time(), - executionTime = '0 secs', - CheckResults = checkResults, - Metadata = metadata, - Overview = overview - ) + allResults <- list( + startTimestamp = Sys.time(), + endTimestamp = Sys.time(), + executionTime = "0 secs", + CheckResults = checkResults, + Metadata = metadata, + Overview = overview + ) - .writeResultsToJson( - allResults, - outputFolder, - outputFile - ) - -} \ No newline at end of file + .writeResultsToJson( + allResults, + outputFolder, + outputFile + ) +} diff --git a/_pkgdown.yml b/_pkgdown.yml index 57941eb8..63139cb3 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -63,3 +63,7 @@ reference: desc: > Function to convert the case of a results JSON file between snakecase and camelcase contents: convertJsonResultsFileCase + - title: "Write database results to a JSON file" + desc: > + Function to write DQD results from a database table into a JSON file + contents: writeDBResultsToJson diff --git a/docs/404.html b/docs/404.html index ca0796ad..727f16f7 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 31e872f3..10a745e8 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ diff --git a/docs/articles/AddNewCheck.html b/docs/articles/AddNewCheck.html index 22f4f9a4..345db18c 100644 --- a/docs/articles/AddNewCheck.html +++ b/docs/articles/AddNewCheck.html @@ -33,7 +33,7 @@ @@ -108,7 +108,7 @@vignettes/AddNewCheck.rmd
AddNewCheck.rmd
vignettes/CheckStatusDefinitions.rmd
CheckStatusDefinitions.rmd
vignettes/CheckTypeDescriptions.rmd
CheckTypeDescriptions.rmd
vignettes/DataQualityDashboard.rmd
DataQualityDashboard.rmd
vignettes/DqdForCohorts.rmd
DqdForCohorts.rmd
vignettes/SqlOnly.rmd
SqlOnly.rmd
vignettes/Thresholds.rmd
Thresholds.rmd
Convert JSON results file case
Function to write DQD results from a database table into a JSON file
+Write DQD results database table to json
R/writeDBResultsTo.R
+ writeDBResultsToJson.Rd
Write DQD results database table to json
+writeDBResultsToJson(
+ connection,
+ resultsDatabaseSchema,
+ cdmDatabaseSchema,
+ writeTableName,
+ outputFolder,
+ outputFile
+)
A connection object
The fully qualified database name of the results schema
The fully qualified database name of the CDM schema
Name of DQD results table in the database to read from
The folder to output the json results file to
The output filename of the json results file