Skip to content

Commit f02600d

Browse files
committed
carry over formatting to postgres scripts
1 parent 773b417 commit f02600d

File tree

8 files changed

+29
-9
lines changed

8 files changed

+29
-9
lines changed

mimic-iv/concepts_postgres/medication/dobutamine.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS dobutamine; CREATE TABLE dobutamine AS
3-
-- This query extracts dose+durations of dopamine administration
3+
-- This query extracts dose+durations of dobutamine administration
4+
-- Local hospital dosage guidance: 2 mcg/kg/min (low) - 40 mcg/kg/min (max)
45
SELECT
56
stay_id, linkorderid
67
-- all rows in mcg/kg/min

mimic-iv/concepts_postgres/medication/dopamine.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS dopamine; CREATE TABLE dopamine AS
33
-- This query extracts dose+durations of dopamine administration
4+
-- Local hospital dosage guidance: 2 mcg/kg/min (low) - 10 mcg/kg/min (high)
45
SELECT
56
stay_id, linkorderid
67
-- all rows in mcg/kg/min

mimic-iv/concepts_postgres/medication/epinephrine.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS epinephrine; CREATE TABLE epinephrine AS
33
-- This query extracts dose+durations of epinephrine administration
4+
-- Local hospital dosage guidance: 0.2 mcg/kg/min (low) - 2 mcg/kg/min (high)
45
SELECT
56
stay_id, linkorderid
67
-- all rows in mcg/kg/min

mimic-iv/concepts_postgres/medication/milrinone.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS milrinone; CREATE TABLE milrinone AS
33
-- This query extracts dose+durations of milrinone administration
4+
-- Local hospital dosage guidance: 0.5 mcg/kg/min (usual)
45
SELECT
56
stay_id, linkorderid
67
-- all rows in mcg/kg/min

mimic-iv/concepts_postgres/medication/norepinephrine_equivalent_dose.sql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@ DROP TABLE IF EXISTS norepinephrine_equivalent_dose; CREATE TABLE norepinephrine
33
-- This query calculates norepinephrine equivalent dose for vasopressors.
44
-- Based on "Vasopressor dose equivalence: A scoping review and
55
-- suggested formula" by Goradia et al. 2020.
6+
7+
-- The relevant table makes the following equivalences:
8+
-- Norepinephrine - 1:1 - comparison dose of 0.1 ug/kg/min
9+
-- Epinephrine - 1:1 [0.7, 1.4] - 0.1 ug/kg/min
10+
-- Dopamine - 1:100 [75.2, 144.4] - 10 ug/kg/min
11+
-- Metaraminol - 1:8 [8.3] - 0.8 ug/kg/min
12+
-- Phenylephrine - 1:10 [1.1, 16.3] - 1 ug/kg/min
13+
-- Vasopressin - 1:0.4 [0.3, 0.4] - 0.04 units/min
14+
-- Angiotensin II - 1:0.1 [0.07, 0.13] - 0.01 ug/kg/min
15+
616
SELECT stay_id, starttime, endtime
717
-- calculate the dose
18+
-- all sources are in mcg/kg/min,
19+
-- except vasopressin which is in units/hour
820
, ROUND(CAST(
921
COALESCE(norepinephrine, 0)
1022
+ COALESCE(epinephrine, 0)
1123
+ COALESCE(phenylephrine / 10, 0)
1224
+ COALESCE(dopamine / 100, 0)
1325
-- + metaraminol/8 -- metaraminol not used in BIDMC
14-
+ COALESCE(vasopressin * 2.5, 0)
26+
+ COALESCE(vasopressin * 2.5 / 60, 0)
1527
-- angiotensin_ii*10 -- angiotensin ii rarely used, though
1628
-- it could be included due to norepinephrine sparing effects
1729
AS NUMERIC), 4) AS norepinephrine_equivalent_dose

mimic-iv/concepts_postgres/medication/phenylephrine.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS phenylephrine; CREATE TABLE phenylephrine AS
33
-- This query extracts dose+durations of phenylephrine administration
4+
-- Local hospital dosage guidance: 0.5 mcg/kg/min (low) - 5 mcg/kg/min (high)
45
SELECT
56
stay_id, linkorderid
67
-- one row in mcg/min, the rest in mcg/kg/min

mimic-iv/concepts_postgres/medication/vasoactive_agent.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ WITH tm AS (
8484
-- left join to raw data tables to combine doses
8585
SELECT t.stay_id, t.starttime, t.endtime
8686
-- inopressors/vasopressors
87-
, dop.vaso_rate AS dopamine
88-
, epi.vaso_rate AS epinephrine
89-
, nor.vaso_rate AS norepinephrine
90-
, phe.vaso_rate AS phenylephrine
91-
, vas.vaso_rate AS vasopressin
87+
, dop.vaso_rate AS dopamine -- mcg/kg/min
88+
, epi.vaso_rate AS epinephrine -- mcg/kg/min
89+
, nor.vaso_rate AS norepinephrine -- mcg/kg/min
90+
, phe.vaso_rate AS phenylephrine -- mcg/kg/min
91+
, vas.vaso_rate AS vasopressin -- units/hour
9292
-- inodialators
93-
, dob.vaso_rate AS dobutamine
94-
, mil.vaso_rate AS milrinone
93+
, dob.vaso_rate AS dobutamine -- mcg/kg/min
94+
, mil.vaso_rate AS milrinone -- mcg/kg/min
9595
-- isoproterenol is used in CCU/CVICU but not in metavision
9696
-- other drugs not included here but (rarely) used in the BIDMC:
9797
-- angiotensin II, methylene blue

mimic-iv/concepts_postgres/medication/vasopressin.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
22
DROP TABLE IF EXISTS vasopressin; CREATE TABLE vasopressin AS
33
-- This query extracts dose+durations of vasopressin administration
4+
-- Local hospital dosage guidance: 1.2 units/hour (low) - 2.4 units/hour (high)
45
SELECT
56
stay_id, linkorderid
67
-- three rows in units/min, rest in units/hour
78
-- the three rows in units/min look reasonable and
89
-- fit with the patient course
10+
11+
-- convert all rows to units/hour
912
, CASE WHEN rateuom = 'units/min' THEN rate * 60.0
1013
ELSE rate END AS vaso_rate
1114
, amount AS vaso_amount

0 commit comments

Comments
 (0)