Skip to content

Commit 9818152

Browse files
fix: include wbc_max in SIRS WBC missing-data guard
WBC scoring uses wbc_min, wbc_max, and bands_max, but the null arm only checked coalesce(wbc_min, bands_max), so a present wbc_max alone yielded NULL instead of 0. Align the guard across BigQuery, Postgres, and DuckDB. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3a914fc commit 9818152

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

mimic-iii/concepts/severityscores/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ left join `physionet-data.mimiciii_derived.labs_first_day` l
8989
when wbc_min < 4.0 then 1
9090
when wbc_max > 12.0 then 1
9191
when bands_max > 10 then 1-- > 10% immature neurophils (band forms)
92-
when coalesce(wbc_min, bands_max) is null then null
92+
when coalesce(wbc_min, wbc_max, bands_max) is null then null
9393
else 0
9494
end as wbc_score
9595

mimic-iii/concepts_duckdb/severityscores/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ WITH bg AS (
5656
THEN 1
5757
WHEN bands_max > 10
5858
THEN 1
59-
WHEN COALESCE(wbc_min, bands_max) IS NULL
59+
WHEN COALESCE(wbc_min, wbc_max, bands_max) IS NULL
6060
THEN NULL
6161
ELSE 0
6262
END AS wbc_score

mimic-iii/concepts_postgres/severityscores/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ WITH bg AS (
5959
THEN 1
6060
WHEN bands_max > 10
6161
THEN 1 /* > 10% immature neurophils (band forms) */
62-
WHEN COALESCE(wbc_min, bands_max) IS NULL
62+
WHEN COALESCE(wbc_min, wbc_max, bands_max) IS NULL
6363
THEN NULL
6464
ELSE 0
6565
END AS wbc_score

mimic-iv/concepts/score/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ WITH scorecomp AS (
7777
WHEN wbc_min < 4.0 THEN 1
7878
WHEN wbc_max > 12.0 THEN 1
7979
WHEN bands_max > 10 THEN 1-- > 10% immature neurophils (band forms)
80-
WHEN COALESCE(wbc_min, bands_max) IS NULL THEN NULL
80+
WHEN COALESCE(wbc_min, wbc_max, bands_max) IS NULL THEN NULL
8181
ELSE 0
8282
END AS wbc_score
8383

mimic-iv/concepts_duckdb/score/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ WITH scorecomp AS (
5353
THEN 1
5454
WHEN bands_max > 10
5555
THEN 1
56-
WHEN COALESCE(wbc_min, bands_max) IS NULL
56+
WHEN COALESCE(wbc_min, wbc_max, bands_max) IS NULL
5757
THEN NULL
5858
ELSE 0
5959
END AS wbc_score

mimic-iv/concepts_postgres/score/sirs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ WITH scorecomp AS (
5555
THEN 1
5656
WHEN bands_max > 10
5757
THEN 1 /* > 10% immature neurophils (band forms) */
58-
WHEN COALESCE(wbc_min, bands_max) IS NULL
58+
WHEN COALESCE(wbc_min, wbc_max, bands_max) IS NULL
5959
THEN NULL
6060
ELSE 0
6161
END AS wbc_score

0 commit comments

Comments
 (0)