Skip to content

Commit 7f3306b

Browse files
docs(mimic-iv-ed): add pyxis-before-intime audit query
Give researchers a concrete count for the #1910 offset pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent abb1c4a commit 7f3306b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- Count Pyxis rows whose charttime falls before the linked ED stay intime.
2+
-- Useful as a sensitivity check when building ED medication cohorts (#1910).
3+
-- Dialect: PostgreSQL / BigQuery-compatible with minor cast tweaks.
4+
5+
SELECT
6+
COUNT(*) AS pyxis_rows,
7+
COUNT(*) FILTER (WHERE p.charttime < e.intime) AS before_intime,
8+
COUNT(*) FILTER (
9+
WHERE p.charttime < e.intime
10+
AND p.charttime >= e.intime - INTERVAL '2 hours'
11+
) AS before_intime_within_2h
12+
FROM ed.pyxis AS p
13+
INNER JOIN ed.edstays AS e
14+
ON p.stay_id = e.stay_id;

0 commit comments

Comments
 (0)