Skip to content

Fix FULL OUTER JOIN COALESCE in MIMIC-IV height concept#2015

Open
Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:fix/mimic-iv-height-coalesce-h2
Open

Fix FULL OUTER JOIN COALESCE in MIMIC-IV height concept#2015
Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:fix/mimic-iv-height-coalesce-h2

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • Fix ht_stg0 in MIMIC-IV height.sql to use h2 columns in COALESCE fallbacks for subject_id, stay_id, and charttime
  • Apply the same fix across BigQuery, Postgres, and DuckDB concept builds

Problem

The FULL OUTER JOIN between inch-based (ht_in) and cm-based (ht_cm) height measurements used COALESCE(h1.col, h1.col), which never falls back to h2 values. Height records present only in ht_in were excluded from the derived table.

Test plan

  • Rebuild mimiciv_derived.height and verify inch-only measurements are retained
  • Compare row counts before/after on a sample MIMIC-IV install

Fixes #2010

Made with Cursor

Rows from ht_in with no matching ht_cm row were dropped because
COALESCE used h1 columns twice instead of falling back to h2.

Fixes MIT-LCP#2010.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

error in OUTER JOIN condition for mimic_derived.height

1 participant