diff --git a/R/RunDiagnostics.R b/R/RunDiagnostics.R index cba6a4ae7..612f8bf87 100644 --- a/R/RunDiagnostics.R +++ b/R/RunDiagnostics.R @@ -700,9 +700,6 @@ executeDiagnostics <- function(cohortDefinitionSet, if (substr(conceptCountsTable, 1, 1) == "#") { conceptCountsTableIsTemp <- TRUE - if (conceptCountsTable != "#concept_counts") { - conceptCountsTable <- "#concept_counts" - } } else { conceptCountsTableIsTemp <- FALSE conceptCountsTable <- conceptCountsTable @@ -725,71 +722,6 @@ executeDiagnostics <- function(cohortDefinitionSet, "). Update concept_counts with createConceptCountsTable()")) } } - - - if (!checkConceptCountsTableExists) { - conceptCountsTableIsTemp <- TRUE - if (conceptCountsTable != "#concept_counts") { - conceptCountsTable <- "#concept_counts" - } - } else { - if (substr(conceptCountsTable, 1, 1) == "#") { - stop("Temporary conceptCountsTable name. Please provide a valid external ConceptCountsTable name") - } - conceptCountsTableIsTemp <- FALSE - conceptCountsTable <- conceptCountsTable - dataSourceInfo <- getCdmDataSourceInformation(connection = connection, - cdmDatabaseSchema = cdmDatabaseSchema) - vocabVersion <- dataSourceInfo$vocabularyVersion - vocabVersionExternalConceptCountsTable <- renderTranslateQuerySql( - connection = connection, - sql = "SELECT DISTINCT vocabulary_version FROM @work_database_schema.@concept_counts_table;", - work_database_schema = cohortDatabaseSchema, - concept_counts_table = conceptCountsTable, - snakeCaseToCamelCase = TRUE, - tempEmulationSchema = getOption("sqlRenderTempEmulationSchena") - ) - if (!identical(vocabVersion, vocabVersionExternalConceptCountsTable[1,1])) { - stop(paste0("External concept counts table (", - vocabVersionExternalConceptCountsTable, - ") does not match database (", - vocabVersion, - "). Update concept_counts with createConceptCountsTable()")) - } - } - - # ---- - - if (!checkConceptCountsTableExists) { - conceptCountsTableIsTemp <- TRUE - if (conceptCountsTable != "#concept_counts") { - conceptCountsTable <- "#concept_counts" - } - } else { - if (substr(conceptCountsTable, 1, 1) == "#") { - stop("Temporary conceptCountsTable name. Please provide a valid external ConceptCountsTable name") - } - conceptCountsTableIsTemp <- FALSE - conceptCountsTable <- conceptCountsTable - dataSourceInfo <- getCdmDataSourceInformation(connection = connection, - cdmDatabaseSchema = cdmDatabaseSchema) - vocabVersion <- dataSourceInfo$vocabularyVersion - vocabVersionExternalConceptCountsTable <- renderTranslateQuerySql( - connection = connection, - sql = "SELECT DISTINCT vocabulary_version FROM @work_database_schema.@concept_counts_table;", - work_database_schema = cohortDatabaseSchema, - concept_counts_table = conceptCountsTable, - snakeCaseToCamelCase = TRUE, - tempEmulationSchema = getOption("sqlRenderTempEmulationSchena") - ) - if (!identical(vocabVersion, vocabVersionExternalConceptCountsTable[1,1])) { - stop(paste0("External concept counts table (", - vocabVersionExternalConceptCountsTable, - ") does not match database (", - vocabVersion, - "). Update concept_counts with createConceptCountsTable()")) - } - } # Always export concept sets to csv exportConceptSets( diff --git a/man/executeDiagnostics.Rd b/man/executeDiagnostics.Rd index d14373a91..09da5e7e9 100644 --- a/man/executeDiagnostics.Rd +++ b/man/executeDiagnostics.Rd @@ -17,7 +17,6 @@ executeDiagnostics( tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), cohortTable = "cohort", cohortTableNames = CohortGenerator::getCohortTableNames(cohortTable = cohortTable), - conceptCountsTable = "#concept_counts", vocabularyDatabaseSchema = cdmDatabaseSchema, cohortIds = NULL, cdmVersion = 5, @@ -36,7 +35,7 @@ executeDiagnostics( irWashoutPeriod = 0, incremental = FALSE, incrementalFolder = file.path(exportFolder, "incremental"), - useExternalConceptCountsTable = FALSE, + conceptCountsTable = "concept_counts", runFeatureExtractionOnSample = FALSE, sampleN = 1000, seed = 64374, @@ -81,9 +80,6 @@ tables, provide a schema with write privileges where temp tables can be created. \item{cohortTableNames}{Cohort Table names used by CohortGenerator package} -\item{conceptCountsTable}{Concepts count table name. The default is "#concept_counts" to create a temporal concept counts table. -If an external concept counts table is used, provide the name in character, e.g. "concept_counts" without a hash} - \item{vocabularyDatabaseSchema}{Schema name where your OMOP vocabulary data resides. This is commonly the same as cdmDatabaseSchema. Note that for SQL Server, this should include both the database and @@ -131,7 +127,8 @@ on covariates that have very low values. The default is 0.001 (i.e. 0.1 percent) \item{incrementalFolder}{If \code{incremental = TRUE}, specify a folder where records are kept of which cohort diagnostics has been executed.} -\item{useExternalConceptCountsTable}{If TRUE an external table for the cohort concept counts will be used.} +\item{conceptCountsTable}{Concepts count table name. The default is "#concept_counts" to create a temporal concept counts table. +If an external concept counts table is used, provide the name in character, e.g. "concept_counts" without a hash} \item{runFeatureExtractionOnSample}{Logical. If TRUE, the function will operate on a sample of the data. Default is FALSE, meaning the function will operate on the full data set.} @@ -144,6 +141,8 @@ This ensures that the same sample can be drawn again in future runs. Default is \item{seedArgs}{List. Additional arguments to pass to the sampling function. This can be used to control aspects of the sampling process beyond the seed and sample size.} + +\item{useExternalConceptCountsTable}{If TRUE an external table for the cohort concept counts will be used.} } \description{ Runs the cohort diagnostics on all (or a subset of) the cohorts instantiated using the