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 !
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 !