OHDSI / dbt-synthea

[Under development] A dbt ETL project to convert a Synthea synthetic data set into the OMOP CDM
https://ohdsi.github.io/dbt-synthea/
Apache License 2.0
16 stars 6 forks source link

refactor: build location model properly using patient and organization as a source #83

Closed lawrenceadams closed 4 weeks ago

lawrenceadams commented 1 month ago

This PR refactors the existing location model to have a valid PK to allow referencing from the patient and care_site tables. Previously the location table was orphaned and had duplicate entries.

The new referencing works by using a variation of address and city as a natural key to join on from other models.


I have some ongoing thoughts/issues:

There may be a far slicker approach to this but this is the best I can see for now! Happy to hear other's thoughts

lawrenceadams commented 1 month ago

Fair point - I considered this but thought we could get away without creating an extra model, but it's probably more elegant/scalable doing so

I can experiment with this! Will see if the hashing approach is neater

katy-sadowski commented 1 month ago

Thanks! I'm leaning towards creating the extra model either way because I like the idea of a unidirectional flow from stg-->int-->mart models. (In reality it might not be possible/practical to do this in all cases, but would like to give it a shot 😃 )

lawrenceadams commented 1 month ago

Agree! Best to keep it uniform

lawrenceadams commented 4 weeks ago

@katy-sadowski I think that's all done now! Happy to pick apart further - we're breaking fresh ground!

P.S. I hope the presentation went well!