Skip to content
New issue

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

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

Already on GitHub? # to your account

How to add demographics to patient_dimension? #8

Open
pbuendia opened this issue May 11, 2023 · 0 comments
Open

How to add demographics to patient_dimension? #8

pbuendia opened this issue May 11, 2023 · 0 comments

Comments

@pbuendia
Copy link

The current version does not add records to the patient_dimension and therefore the demographic breakdown query returns no results. So we ETLed demographic information and then directly ran an insert query. At this point we are only adding age. Consider automating this. Here is the SQL statement for postgreSQL:

WITH cteRowNumber AS ( SELECT patient_num , nval_num , (date '2023-04-01' - nval_num * interval '1 year') as birthdate, ROW_NUMBER() OVER(PARTITION BY patient_num ORDER BY start_date DESC) AS RowNum FROM observation_fact f WHERE f.concept_cd = 'DEM_AGE' ) INSERT INTO patient_dimension (patient_num, age_in_years_num, patient_dimension.birth_date) SELECT patient_num , nval_num, bithdate FROM cteRowNumber -- into patient_dimension WHERE RowNum = 1

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

No branches or pull requests

1 participant