Skip to content

error in OUTER JOIN condition for mimic_derived.height #2010

@snowgato

Description

@snowgato

Hi,
I think there's an error on lines 25-27 of mimic-code/mimic-iv/concepts_postgres/measurement/height.sql in the outer join condition defining ht_stg0:

ht_stg0 AS (
SELECT
COALESCE(h1.subject_id, h1.subject_id) AS subject_id,
COALESCE(h1.stay_id, h1.stay_id) AS stay_id,
COALESCE(h1.charttime, h1.charttime) AS charttime,
COALESCE(h1.height, h2.height) AS height
FROM ht_cm AS h1
FULL OUTER JOIN ht_in AS h2
ON h1.subject_id = h2.subject_id AND h1.charttime = h2.charttime
)

This associates null subject_id, stay_id and charttime for measurements coming from h2 without corresponding charttime in h1, and then all height only expressed in inches are not included for further treatment.

The correct version would be :
ht_stg0 AS (
SELECT
COALESCE(h1.subject_id, h2.subject_id) AS subject_id,
COALESCE(h1.stay_id, h2.stay_id) AS stay_id,
COALESCE(h1.charttime, h2.charttime) AS charttime,
COALESCE(h1.height, h2.height) AS height
FROM ht_cm AS h1
FULL OUTER JOIN ht_in AS h2
ON h1.subject_id = h2.subject_id AND h1.charttime = h2.charttime
)

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions