clinicalml / large-scale-temporal-shift-study

Code for Large-Scale Study of Temporal Shift in Health Insurance Claims. Christina X Ji, Ahmed M Alaa, David Sontag. CHIL, 2023. https://arxiv.org/abs/2305.05087
4 stars 0 forks source link

Host hardcoded in creation of sqlalchemy engine #5

Open egillax opened 11 months ago

egillax commented 11 months ago

I think in general the sqlalchemy.create_engine needs to be revised. To get it working for me I used:

engine = sqlalchemy.create_engine(f`postgresql://{config.user}:{config.password}@{config.host}/{config.dbname}`, echo=False)

Then I added user, password and host to the config file.

Might also be worth refactoring the engine creation and session execution out into a separate function since it's included in multiple functions and is always the same (that I've seen so far)

cxji commented 11 months ago

Thanks for suggesting the refactoring! Since it seems like how the engine is specified depends on how the database is set up, I added a create_sqlalchemy_engine function to config.py for users to specify how to create engines for their set-ups.