Skip to content

Commit

Permalink
deleted assigning #concept_counts as default for temp table
Browse files Browse the repository at this point in the history
  • Loading branch information
cebarboza committed Oct 4, 2024
1 parent 339dbd0 commit ba45d63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 74 deletions.
68 changes: 0 additions & 68 deletions R/RunDiagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
11 changes: 5 additions & 6 deletions man/executeDiagnostics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba45d63

Please sign in to comment.