|
1 |
| -test_that("Creating and checking externalConceptCounts table", { |
2 |
| - if (dbmsToTest == "sqlite") { |
3 |
| - connectionDetails <- testServers[["sqlite"]]$connectionDetails |
4 |
| - connection <- connect(connectionDetails) |
5 |
| - cdmDatabaseSchema <- testServers[["sqlite"]]$cdmDatabaseSchema |
6 |
| - conceptCountsTable <- "concept_counts" |
7 |
| - CohortDiagnostics::createConceptCountsTable(connectionDetails = connectionDetails, |
8 |
| - cdmDatabaseSchema = cdmDatabaseSchema, |
9 |
| - tempEmulationSchema = NULL, |
10 |
| - conceptCountsTable = "concept_counts", |
11 |
| - conceptCountsDatabaseSchema = cdmDatabaseSchema, |
12 |
| - conceptCountsTableIsTemp = FALSE, |
13 |
| - removeCurrentTable = TRUE) |
14 |
| - |
15 |
| - concept_counts_info <- querySql(connection, "PRAGMA table_info(concept_counts)") |
16 |
| - expect_equal(concept_counts_info$NAME, c("concept_id", |
17 |
| - "concept_count", |
18 |
| - "concept_subjects", |
19 |
| - "vocabulary_version")) |
20 |
| - checkConceptCountsTableExists <- DatabaseConnector::dbExistsTable(connection, |
21 |
| - name = conceptCountsTable, |
22 |
| - databaseSchema = cdmDatabaseSchema) |
23 |
| - expect_true(checkConceptCountsTableExists) |
24 |
| - |
25 |
| - # Checking vocab version matches |
26 |
| - useExternalConceptCountsTable <- TRUE |
27 |
| - conceptCountsTable <- "concept_counts" |
28 |
| - conceptCountsTable <- conceptCountsTable |
29 |
| - dataSourceInfo <- getCdmDataSourceInformation(connection = connection, cdmDatabaseSchema = cdmDatabaseSchema) |
30 |
| - vocabVersion <- dataSourceInfo$vocabularyVersion |
31 |
| - vocabVersionExternalConceptCountsTable <- renderTranslateQuerySql( |
32 |
| - connection = connection, |
33 |
| - sql = "SELECT DISTINCT vocabulary_version FROM @work_database_schema.@concept_counts_table;", |
34 |
| - work_database_schema = cdmDatabaseSchema, |
35 |
| - concept_counts_table = conceptCountsTable, |
36 |
| - snakeCaseToCamelCase = TRUE, |
37 |
| - tempEmulationSchema = getOption("sqlRenderTempEmulationSchena") |
38 |
| - ) |
39 |
| - |
40 |
| - expect_equal(vocabVersion, vocabVersionExternalConceptCountsTable[1,1]) |
41 |
| - } |
42 |
| - |
43 |
| -}) |
44 |
| - |
45 |
| -test_that("Creating and checking externalConceptCounts temp table", { |
46 |
| - if (dbmsToTest == "sqlite") { |
47 |
| - # Creating externalConceptCounts |
48 |
| - # sql_lite_path <- file.path(test_path(), databaseFile) |
49 |
| - connectionDetails <- testServers[["sqlite"]]$connectionDetails |
50 |
| - connection <- connect(connectionDetails) |
51 |
| - cdmDatabaseSchema <- testServers[["sqlite"]]$cdmDatabaseSchema |
52 |
| - conceptCountsTable <- "concept_counts" |
53 |
| - CohortDiagnostics::createConceptCountsTable(connectionDetails = connectionDetails, |
54 |
| - cdmDatabaseSchema = cdmDatabaseSchema, |
55 |
| - tempEmulationSchema = NULL, |
56 |
| - conceptCountsTable = conceptCountsTable, |
57 |
| - conceptCountsDatabaseSchema = cdmDatabaseSchema, |
58 |
| - conceptCountsTableIsTemp = TRUE, |
59 |
| - removeCurrentTable = TRUE) |
60 |
| - |
61 |
| - concept_counts_info <- querySql(connection, "PRAGMA table_info(concept_counts)") |
62 |
| - expect_equal(concept_counts_info$NAME, c("concept_id", |
63 |
| - "concept_count", |
64 |
| - "concept_subjects")) |
65 |
| - checkConceptCountsTableExists <- DatabaseConnector::dbExistsTable(connection, |
66 |
| - name = conceptCountsTable, |
67 |
| - databaseSchema = cdmDatabaseSchema) |
68 |
| - expect_true(checkConceptCountsTableExists) |
69 |
| - } |
70 |
| -}) |
| 1 | +# test_that("Creating and checking externalConceptCounts table", { |
| 2 | +# if (dbmsToTest == "sqlite") { |
| 3 | +# connectionDetails <- testServers[["sqlite"]]$connectionDetails |
| 4 | +# connection <- connect(connectionDetails) |
| 5 | +# cdmDatabaseSchema <- testServers[["sqlite"]]$cdmDatabaseSchema |
| 6 | +# conceptCountsTable <- "concept_counts" |
| 7 | +# CohortDiagnostics::createConceptCountsTable(connectionDetails = connectionDetails, |
| 8 | +# cdmDatabaseSchema = cdmDatabaseSchema, |
| 9 | +# tempEmulationSchema = NULL, |
| 10 | +# conceptCountsTable = "concept_counts", |
| 11 | +# conceptCountsDatabaseSchema = cdmDatabaseSchema, |
| 12 | +# conceptCountsTableIsTemp = FALSE, |
| 13 | +# removeCurrentTable = TRUE) |
| 14 | +# |
| 15 | +# concept_counts_info <- querySql(connection, "PRAGMA table_info(concept_counts)") |
| 16 | +# expect_equal(concept_counts_info$NAME, c("concept_id", |
| 17 | +# "concept_count", |
| 18 | +# "concept_subjects", |
| 19 | +# "vocabulary_version")) |
| 20 | +# checkConceptCountsTableExists <- DatabaseConnector::dbExistsTable(connection, |
| 21 | +# name = conceptCountsTable, |
| 22 | +# databaseSchema = cdmDatabaseSchema) |
| 23 | +# expect_true(checkConceptCountsTableExists) |
| 24 | +# |
| 25 | +# # Checking vocab version matches |
| 26 | +# useExternalConceptCountsTable <- TRUE |
| 27 | +# conceptCountsTable <- "concept_counts" |
| 28 | +# conceptCountsTable <- conceptCountsTable |
| 29 | +# dataSourceInfo <- getCdmDataSourceInformation(connection = connection, cdmDatabaseSchema = cdmDatabaseSchema) |
| 30 | +# vocabVersion <- dataSourceInfo$vocabularyVersion |
| 31 | +# vocabVersionExternalConceptCountsTable <- renderTranslateQuerySql( |
| 32 | +# connection = connection, |
| 33 | +# sql = "SELECT DISTINCT vocabulary_version FROM @work_database_schema.@concept_counts_table;", |
| 34 | +# work_database_schema = cdmDatabaseSchema, |
| 35 | +# concept_counts_table = conceptCountsTable, |
| 36 | +# snakeCaseToCamelCase = TRUE, |
| 37 | +# tempEmulationSchema = getOption("sqlRenderTempEmulationSchena") |
| 38 | +# ) |
| 39 | +# |
| 40 | +# expect_equal(vocabVersion, vocabVersionExternalConceptCountsTable[1,1]) |
| 41 | +# } |
| 42 | +# |
| 43 | +# }) |
| 44 | +# |
| 45 | +# test_that("Creating and checking externalConceptCounts temp table", { |
| 46 | +# if (dbmsToTest == "sqlite") { |
| 47 | +# # Creating externalConceptCounts |
| 48 | +# # sql_lite_path <- file.path(test_path(), databaseFile) |
| 49 | +# connectionDetails <- testServers[["sqlite"]]$connectionDetails |
| 50 | +# connection <- connect(connectionDetails) |
| 51 | +# cdmDatabaseSchema <- testServers[["sqlite"]]$cdmDatabaseSchema |
| 52 | +# conceptCountsTable <- "concept_counts" |
| 53 | +# CohortDiagnostics::createConceptCountsTable(connectionDetails = connectionDetails, |
| 54 | +# cdmDatabaseSchema = cdmDatabaseSchema, |
| 55 | +# tempEmulationSchema = NULL, |
| 56 | +# conceptCountsTable = conceptCountsTable, |
| 57 | +# conceptCountsDatabaseSchema = cdmDatabaseSchema, |
| 58 | +# conceptCountsTableIsTemp = TRUE, |
| 59 | +# removeCurrentTable = TRUE) |
| 60 | +# |
| 61 | +# concept_counts_info <- querySql(connection, "PRAGMA table_info(concept_counts)") |
| 62 | +# expect_equal(concept_counts_info$NAME, c("concept_id", |
| 63 | +# "concept_count", |
| 64 | +# "concept_subjects")) |
| 65 | +# checkConceptCountsTableExists <- DatabaseConnector::dbExistsTable(connection, |
| 66 | +# name = conceptCountsTable, |
| 67 | +# databaseSchema = cdmDatabaseSchema) |
| 68 | +# expect_true(checkConceptCountsTableExists) |
| 69 | +# } |
| 70 | +# }) |
0 commit comments