Skip to content

fix: select lowest PaO2 in APS III oxygenation score - #2186

Open
chenyangsu wants to merge 1 commit into
MIT-LCP:mainfrom
chenyangsu:fix/apsiii-pao2-lowest
Open

chenyangsu wants to merge 1 commit into
MIT-LCP:mainfrom
chenyangsu:fix/apsiii-pao2-lowest

Conversation

@chenyangsu

Copy link
Copy Markdown

In MIMIC-IV and MIMIC-III apsiii.sql, the pa CTE orders arterial blood gases with ORDER BY bg.po2 DESC and joins pa.rn = 1, selecting the highest PaO2 instead of the lowest. On a stay with room-air PaO2 values of 45 and 95 mmHg, apsiii returns pao2_aado2_score = 0 rather than 15 per Knaus et al. (Chest 1991; 100(6):1619-1636, Table 3).

Switched ORDER BY bg.po2 DESC to ASC in both BigQuery sources, regenerated the Postgres and DuckDB copies with mimic_utils, and added a DuckDB regression test. Happy to drop the generated copies if you prefer the bot to update them.

Testing: pytest tests/test_apsiii.py tests/test_transpile.py tests/test_compare_concepts.py -q -> 340 passed (tests/test_apsiii.py: 2 failed on main, 2 passed); sqlfluff on mimic-iv/concepts/score/apsiii.sql -> 0 violations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant