Skip to content

Commit 1cca459

Browse files
Merge pull request #58 from FinOMOP/development
v2.1.0
2 parents ed54f1c + 6721a65 commit 1cca459

11 files changed

Lines changed: 36 additions & 17 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ROMOPMappingTools
22
Title: Tools for Working with OMOP CDM Mappings
3-
Version: 2.0.4
3+
Version: 2.1.0
44
Authors@R:
55
person("Javier", "Gracia-Tabuenca", , "javier.graciatabuenca@tuni.fi", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-2455-0598"))

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# ROMOPMappingTools 2.1.0
2+
3+
- Fixed concept_ancestor table generation. ICD10fi hierarchy was not correct, and duplicated rows were present in the table.
4+
- Added DRUG_STRENGTH table generation. This was missing, and created warnings in the DQD validation.
5+
- Fixed errors due to DatabaseConnector v7.0.0.
6+
17
# ROMOPMappingTools 2.0.5
28

39
- Fixed a bug in Usagi to STCM table conversion with respect to source parents

R/appendUsagiFileToSTCMtable.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ appendUsagiFileToSTCMtable <- function(
6767
#
6868

6969
# check if the sourceToConceptMapTable exists
70-
listTables <- DBI::dbListTables(connection, vocabularyDatabaseSchema)
70+
listTables <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
7171
if (!sourceToConceptMapTable %in% listTables) {
7272
stop(paste0("The sourceToConceptMapTable ", sourceToConceptMapTable, " does not exist in the vocabularyDatabaseSchema ", vocabularyDatabaseSchema))
7373
}

R/databasesFromAndToCSV.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ omopVocabularyCSVsToDuckDB <- function(
2424
"CONCEPT_RELATIONSHIP",
2525
"CONCEPT_SYNONYM",
2626
"DOMAIN",
27-
# "DRUG_STRENGTH", TEMP: loading makes error, leave out at the moment
27+
"DRUG_STRENGTH",
2828
"RELATIONSHIP",
2929
"VOCABULARY"
3030
)
@@ -113,7 +113,7 @@ duckdbToOMOPVocabularyCSVs <- function(
113113
OMOPVocabularyTableNames |>
114114
stringr::str_to_lower() |>
115115
checkmate::assertSubset(
116-
DatabaseConnector::dbListTables(connection)
116+
DatabaseConnector::getTableNames(connection)
117117
)
118118

119119
pathToOMOPVocabularyCSVsFolder |> checkmate::assertDirectoryExists()

R/updateUsagiFile.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ updateUsagiFile <- function(
5151
# Check if required tables exist
5252
# tables <- DatabaseConnector::getTableNames(condlnection, vocabularyDatabaseSchema)
5353
# TEMP untill solved https://github.com/OHDSI/DatabaseConnector/issues/299
54-
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
54+
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
5555
c("concept", "concept_relationship", "domain") |>
5656
checkmate::assertSubset(tableNames)
5757

R/validateCDMtablesWithDQD.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ validateCDMtablesWithDQD <- function(connectionDetails, vocabularyDatabaseSchema
2020
validationResultsFolder |> checkmate::assertDirectory()
2121

2222
connection <- DatabaseConnector::connect(connectionDetails)
23-
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
23+
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
2424
DatabaseConnector::disconnect(connection)
2525

2626
OMOPVocabularyTableNames <- c(

R/validateUsagiFile.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ validateUsagiFile <- function(
4141
# Check if required tables exist
4242
# tables <- DatabaseConnector::getTableNames(condlnection, vocabularyDatabaseSchema)
4343
# TEMP untill solved https://github.com/OHDSI/DatabaseConnector/issues/299
44-
tableNames <- DatabaseConnector::dbListTables(connection, vocabularyDatabaseSchema)
44+
tableNames <- DatabaseConnector::getTableNames(connection, vocabularyDatabaseSchema)
4545
c("concept", "concept_relationship", "domain") |>
4646
checkmate::assertSubset(tableNames)
4747

inst/sql/sql_server/CONCEPT_RELATIONSHIPToANCESTOR.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,13 @@ WITH RECURSIVE ancestor_cte AS (
7676
FROM #relationships
7777
) AS r
7878
)
79-
SELECT DISTINCT *
80-
FROM ancestor_cte_self_reference;
79+
SELECT
80+
ancestor_concept_id,
81+
descendant_concept_id,
82+
MIN(min_levels_of_separation) as min_levels_of_separation,
83+
MAX(max_levels_of_separation) as max_levels_of_separation
84+
FROM ancestor_cte_self_reference
85+
GROUP BY ancestor_concept_id, descendant_concept_id;
8186

8287

8388
-- 4- Remove the temporary table

inst/testdata/VOCABULARIES/ICD10fi/NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# ICD10fi v1.0.0
1717

1818
- Brought from old FinOMOP "Tietoriihi" GitLab with some minor fixes.
19-
- Mappings of 12 of the codes fixed in 2023-03.
19+
- Mappings of 12 of the codes fixed in 2023-03.

tests/testthat/test-appendUsagiFileToSTCMTable.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test_that("test appendUsagiFileToSTCMTable appends the usagi file to the sourceT
2828
expect_equal(nrowUsagiFile)
2929

3030
stcmTable |>
31-
dplyr::filter(TARGET_CONCEPT_ID != 0L) |>
31+
dplyr::filter(target_concept_id != 0L) |>
3232
dplyr::count() |> dplyr::pull(n) |>
3333
expect_equal(nrowUsagiFileMapped)
3434

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

7373
stcmTable |>
74-
dplyr::filter(TARGET_CONCEPT_ID != 0L) |>
74+
dplyr::filter(target_concept_id != 0L) |>
7575
dplyr::count() |> dplyr::pull(n) |>
7676
expect_equal(nrowUsagiFileMapped)
7777

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

8686
stcmTable |>
87-
dplyr::filter(is.na(SOURCE_PARENTS_CONCEPT_IDS)) |>
87+
dplyr::filter(is.na(source_parents_concept_ids)) |>
8888
nrow() |>
8989
expect_equal(0)
9090

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

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

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

132132
})

0 commit comments

Comments
 (0)