Skip to content

How to add demographics to patient_dimension? #8

Description

@pbuendia

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions