Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/appendUsagiFileToSTCMtable.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ appendUsagiFileToSTCMtable <- function(
#

# check if the sourceToConceptMapTable exists
listTables <- DBI::dbListTables(connection, vocabularyDatabaseSchema)
listTables <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
if (!sourceToConceptMapTable %in% listTables) {
stop(paste0("The sourceToConceptMapTable ", sourceToConceptMapTable, " does not exist in the vocabularyDatabaseSchema ", vocabularyDatabaseSchema))
}
Expand Down
4 changes: 2 additions & 2 deletions R/databasesFromAndToCSV.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ omopVocabularyCSVsToDuckDB <- function(
"CONCEPT_RELATIONSHIP",
"CONCEPT_SYNONYM",
"DOMAIN",
# "DRUG_STRENGTH", TEMP: loading makes error, leave out at the moment
"DRUG_STRENGTH",
"RELATIONSHIP",
"VOCABULARY"
)
Expand Down Expand Up @@ -113,7 +113,7 @@ duckdbToOMOPVocabularyCSVs <- function(
OMOPVocabularyTableNames |>
stringr::str_to_lower() |>
checkmate::assertSubset(
DatabaseConnector::dbListTables(connection)
DatabaseConnector::getTableNames(connection)
)

pathToOMOPVocabularyCSVsFolder |> checkmate::assertDirectoryExists()
Expand Down
2 changes: 1 addition & 1 deletion R/updateUsagiFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ updateUsagiFile <- function(
# Check if required tables exist
# tables <- DatabaseConnector::getTableNames(condlnection, vocabularyDatabaseSchema)
# TEMP untill solved https://github.com/OHDSI/DatabaseConnector/issues/299
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
c("concept", "concept_relationship", "domain") |>
checkmate::assertSubset(tableNames)

Expand Down
2 changes: 1 addition & 1 deletion R/validateCDMtablesWithDQD.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ validateCDMtablesWithDQD <- function(connectionDetails, vocabularyDatabaseSchema
validationResultsFolder |> checkmate::assertDirectory()

connection <- DatabaseConnector::connect(connectionDetails)
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
DatabaseConnector::disconnect(connection)

OMOPVocabularyTableNames <- c(
Expand Down
2 changes: 1 addition & 1 deletion R/validateUsagiFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ validateUsagiFile <- function(
# Check if required tables exist
# tables <- DatabaseConnector::getTableNames(condlnection, vocabularyDatabaseSchema)
# TEMP untill solved https://github.com/OHDSI/DatabaseConnector/issues/299
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
c("concept", "concept_relationship", "domain") |>
checkmate::assertSubset(tableNames)

Expand Down
2 changes: 1 addition & 1 deletion inst/testdata/VOCABULARIES/ICD10fi/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# ICD10fi v1.0.0

- Brought from old FinOMOP "Tietoriihi" GitLab with some minor fixes.
- Mappings of 12 of the codes fixed in 2023-03.
- Mappings of 12 of the codes fixed in 2023-03.
14 changes: 7 additions & 7 deletions tests/testthat/test-appendUsagiFileToSTCMTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test_that("test appendUsagiFileToSTCMTable appends the usagi file to the sourceT
expect_equal(nrowUsagiFile)

stcmTable |>
dplyr::filter(TARGET_CONCEPT_ID != 0L) |>
dplyr::filter(target_concept_id != 0L) |>
dplyr::count() |> dplyr::pull(n) |>
expect_equal(nrowUsagiFileMapped)

Expand Down Expand Up @@ -71,7 +71,7 @@ test_that("test appendUsagiFileToSTCMTable appends the usagi file to the sourceT
expect_equal(nrowUsagiFile)

stcmTable |>
dplyr::filter(TARGET_CONCEPT_ID != 0L) |>
dplyr::filter(target_concept_id != 0L) |>
dplyr::count() |> dplyr::pull(n) |>
expect_equal(nrowUsagiFileMapped)

Expand All @@ -84,7 +84,7 @@ test_that("test appendUsagiFileToSTCMTable appends the usagi file to the sourceT
"source_domain", "source_parents_concept_ids"))

stcmTable |>
dplyr::filter(is.na(SOURCE_PARENTS_CONCEPT_IDS)) |>
dplyr::filter(is.na(source_parents_concept_ids)) |>
nrow() |>
expect_equal(0)

Expand Down Expand Up @@ -119,14 +119,14 @@ test_that("test appendUsagiFileToSTCMTable appends the ICD10fi usagi file to the

# For source code C18.62 the parent concept IDs should be ICD10 code C18.6 with concept_id 45552246
stcmTable |>
dplyr::filter(SOURCE_CODE == "C18.62") |>
dplyr::pull(SOURCE_PARENTS_CONCEPT_IDS) |>
dplyr::filter(source_code == "C18.62") |>
dplyr::pull(source_parents_concept_ids) |>
expect_equal("45552246")

# For source code Y94.1 the parent concept IDs should be ICD10fi code Y94 with concept_id 2000503727
stcmTable |>
dplyr::filter(SOURCE_CODE == "Y94.1") |>
dplyr::pull(SOURCE_PARENTS_CONCEPT_IDS) |>
dplyr::filter(source_code == "Y94.1") |>
dplyr::pull(source_parents_concept_ids) |>
expect_equal("2000503725")

})
Loading