From a8e86ac347fc142905c1ce67675d00e60fde025b Mon Sep 17 00:00:00 2001 From: javier-gracia-tabuenca-tuni Date: Mon, 29 Sep 2025 14:31:04 +0300 Subject: [PATCH 1/3] added DRUG_STRENGTH --- R/databasesFromAndToCSV.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/databasesFromAndToCSV.R b/R/databasesFromAndToCSV.R index 86bbd9e..781cff9 100644 --- a/R/databasesFromAndToCSV.R +++ b/R/databasesFromAndToCSV.R @@ -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" ) From deadbe76cfd5161ea25b937c46f3be9e0ff2f8cc Mon Sep 17 00:00:00 2001 From: javier-gracia-tabuenca-tuni Date: Mon, 29 Sep 2025 15:24:19 +0300 Subject: [PATCH 2/3] changed DBI::dbListTables with DatabaseConnector::getTableNames --- R/appendUsagiFileToSTCMtable.R | 2 +- R/databasesFromAndToCSV.R | 2 +- R/updateUsagiFile.R | 2 +- R/validateCDMtablesWithDQD.R | 2 +- R/validateUsagiFile.R | 2 +- tests/testthat/test-appendUsagiFileToSTCMTable.R | 14 +++++++------- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/appendUsagiFileToSTCMtable.R b/R/appendUsagiFileToSTCMtable.R index 2318b1b..8b2aacb 100644 --- a/R/appendUsagiFileToSTCMtable.R +++ b/R/appendUsagiFileToSTCMtable.R @@ -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)) } diff --git a/R/databasesFromAndToCSV.R b/R/databasesFromAndToCSV.R index 781cff9..217bf76 100644 --- a/R/databasesFromAndToCSV.R +++ b/R/databasesFromAndToCSV.R @@ -113,7 +113,7 @@ duckdbToOMOPVocabularyCSVs <- function( OMOPVocabularyTableNames |> stringr::str_to_lower() |> checkmate::assertSubset( - DatabaseConnector::dbListTables(connection) + DatabaseConnector::getTableNames(connection) ) pathToOMOPVocabularyCSVsFolder |> checkmate::assertDirectoryExists() diff --git a/R/updateUsagiFile.R b/R/updateUsagiFile.R index 2fd1bde..03fe78f 100644 --- a/R/updateUsagiFile.R +++ b/R/updateUsagiFile.R @@ -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) diff --git a/R/validateCDMtablesWithDQD.R b/R/validateCDMtablesWithDQD.R index 0ce3086..dfe9c13 100644 --- a/R/validateCDMtablesWithDQD.R +++ b/R/validateCDMtablesWithDQD.R @@ -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( diff --git a/R/validateUsagiFile.R b/R/validateUsagiFile.R index 4b2e3b1..eee9cb8 100644 --- a/R/validateUsagiFile.R +++ b/R/validateUsagiFile.R @@ -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) diff --git a/tests/testthat/test-appendUsagiFileToSTCMTable.R b/tests/testthat/test-appendUsagiFileToSTCMTable.R index e1894aa..6749c9c 100644 --- a/tests/testthat/test-appendUsagiFileToSTCMTable.R +++ b/tests/testthat/test-appendUsagiFileToSTCMTable.R @@ -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) @@ -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) @@ -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) @@ -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") }) From afbf486b0e5ba2298b29de510e73d477f89f15c7 Mon Sep 17 00:00:00 2001 From: javier-gracia-tabuenca-tuni Date: Mon, 29 Sep 2025 15:34:56 +0300 Subject: [PATCH 3/3] Updated NEWS.md to fix warning --- inst/testdata/VOCABULARIES/ICD10fi/NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/testdata/VOCABULARIES/ICD10fi/NEWS.md b/inst/testdata/VOCABULARIES/ICD10fi/NEWS.md index a20328b..c1a6df8 100644 --- a/inst/testdata/VOCABULARIES/ICD10fi/NEWS.md +++ b/inst/testdata/VOCABULARIES/ICD10fi/NEWS.md @@ -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. \ No newline at end of file +- Mappings of 12 of the codes fixed in 2023-03.