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

[FEATURE] Mitigate Boilerplate for GenerateDatabaseDetails #50

Open
TheCedarPrince opened this issue Mar 19, 2023 · 1 comment
Open
Labels
enhancement New feature or request help wanted Extra attention is needed moderate Issue of moderate difficulty

Comments

@TheCedarPrince
Copy link
Member

Currently, GenerateDatabaseDetails is a bespoke boilerplate function that could be significantly simplified. I think what we could do is break up the function as it stands like this:

import HealthSampleData: Eunomia
import SQLite: DB
import OMOPCDMCohortCreator as occ

eunomia = Eunomia()

conn = DB(eunomia)

occ.GenerateDatabaseDetails(
    :sqlite,
    "main"
)

occ.GenerateTables(conn)

Into something like this:

import HealthSampleData: Eunomia
import DBConnector: DBConnect
import OMOPCDMCohortCreator as occ

eunomia = Eunomia()

occ.GenerateDatabaseDetails(conn = DBConnect(eunomia), schema = "main")

Basically, the function GenerateDatabaseDetails should accept as an object a DBConnect object that comes from DBConnector.jl. This object should contain information about the type of connection that was made (was it a sqlite connection? PostgreSQL connection?) and GenerateDatabaseDetails should then be able to internally set the flavor of SQL being used. Additionally, GenerateTables can be deprecated -- I'll detail that in another issue.

However, GenerateDatabaseDetails can still provide additional arguments like schema, SQL_type, etc in case someone needs additional configuration options in the future. But in my mind, this reduces complexity significantly.

@TheCedarPrince TheCedarPrince added enhancement New feature or request help wanted Extra attention is needed moderate Issue of moderate difficulty labels Mar 19, 2023
@TheCedarPrince
Copy link
Member Author

After all the work we have done within DBConnector.jl @Farreeda , I think we will be able to pursue something like this but it depends on JuliaDatabases/DBConnector.jl#8 and JuliaDatabases/DBConnector.jl#7 being done and also some cleaning up of the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed moderate Issue of moderate difficulty
Projects
None yet
Development

No branches or pull requests

1 participant