Skip to content

fix(mimic-iii): merge overlapping line duration intervals - #2175

Open
Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:codex/merge-overlapping-line-durations
Open

Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:codex/merge-overlapping-line-durations

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

MetaVision arterial and central line concepts currently emit overlapping procedure rows directly, so summing duration_hours double-counts time when a line is present. This implements the interval collapse requested in #371.

Merge overlapping or touching intervals within each ICU stay using the maximum end time across all preceding intervals. Using only the immediately preceding end time would split nested intervals incorrectly. Deduplicate identical bounds before applying the window functions, preserve actual gaps and the existing CareVue extraction, and regenerate both PostgreSQL and DuckDB outputs. The resulting intervals represent time with at least one qualifying line present, not individual catheter lifetimes; the existing hour-boundary duration calculation is retained.

Fixes #371.

Validation:

  • Added four regression cases (arterial/central × transpiled source/committed DuckDB SQL), covering nested and chained overlaps, identical rows, equal starts, touching intervals, gaps, separate stays, unrelated procedures, and CareVue gaps. All four fail against the original SQL and pass after the fix. They run in the existing transpile CI job.
  • 342 local transpiler, comparison, and regression tests pass; git diff --check passes.
  • Executed both committed PostgreSQL concepts on PostgreSQL 17 with the same synthetic fixtures; their five output intervals match DuckDB exactly.

Validation used synthetic data, not the full credentialed MIMIC-III dataset. This is scoped to the line-duration issue; the earlier combined PR #2124 removed its concept changes after the request to split them into individual PRs.

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.

Central line/arterial line durations have overlapping rows

1 participant