OHDSI / Eunomia

An R package that facilitates access to a variety of OMOP CDM sample data sets.
https://ohdsi.github.io/Eunomia/
42 stars 11 forks source link

Remove Eunomia's dependency on the Java programming language #43

Open ablack3 opened 1 year ago

ablack3 commented 1 year ago

getEunomiaConnectionDetails is a Eunomia function that returns a connectionDetails object. I'm thinking we could transition to this API instead.

library(DatabaseConnector)

connectionDetails <- createConnectionDetails("sqlite", server = Eunomia::eunomiaDir("GiBleed"))

connection <- connect(connectionDetails)
#> Connecting using SQLite driver

querySql(connection, "select * from main.person limit 2")
#>   PERSON_ID GENDER_CONCEPT_ID YEAR_OF_BIRTH MONTH_OF_BIRTH DAY_OF_BIRTH
#> 1         6              8532          1963             12           31
#> 2       123              8507          1950              4           12
#>   BIRTH_DATETIME RACE_CONCEPT_ID ETHNICITY_CONCEPT_ID LOCATION_ID PROVIDER_ID
#> 1     1963-12-31            8516                    0          NA          NA
#> 2     1950-04-12            8527                    0          NA          NA
#>   CARE_SITE_ID                  PERSON_SOURCE_VALUE GENDER_SOURCE_VALUE
#> 1           NA 001f4a87-70d0-435c-a4b9-1425f6928d33                   F
#> 2           NA 052d9254-80e8-428f-b8b6-69518b0ef3f3                   M
#>   GENDER_SOURCE_CONCEPT_ID RACE_SOURCE_VALUE RACE_SOURCE_CONCEPT_ID
#> 1                        0             black                      0
#> 2                        0             white                      0
#>   ETHNICITY_SOURCE_VALUE ETHNICITY_SOURCE_CONCEPT_ID
#> 1            west_indian                           0
#> 2                italian                           0

disconnect(connection)

Created on 2023-04-07 with reprex v2.0.2

what is the benefit of this API over the current one?

Well it would mean that Eunomia would no longer need to import DatabaseConnector and would no longer require Java. DatabaseConnector would still require Java of course but Eunomia would not. It would make Eunomia available to be used in environments where Java is not installed or not working properly.

We could also still support getEunomiaConnectionDetails and remove the dependency on DatabaseConnector/Java by manually assigning the "ConnectionDetails" class.

ablack3 commented 1 year ago

@ginberg, @edward-burn, @catalamarti Here is my proposal to remove Eunomia's Java dependency. It does not make a lot of sense to me that Eunomia needs to depend on Java since it is just a sqlite (or duckdb) database and some R code for file management. I would consider Java a fairly heavy dependency for Eunomia.

@fdefalco what do you think?

ablack3 commented 1 year ago

Implemented this in a PR after discussing it with @fdefalco on Teams chat.