Skip to content

Commit 2df3580

Browse files
committed
fix(mimic-iv): add missing temperature itemids to vitalsign concept
The vitalsign concept omitted blood/CCO and Arctic Sun/Alsius temperature itemids documented in #1358. Include 226329, 227632, and 227634 in the Celsius temperature CASE, and 227630/227631 in temperature_site alongside 224642. Regenerate postgres and duckdb dialect copies from the BigQuery source. Fixes #1358
1 parent 5bdb9a0 commit 2df3580

3 files changed

Lines changed: 28 additions & 11 deletions

File tree

mimic-iv/concepts/measurement/vitalsign.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ SELECT
5353
AND valuenum < 120
5454
THEN (valuenum - 32) / 1.8
5555
-- already in degC, no conversion necessary
56-
WHEN itemid IN (223762)
56+
-- includes core/blood temps (CCO) and Arctic Sun/Alsius temps
57+
WHEN itemid IN (223762, 226329, 227632, 227634)
5758
AND valuenum > 10
5859
AND valuenum < 50
5960
THEN valuenum END)
6061
AS NUMERIC), 2) AS temperature
61-
, MAX(CASE WHEN itemid = 224642 THEN value END
62+
, MAX(CASE WHEN itemid IN (224642, 227630, 227631) THEN value END
6263
) AS temperature_site
6364
, AVG(CASE WHEN itemid IN (220277)
6465
AND valuenum > 0
@@ -91,10 +92,14 @@ WHERE ce.stay_id IS NOT NULL
9192
, 220621 -- Glucose (serum)
9293
, 226537 -- Glucose (whole blood)
9394
-- TEMPERATURE
94-
-- 226329 -- Blood Temperature CCO (C)
95+
, 226329 -- Blood Temperature CCO (C)
96+
, 227632 -- Arctic Sun/Alsius Temp #1 C
97+
, 227634 -- Arctic Sun/Alsius Temp #2 C
9598
, 223762 -- "Temperature Celsius"
9699
, 223761 -- "Temperature Fahrenheit"
97100
, 224642 -- Temperature Site
101+
, 227630 -- Arctic Sun Temp #1 Location
102+
, 227631 -- Arctic Sun Temp #2 Location
98103
)
99104
GROUP BY ce.subject_id, ce.stay_id, ce.charttime
100105
;

mimic-iv/concepts_duckdb/measurement/vitalsign.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ SELECT
4141
THEN (
4242
valuenum - 32
4343
) / 1.8
44-
WHEN itemid IN (223762) AND valuenum > 10 AND valuenum < 50
44+
WHEN itemid IN (223762, 226329, 227632, 227634) AND valuenum > 10 AND valuenum < 50
4545
THEN valuenum
4646
END
4747
) AS DECIMAL(38, 9)),
4848
2
4949
) AS temperature,
50-
MAX(CASE WHEN itemid = 224642 THEN value END) AS temperature_site,
50+
MAX(CASE WHEN itemid IN (224642, 227630, 227631) THEN value END) AS temperature_site,
5151
AVG(
5252
CASE WHEN itemid IN (220277) AND valuenum > 0 AND valuenum <= 100 THEN valuenum END
5353
) AS spo2,
@@ -72,9 +72,14 @@ WHERE
7272
225664,
7373
220621,
7474
226537,
75+
226329,
76+
227632,
77+
227634,
7578
223762,
7679
223761,
77-
224642
80+
224642,
81+
227630,
82+
227631
7883
)
7984
GROUP BY
8085
ce.subject_id,

mimic-iv/concepts_postgres/measurement/vitalsign.sql

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS mimiciv_derived.vitalsign; CREATE TABLE mimiciv_derived.vitalsign AS
3-
/* This query pivots the vital signs for the entire patient stay. */ /* The result is a tabler with stay_id, charttime, and various */ /* vital signs, with one row per charted time. */
3+
/* This query pivots the vital signs for the entire patient stay. */
4+
/* The result is a tabler with stay_id, charttime, and various */
5+
/* vital signs, with one row per charted time. */
46
SELECT
57
ce.subject_id,
68
ce.stay_id,
@@ -42,13 +44,13 @@ SELECT
4244
THEN CAST((
4345
valuenum - 32
4446
) AS DOUBLE PRECISION) / 1.8
45-
WHEN itemid IN (223762) AND valuenum > 10 AND valuenum < 50
47+
WHEN itemid IN (223762, 226329, 227632, 227634) AND valuenum > 10 AND valuenum < 50
4648
THEN valuenum
4749
END
4850
) AS DECIMAL(38, 9)),
4951
2
5052
) AS temperature,
51-
MAX(CASE WHEN itemid = 224642 THEN value END) AS temperature_site,
53+
MAX(CASE WHEN itemid IN (224642, 227630, 227631) THEN value END) AS temperature_site,
5254
AVG(
5355
CASE WHEN itemid IN (220277) AND valuenum > 0 AND valuenum <= 100 THEN valuenum END
5456
) AS spo2,
@@ -72,10 +74,15 @@ WHERE
7274
220277, /* SPO2, peripheral */ /* GLUCOSE, both lab and fingerstick */
7375
225664, /* Glucose finger stick */
7476
220621, /* Glucose (serum) */
75-
226537, /* Glucose (whole blood) */ /* TEMPERATURE */ /* 226329 -- Blood Temperature CCO (C) */
77+
226537, /* Glucose (whole blood) */ /* TEMPERATURE */
78+
226329, /* Blood Temperature CCO (C) */
79+
227632, /* Arctic Sun/Alsius Temp #1 C */
80+
227634, /* Arctic Sun/Alsius Temp #2 C */
7681
223762, /* "Temperature Celsius" */
7782
223761, /* "Temperature Fahrenheit" */
78-
224642 /* Temperature Site */
83+
224642, /* Temperature Site */
84+
227630, /* Arctic Sun Temp #1 Location */
85+
227631 /* Arctic Sun Temp #2 Location */
7986
)
8087
GROUP BY
8188
ce.subject_id,

0 commit comments

Comments
 (0)