From 021ef5af8eafbf2930f93325fc6471f6a9827772 Mon Sep 17 00:00:00 2001 From: alistairewj <1282676+alistairewj@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:59:10 +0000 Subject: [PATCH] chore: regenerate postgres/duckdb concepts from BigQuery sources --- .../durations/arterial_line_durations.sql | 2 +- .../durations/central_line_durations.sql | 2 +- .../concepts_duckdb/organfailure/kdigo_stages.sql | 5 ++++- .../durations/arterial_line_durations.sql | 2 +- .../durations/central_line_durations.sql | 2 +- .../concepts_postgres/organfailure/kdigo_stages.sql | 13 ++++++++----- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/mimic-iii/concepts_duckdb/durations/arterial_line_durations.sql b/mimic-iii/concepts_duckdb/durations/arterial_line_durations.sql index c699ee72..5958efc7 100644 --- a/mimic-iii/concepts_duckdb/durations/arterial_line_durations.sql +++ b/mimic-iii/concepts_duckdb/durations/arterial_line_durations.sql @@ -102,7 +102,7 @@ WITH mv AS ( icustay_id, charttime, charttime_lag, - charttime - charttime_lag AS arterial_line_duration, + DATE_DIFF('HOUR', charttime_lag, charttime) AS arterial_line_duration, CASE WHEN DATE_DIFF('HOUR', charttime_lag, charttime) > 16 THEN 1 ELSE 0 END AS arterial_line_new FROM cv0 ), cv2 AS ( diff --git a/mimic-iii/concepts_duckdb/durations/central_line_durations.sql b/mimic-iii/concepts_duckdb/durations/central_line_durations.sql index d31940e0..33da694a 100644 --- a/mimic-iii/concepts_duckdb/durations/central_line_durations.sql +++ b/mimic-iii/concepts_duckdb/durations/central_line_durations.sql @@ -200,7 +200,7 @@ WITH mv AS ( icustay_id, charttime, charttime_lag, - charttime - charttime_lag AS central_line_duration, + DATE_DIFF('HOUR', charttime_lag, charttime) AS central_line_duration, CASE WHEN DATE_DIFF('HOUR', charttime_lag, charttime) > 16 THEN 1 ELSE 0 END AS central_line_new FROM cv0 ), cv2 AS ( diff --git a/mimic-iii/concepts_duckdb/organfailure/kdigo_stages.sql b/mimic-iii/concepts_duckdb/organfailure/kdigo_stages.sql index 8db78065..83cdd7cb 100644 --- a/mimic-iii/concepts_duckdb/organfailure/kdigo_stages.sql +++ b/mimic-iii/concepts_duckdb/organfailure/kdigo_stages.sql @@ -12,7 +12,10 @@ WITH cr_stg AS ( THEN 3 WHEN cr.creat >= 4 AND ( - cr.creat_low_past_48hr <= 3.7 OR cr.creat >= ( + cr.creat >= ( + cr.creat_low_past_48hr + 0.3 + ) + OR cr.creat >= ( 1.5 * cr.creat_low_past_7day ) ) diff --git a/mimic-iii/concepts_postgres/durations/arterial_line_durations.sql b/mimic-iii/concepts_postgres/durations/arterial_line_durations.sql index 992809e3..cc40408b 100644 --- a/mimic-iii/concepts_postgres/durations/arterial_line_durations.sql +++ b/mimic-iii/concepts_postgres/durations/arterial_line_durations.sql @@ -111,7 +111,7 @@ WITH mv AS ( icustay_id, charttime, charttime_lag, /* if the current observation indicates a line is present */ /* calculate the time since the last charted line */ - charttime - charttime_lag AS arterial_line_duration, /* now we determine if the current line is "new" */ /* new == no documentation for 16 hours */ + CAST(EXTRACT(EPOCH FROM DATE_TRUNC('hour', charttime) - DATE_TRUNC('hour', charttime_lag)) / 3600 AS BIGINT) AS arterial_line_duration, /* now we determine if the current line is "new" */ /* new == no documentation for 16 hours */ CASE WHEN CAST(EXTRACT(EPOCH FROM DATE_TRUNC('hour', charttime) - DATE_TRUNC('hour', charttime_lag)) / 3600 AS BIGINT) > 16 THEN 1 diff --git a/mimic-iii/concepts_postgres/durations/central_line_durations.sql b/mimic-iii/concepts_postgres/durations/central_line_durations.sql index b1b6ef2c..905e17a0 100644 --- a/mimic-iii/concepts_postgres/durations/central_line_durations.sql +++ b/mimic-iii/concepts_postgres/durations/central_line_durations.sql @@ -201,7 +201,7 @@ WITH mv AS ( icustay_id, charttime, charttime_lag, /* if the current observation indicates a line is present */ /* calculate the time since the last charted line */ - charttime - charttime_lag AS central_line_duration, /* now we determine if the current line is "new" */ /* new == no documentation for 16 hours */ + CAST(EXTRACT(EPOCH FROM DATE_TRUNC('hour', charttime) - DATE_TRUNC('hour', charttime_lag)) / 3600 AS BIGINT) AS central_line_duration, /* now we determine if the current line is "new" */ /* new == no documentation for 16 hours */ CASE WHEN CAST(EXTRACT(EPOCH FROM DATE_TRUNC('hour', charttime) - DATE_TRUNC('hour', charttime_lag)) / 3600 AS BIGINT) > 16 THEN 1 diff --git a/mimic-iii/concepts_postgres/organfailure/kdigo_stages.sql b/mimic-iii/concepts_postgres/organfailure/kdigo_stages.sql index 4f8a985f..bbdbd549 100644 --- a/mimic-iii/concepts_postgres/organfailure/kdigo_stages.sql +++ b/mimic-iii/concepts_postgres/organfailure/kdigo_stages.sql @@ -12,11 +12,14 @@ WITH cr_stg AS ( ) THEN 3 WHEN cr.creat >= 4 - -- For patients reaching Stage 3 by SCr >4.0 mg/dl - -- require that the patient first achieve ... acute increase >= 0.3 within 48 hr - -- *or* an increase of >= 1.5 times baseline - and (cr.creat >= (cr.creat_low_past_48hr+0.3) OR cr.creat >= (1.5*cr.creat_low_past_7day)) - then 3 + AND /* For patients reaching Stage 3 by SCr >4.0 mg/dl */ /* require that the patient first achieve ... acute increase >= 0.3 within 48 hr */ /* *or* an increase of >= 1.5 times baseline */ ( + cr.creat >= ( + cr.creat_low_past_48hr + 0.3 + ) + OR cr.creat >= ( + 1.5 * cr.creat_low_past_7day + ) + ) THEN 3 WHEN cr.creat >= ( cr.creat_low_past_7day * 2.0