Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decaffeinate Eunomia #49

Merged
merged 19 commits into from
Jun 21, 2023
Merged

Decaffeinate Eunomia #49

merged 19 commits into from
Jun 21, 2023

Conversation

ablack3
Copy link
Collaborator

@ablack3 ablack3 commented Jun 15, 2023

Addresses issue #43

This PR removes Eunomia's dependency on the Java programming language. I have not changed any of the tests and even added a few more. All the tests pass implying that this change does not break the package. Code coverage is close to 100%.

The only change that could be considered breaking is that I deprecated the cohortTable argument of the createCohorts function. Now cohort tables are always named cohort. If there is any concern about this I'll happily roll that back and allow the user to name the cohort table.

@fdefalco will you please review this PR?

Tagging others for awareness: @edward-burn @ginberg @pbr6cornell @schuemie

Update: I did change change the tests that used getConnectionDetails in favor of using getDatabaseFile. Since getConnectionDetails has never been released this should not be considered a breaking change.

@ablack3 ablack3 requested a review from fdefalco June 15, 2023 16:40
@fdefalco
Copy link
Collaborator

Minor suggestion: rename eunomiaDir to createDatabaseFile or getDatabaseFile

@ablack3
Copy link
Collaborator Author

ablack3 commented Jun 16, 2023

I also just realized that v2 hasn't been released yet so we can simply remove getConnectionDetails in favor of getDatabaseFile instead of deprecated getConnectionDetails which hasn't been released. This will require changing the tests for getConnectionDetails

@ablack3
Copy link
Collaborator Author

ablack3 commented Jun 16, 2023

What in the world... So confused by this error... "Error: not an error" but only on windows. Huh? 😐

image

Figured it out. Apparently regex is OS dependent! 🤣

R/Connection.R Outdated
@@ -27,52 +27,30 @@
#'
#' @export
getEunomiaConnectionDetails <- function() {
details <- getConnectionDetails(datasetName = "GiBleed")
return(details)
rlang::inform('getEunomiaConnectionDetails() will be deprecated in a future release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deprecate this function? Seems like there's no harm in having this function for DatabaseConnector users?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason to deprecate it is that getEunomiaConnectionDetails requires Java. If users switch to this syntax we can remove Java as a dependency of the Eunomia package. It's a significant reduction in the dependencies.

createConnectionDetails(dbms = "sqlite", server = getDatabaseFile())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the Book of OHDIS exercises use this function (e.g. here, so we would be breaking all those. (And we'd also need to fix all HADES package unit tests, which is doable, but we could spend those cycles on more important things)

And pretty much all HADES packages depend on Java, so there's no real gain in removing that dependency.

Hence, I'm strongly in favor of keeping this function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that makes sense. I would like to make the Eunomia functionality (i.e. downloading example cdm datasets) available on CRAN without a dependency on Java. Does anyone object if I do this in a separate non-Hades Apache licensed R package that I'll maintain?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If DatabaseConnector is in the Suggests section, isn't that enough? You would be able to install the package without Java, and would make it similar to CDMConnector.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep exactly. This PR includes DatabaseConnector under Suggests because it is needed to run tests.
Keep in mind that this PR should not break existing code. It just prints a message informing users that getEunomiaConnectionDetails will be deprecated at some point in the future and suggests a replacement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, putting DatabaseConnector under Suggests would be fine for keeping backwards compatibility. I was just suggesting we don't print the deprecation message (and not deprecate this function in the near term).

We may want to add some code that ensures DatabaseConnector is installed when someone calls this function, like we do here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok yes this seems like a good solution. I'll make the change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid installing duckdb on linux in github actions. The compilation takes almost forever!

Copy link
Collaborator Author

@ablack3 ablack3 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the update. getEunomiaConnectionDetails is optional in this PR. I think this should work on CRAN. getConnectionDetails has still been removed in favor of using createConnectionDetails from DatabaseConnector.

@fdefalco fdefalco requested a review from schuemie June 19, 2023 18:27
@@ -39,6 +39,12 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- name: Install DatabaseConnector for tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies in Suggests are automatically installed by the default script, so this is not necessary.

Copy link
Collaborator Author

@ablack3 ablack3 Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting an error on github actions and adding that step fixed it. I can try removing it. https://github.com/OHDSI/Eunomia/actions/runs/5281622666/jobs/9555457012#step:12:90

image

R/Cohorts.R Outdated
#' will be written.
#' @param cdmDatabaseSchema Deprecated. The cdm must be created in the main schema.
#' @param cohortDatabaseSchema Deprecated. The cohort table will be created in the main schema.
#' @param cohortTable Deprecated. Cohort table will be named "main".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? I think the cohort table will be named 'cohort'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep that's a typo.

@schuemie
Copy link
Member

I found 2 minor issues (see my comments). Looks good otherwise.

@ablack3
Copy link
Collaborator Author

ablack3 commented Jun 21, 2023

I found 2 minor issues (see my comments). Looks good otherwise.

Thanks for the review @schuemie. I made the changes (typo and github actions). @fdefalco any objection if I merge this?

@fdefalco
Copy link
Collaborator

No issues, I added my review approval as well. Merge away. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants