[FEATURE] Mitigate Boilerplate for GenerateDatabaseDetails
#50
Description
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.