Skip to content

fix(mimic-iii): do not bridge paused vasopressor gaps - #2121

Open
acnimma wants to merge 1 commit into
MIT-LCP:mainfrom
acnimma:fix/iii-vasopressor-paused-gaps
Open

fix(mimic-iii): do not bridge paused vasopressor gaps#2121
acnimma wants to merge 1 commit into
MIT-LCP:mainfrom
acnimma:fix/iii-vasopressor-paused-gaps

Conversation

@acnimma

@acnimma acnimma commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stop collapsing MetaVision vasopressor rows with GROUP BY linkorderid + min/max times
  • Keep each inputevents_mv row as its own interval; vasomv_grp still merges contiguous/overlapping intervals
  • Update postgres and duckdb dialect copies
  • Document the paused-gap rationale in SQL (BigQuery source + postgres copy cite paused vasopressor durations #1808)

Why

vasopressor_durations grouped MetaVision rows by linkorderid and took min(starttime) / max(endtime). That is correct when successive rows abut, but after statusdescription = 'Paused' there is often a multi-hour gap (example linkorderid = 8781494, ~6h; see #1808, median ~1h 11m). Bridging that gap overstates vasopressor exposure.

Duration threshold / behavior

  • Paused gaps: leave as separate intervals (do not bridge via linkorderid)
  • Contiguous / overlapping: still merged by vasomv_grp

Test plan

  • No GROUP BY linkorderid remains in vasomv
  • SQL comments cite paused-gap / paused vasopressor durations #1808 in BigQuery + postgres (duckdb transpile drops comments)
  • linkorderid = 8781494 (Paused gap ~6h) yields separate durations, not one bridged interval
  • Contiguous non-paused orders still merge via vasomv_grp

Fixes #1808

MetaVision vasopressor_durations collapsed rows by linkorderid with
min(starttime)/max(endtime). After a Paused status that leaves a gap
(median ~1h), that incorrectly counted the pause as infusion time.
Keep each inputevents_mv row as its own interval; vasomv_grp still merges
contiguous/overlapping intervals.

Fixes MIT-LCP#1808

@Chessing234 Chessing234 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch on the linkorderid collapse — that paused gap example (~6h) really shouldn't get glued into one interval. leaving vasomv_grp to merge only contiguous/overlapping bits feels like the right split. maybe worth a one-liner in the test plan for a non-paused contiguous pair still merging, just so nobody regresses that later.

@Chessing234

Copy link
Copy Markdown
Contributor

not bridging paused vaso gaps is the right clinical call. can you cite the duration threshold you used in the pr description?

@Chessing234

Copy link
Copy Markdown
Contributor

keeping paused gaps as separate intervals matches the raw inputevents_mv semantics better than collapsing on linkorderid. can you add a short comment in the sql citing the paused-gap example so future edits dont reintroduce the group by?

@Chessing234 Chessing234 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropping the linkorderid min/max collapse is the right fix for paused vaso gaps — contiguous merge in vasomv_grp still covers true overlaps. mirrored across dialects which is what this repo needs. a one-line comment in the postgres/duckdb copies pointing at #1808 (like the bq file already has) would help the next reader.

@acnimma

acnimma commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressing the review notes:

  • Duration threshold: documented in the PR body — example paused gap is linkorderid = 8781494 (~6h); paused vasopressor durations #1808 reports median ~1h 11m. We do not bridge those gaps.
  • SQL comments: BigQuery source has the paused-gap / linkorderid note above vasomv; postgres dialect copy carries an inline /* ... #1808 */ on the vasomv CTE (duckdb transpile strips comments by design).
  • Contiguous merge: still covered by vasomv_grp; called out explicitly in the test plan so that path is not regressed.

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.

paused vasopressor durations

2 participants