Skip to content

Commit ad1d23b

Browse files
committed
remove storetime from tie-breaker
1 parent b2cfb6e commit ad1d23b

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

mimic-iv/concepts/firstday/first_day_gcs.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ WITH gcs_final AS (
2121
, g.gcs_unable
2222
-- This sorts the data by GCS
2323
-- rn = 1 is the the lowest total GCS value
24-
-- tie-break on charttime/storetime (unique per stay) so the component columns
24+
-- tie-break on charttime (unique per stay) so the component columns
2525
-- are deterministic across SQL engines when multiple measurements
2626
-- share the same minimum GCS
2727
, ROW_NUMBER() OVER
2828
(
2929
PARTITION BY g.stay_id
30-
ORDER BY g.gcs ASC NULLS LAST, g.charttime DESC NULLS LAST, g.storetime DESC NULLS LAST
30+
ORDER BY g.gcs ASC NULLS LAST, g.charttime DESC NULLS LAST
3131
) AS gcs_seq
3232
FROM `physionet-data.mimiciv_icu.icustays` ie
3333
-- Only get data for the first 24 hours

mimic-iv/concepts_duckdb/firstday/first_day_gcs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WITH gcs_final AS (
99
g.gcs_verbal,
1010
g.gcs_eyes,
1111
g.gcs_unable,
12-
ROW_NUMBER() OVER (PARTITION BY g.stay_id ORDER BY g.gcs ASC, g.charttime DESC, g.storetime DESC) AS gcs_seq
12+
ROW_NUMBER() OVER (PARTITION BY g.stay_id ORDER BY g.gcs ASC, g.charttime DESC) AS gcs_seq
1313
FROM mimiciv_icu.icustays AS ie
1414
LEFT JOIN mimiciv_derived.gcs AS g
1515
ON ie.stay_id = g.stay_id

mimic-iv/concepts_postgres/firstday/first_day_gcs.sql

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ WITH gcs_final AS (
99
g.gcs_motor,
1010
g.gcs_verbal,
1111
g.gcs_eyes,
12-
g.gcs_unable, /* This sorts the data by GCS */ /* rn = 1 is the the lowest total GCS value */ /* tie-break on charttime/storetime (unique per stay) so the component columns */ /* are deterministic across SQL engines when multiple measurements */ /* share the same minimum GCS */
13-
ROW_NUMBER() OVER (
14-
PARTITION BY g.stay_id
15-
ORDER BY g.gcs ASC, g.charttime DESC NULLS LAST, g.storetime DESC NULLS LAST
16-
) AS gcs_seq
12+
g.gcs_unable, /* This sorts the data by GCS */ /* rn = 1 is the the lowest total GCS value */ /* tie-break on charttime (unique per stay) so the component columns */ /* are deterministic across SQL engines when multiple measurements */ /* share the same minimum GCS */
13+
ROW_NUMBER() OVER (PARTITION BY g.stay_id ORDER BY g.gcs ASC, g.charttime DESC NULLS LAST) AS gcs_seq
1714
FROM mimiciv_icu.icustays AS ie
1815
/* Only get data for the first 24 hours */
1916
LEFT JOIN mimiciv_derived.gcs AS g

0 commit comments

Comments
 (0)