install.packages("remotes") remotes::install_github("OHDSI/DataQualityDashboard")
To view the JSON results in the shiny application the package requires that the CDM_SOURCE table has at least one row with some details about the database. This is to ensure that some metadata is delivered along with the JSON, should it be shared. As a best practice it is recommended to always fill in this table during ETL or at least prior to running the DQD.
```r
connectionDetails <- DatabaseConnector::createConnectionDetails( dbms = "", user = "", password = "", server = "", port = "", extraSettings = "", pathToDriver = "" )
cdmDatabaseSchema <- "yourCdmSchema" # the fully qualified database schema name of the CDM resultsDatabaseSchema <- "yourResultsSchema" # the fully qualified database schema name of the results schema (that you can write to) cdmSourceName <- "Your CDM Source" # a human readable name for your CDM source cdmVersion <- "5.4" # the CDM version you are targetting. Currently supports 5.2, 5.3, and 5.4
numThreads <- 1 # on Redshift, 3 seems to work well
sqlOnly <- FALSE # set to TRUE if you just want to get the SQL scripts and not actually run the queries sqlOnlyIncrementalInsert <- FALSE # set to TRUE if you want the generated SQL queries to calculate DQD results and insert them into a database table (@resultsDatabaseSchema.@writeTableName) sqlOnlyUnionCount <- 1 # in sqlOnlyIncrementalInsert mode, the number of check sqls to union in a single query; higher numbers can improve performance in some DBMS (e.g. a value of 25 may be 25x faster)
outputFolder <- "output" outputFile <- "results.json"
verboseMode <- TRUE # set to FALSE if you don't want the logs to be printed to the console
writeToTable <- TRUE # set to FALSE if you want to skip writing to a SQL table in the results schema
writeTableName <- "dqdashboard_results"
writeToCsv <- FALSE # set to FALSE if you want to skip writing to csv file csvFile <- "" # only needed if writeToCsv is set to TRUE
checkLevels <- c("TABLE", "FIELD", "CONCEPT")
checkNames <- c() # Names can be found in inst/csv/OMOP_CDM_v5.3_Check_Descriptions.csv
checkSeverity <- c("fatal", "convention", "characterization")
tablesToExclude <- c("CONCEPT", "VOCABULARY", "CONCEPT_ANCESTOR", "CONCEPT_RELATIONSHIP", "CONCEPT_CLASS", "CONCEPT_SYNONYM", "RELATIONSHIP", "DOMAIN") # list of CDM table names to skip evaluating checks against; by default DQD excludes the vocab tables
DataQualityDashboard::executeDqChecks(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, resultsDatabaseSchema = resultsDatabaseSchema, cdmSourceName = cdmSourceName, cdmVersion = cdmVersion, numThreads = numThreads, sqlOnly = sqlOnly, sqlOnlyUnionCount = sqlOnlyUnionCount, sqlOnlyIncrementalInsert = sqlOnlyIncrementalInsert, outputFolder = outputFolder, outputFile = outputFile, verboseMode = verboseMode, writeToTable = writeToTable, writeToCsv = writeToCsv, csvFile = csvFile, checkLevels = checkLevels, checkSeverity = checkSeverity, tablesToExclude = tablesToExclude, checkNames = checkNames)
ParallelLogger::launchLogViewer(logFileName = file.path(outputFolder, cdmSourceName, sprintf("log_DqDashboard_%s.txt", cdmSourceName)))
jsonFilePath <- "" DataQualityDashboard::writeJsonResultsToTable(connectionDetails = connectionDetails, resultsDatabaseSchema = resultsDatabaseSchema, jsonFilePath = jsonFilePath)
Viewing Results ================ **Launching Dashboard as Shiny App** ```r # Use the fully-qualified path to the JSON results file DataQualityDashboard::viewDqDashboard(jsonFilePath)
Launching on a web server
If you have npm installed:
npm install -g http-server
Name the output file results.json and place it in inst/shinyApps/www
Go to inst/shinyApps/www, then run:
http-server
To see description of checks using R, execute the command below:
checks <- DataQualityDashboard::listDqChecks(cdmVersion = "5.3") # Put the version of the CDM you are using
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.