← Methods repository
concept

Hospitalization and Transfer Collapse

An outcome-construction rule that stitches contiguous inpatient, observation, transfer, and facility claims into a single coherent hospitalization episode, so that an inter-hospital transfer or an observation-to-inpatient conversion is counted as one admission rather than several.

Outcome_Measureoutcome_measurehospitalization-episodetransfer-collapseobservation-stayreadmissionlength-of-stayclaims-constructionbill-type
Methods reference only. Use primary source citations and local policy before applying this in a study protocol, regulatory submission, payer dossier, or clinical decision.

In plain language

When a patient moves between facilities during one illness — for example, from an emergency department to Hospital A and then to Hospital B — insurance records create a separate claim for each stop. Transfer collapse is the rule that recognizes all those claims as one continuous stay and stitches them into a single count. Without this step, a researcher counting hospitalizations would report three admissions when there was really only one, which would inflate event rates and distort any readmission clock that is supposed to start at the end of the stay.

Hospitalization and transfer collapse

is the operational rule set that turns raw facility claims into analyzable hospitalization episodes. A single clinical admission rarely appears as a single record: a patient may arrive through the emergency department, be placed in observation (an outpatient status), convert to inpatient at the second midnight, be transferred to a tertiary center for a procedure, and discharged from a third provider — generating three or four separate facility claims under three different provider IDs. Without an explicit collapse rule, a naive count treats each claim as a distinct hospitalization, inflating event counts, shortening apparent length of stay (LOS), corrupting readmission denominators, and mis-timing the "first hospitalization" used as time zero or as the outcome event. The rule must be written into the protocol and statistical analysis plan before programming, because every downstream quantity — event rate, time-to-first-event, 30-day readmission, per-episode cost — inherits its boundaries.

Core conceptual distinction

. The unit of analysis is the episode, not the claim. Two decisions define the episode boundary and must be pre-specified and separable. (1) The same-stay merge (gap rule): two facility claims belong to the same episode when the second admit date falls within a small gap of the prior discharge date. The canonical choice is a 0-to-1-day gap (admit on the day of, or the day after, discharge), which captures bed-to-bed inter-hospital transfers and observation-to-inpatient conversions; the gap is the single most consequential tunable parameter and must be reported and varied in sensitivity analyses. (2) What counts as a transfer: a claim with discharge status `02` (transferred to another short-term acute hospital) followed by an admission elsewhere is a transfer to be collapsed even though the provider ID differs — collapsing only within the same provider would split every transferred patient. The estimand consequence is sharp: if the outcome is "hospitalization," the collapsed episode is the event; if the outcome is "30-day readmission," the index episode must first be collapsed so that the transfer leg is not itself miscounted as the readmission. Whether acute care is extended to post-acute care (SNF/IRF/ LTCH) is a different definition — standard acute-hospitalization outcomes stop at acute discharge, whereas bundled- payment (e.g., BPCI) episodes deliberately include the post-acute tail. State which you are using.

Pros, cons, and trade-offs

. - vs counting each facility claim as one hospitalization (no collapse): Collapsing prevents double-counting of transfers and observation conversions, stabilizes LOS, and gives correct readmission denominators. Cost: it requires bill-type, revenue-code, and discharge-status logic plus de-duplication of facility vs professional claims, and the gap threshold is a judgment that must be defended. Prefer collapse for any consequential utilization, safety, cost, or regulatory-grade analysis; raw claim counts are defensible only for the crudest descriptive cut. - vs admission-date-only deduplication (drop exact duplicate admit dates): Date-only dedup removes literal duplicates but leaves transfers (different admit dates) split and silently keeps professional claims that share the facility admit date. Prefer the full gap + transfer + bill-type rule whenever transfers or observation stays are non-trivial in the population (true in nearly all elderly, oncology, and tertiary-referral cohorts). - vs a generous gap (e.g., 7 or 30 days) to define "continuous care": A wide gap merges genuinely distinct admissions and erases readmissions you intended to measure — actively misleading for any readmission endpoint. Prefer a 0-1 day gap for the same-stay episode and handle longer-horizon constructs (e.g., 30-day readmission) as a separate, explicitly named layer on top of collapsed episodes.

When to use

. Any analysis in which hospitalization is an outcome, a censoring event, time zero, or a cost driver in claims, EHR encounter, or linked data — comparative effectiveness/safety with a hospitalization endpoint, readmission measurement, healthcare resource utilization, and episode-of-care costing. It is essential whenever inter-hospital transfers or observation stays are plausible (Medicare and tertiary-referral populations) because those are precisely the records a naive count fractures.

When NOT to use — and when it is actively misleading or dangerous

. - When the policy/clinical question is at the claim or facility level, not the episode level (e.g., hospital-level transfer rates, facility billing audits). Collapsing destroys the unit you care about. - A gap threshold wide enough to swallow true readmissions. Using a 30-day "continuous care" merge while the endpoint is 30-day readmission is self-defeating — you collapse the very events you are counting. This is the most dangerous misuse. - Collapsing across MA-only person-time. In Medicare Advantage, institutional encounter records are incomplete or absent, so the absence of an intervening claim is missingness, not a true gap; collapsing then fuses unrelated stays or fabricates one long episode. Restrict episode construction to fee-for-service Part A person-time. - Unconditional acute→post-acute merging for an acute-hospitalization endpoint. Folding a SNF transfer into the acute episode inflates LOS and cost and mis-defines the outcome unless the protocol's estimand is explicitly the bundled episode.

Data-source operational depth

. - Claims (Medicare FFS / commercial): The facility (institutional) claim is the unit; key on it and discard the professional (Part B / carrier) claims that mirror the same admission, or you will count the admission twice. Inpatient acute claims carry bill type `011x`; observation appears on a `013x` outpatient claim via revenue center `0762` or HCPCS `G0378`/`G0379`; emergency department care via revenue center `0450`/`0451`. Use `admit_date`, `discharge_date`, `provider_id`, and `discharge_status` to apply the gap and transfer logic. Failure modes: Medicare Advantage drops institutional FFS claims, so MA-only person-time yields false-negative hospitalizations and spurious gaps — restrict to enrollees with FFS Part A across the relevant window. Claims adjudication lag and reversals/replacements mean the same stay can appear as an original plus a void/replacement pair; de-duplicate on the latest accepted version before collapsing. Interim (`0112`/`0113`/`0114`) bills for long stays split one admission into multiple records that must be merged on overlapping/contiguous dates regardless of gap. Differential competing risks matter: in elderly comparative cohorts, an exposure that raises mortality lowers the opportunity for a later transfer leg, so collapse choices interact with how death is handled. - EHR (encounter tables): Episodes are built from `ADT` (admission-discharge-transfer) events, not bills. A bed-movement transfer within a system is an intra-encounter event (already one visit), whereas a transfer to an external facility leaves the system and is captured only if linked claims are available — external care leakage causes truncated episodes. Observation status lives in a flag or order, not a bill type; site workflow variation in how observation is recorded is a major source of misclassification. - Registry: Usually adjudicates the clinical admission well but lacks the full facility-claim trail; link to claims to recover transfers and observation legs, and report the linkage-eligible denominator. - Linked claims–EHR: The ideal substrate (encounter detail + claim completeness), but admit/discharge timestamps disagree across sources by hours-to-days; reconcile to a single canonical clock before applying a 0-1-day gap, or the discrepancy alone will fabricate or destroy merges.

Worked claims example

Goal: count hospitalizations and 30-day all-cause readmissions after a drug index date in Medicare FFS. One patient generates four institutional claims: (A) `013x` observation, rev `0762`, 2024-03-01 to 2024-03-02 at provider 100; (B) `011x` inpatient, 2024-03-02 to 2024-03-05 at provider 100, `discharge_status=02` (transferred); (C) `011x` inpatient, 2024-03-05 to 2024-03-10 at provider 200; (D) `011x` inpatient, 2024-03-18 to 2024-03-21 at provider 200. Step 1 — restrict to FFS Part A person-time covering 2024-03; drop any MA span. Step 2 — keep facility claims only; discard the carrier claims that echo B-D. Step 3 — sort by `admit_date` and compute the gap to the prior `discharge_date`: A→B gap = 0 (obs converts to inpatient same day), B→C gap = 0 (acute transfer, different provider, discharge_status 02), C→D gap = 8 days. With a 1-day same-stay rule, A+B+C collapse into one episode (start 2024-03-01, end 2024-03-10, LOS 9 days, transfer_count = 1), and D is a second, distinct episode. Step 4 — the outcome "first hospitalization" = the collapsed episode starting 2024-03-01; the readmission clock starts at its discharge (2024-03-10), so D (admit 2024-03-18, 8 days later) counts as a 30-day readmission. A naive per-claim count would have reported four hospitalizations, a 5-day maximum LOS, and would have miscounted the transfer leg C as the "readmission" — three errors the collapse rule prevents.

Interpreting the output

. After applying the transfer-collapse rule to the four facility claims — observation (Mar 1–2), inpatient at Hospital A (Mar 2–7), transfer to Hospital B (Mar 7–10), and a second admission (Mar 18–21) — the algorithm produces two collapsed episodes. Episode 1 runs from March 1 through March 10 (9-day LOS, one transfer), capturing the continuous care arc. Episode 2 begins March 18, eight days after Episode 1 discharge, and qualifies as a 30-day readmission.

Formal interpretation: collapse rules create one episode from multiple claims by applying two criteria — a same-day observation-to-inpatient conversion rule and a 1-day transfer-gap rule. Without collapse, the algorithm would attribute four separate hospitalizations to this patient, mis-time the readmission clock (starting it at the transfer leg rather than the first admission), and inflate the episode count in denominators for readmission rate calculations. Failure to collapse transfers is not conservative — it inflates the readmission denominator, which biases the readmission rate toward zero.

Practical interpretation: always document whether the collapse rule was applied before computing any hospitalization count, LOS, or readmission outcome. For CMS quality measures and regulatory submissions, transfer collapse is required methodology — omitting it is a protocol deviation. Report the number of multi-claim episodes and the transfer count per episode as a data-quality check; a high transfer fraction signals coding patterns that may differ across sites or payers and should be explored in sensitivity analyses.

Worked example

Scenario

A Medicare patient is admitted on March 1, 2024 through the emergency department at Hospital A and placed under observation status overnight. On March 2 she converts to full inpatient status at Hospital A. On March 5 she is transferred — same illness — to Hospital B, a tertiary center with a specialist. Hospital B discharges her on March 10. Then, eight days later on March 18, she is admitted again to Hospital B for a new complication and stays until March 21. The insurance database shows four separate facility claims. The research question is: how many hospitalizations did this patient have, and did she have a 30-day readmission?

Dataset

Raw facility claims for one patient as they appear in a Medicare database — four rows, four different bill dates.

person_idadmit_datedischarge_dateprovider_idbill_typedischarge_status
70012024-03-012024-03-02ProvA013x01
70012024-03-022024-03-05ProvA011x02
70012024-03-052024-03-10ProvB011x01
70012024-03-182024-03-21ProvB011x01

Steps

  • Sort the four claims by admit date: Mar 1, Mar 2, Mar 5, Mar 18.

  • Check claim 1 to claim 2: Claim 1 discharged Mar 2; Claim 2 admitted Mar 2 — gap is 0 days, within the 0-to-1-day rule, so merge them into the same stay.

  • Check claim 2 to claim 3: Claim 2 discharged Mar 5; Claim 3 admitted Mar 5 — gap is 0 days AND discharge_status on Claim 2 is 02 (transferred), so merge Claim 3 into the same stay even though it is at a different hospital.

  • The merged stay spans Mar 1 through Mar 10 — one episode, length of stay 9 days, one transfer.

  • Check claim 3 to claim 4: Claim 3 (last leg of episode 1) discharged Mar 10; Claim 4 admitted Mar 18 — gap is 8 days, well beyond the 1-day rule, so Claim 4 starts a new, separate episode.

  • Episode 2 spans Mar 18 through Mar 21 — 3 days, at Hospital B.

  • The readmission clock starts at the discharge of Episode 1 (Mar 10). Episode 2 is admitted Mar 18, which is 8 days after discharge — inside the 30-day window, so it counts as a 30-day readmission.

  • Final count: 2 episodes (not 4 claims), 1 readmission. A raw claim count would have reported 4 hospitalizations and would have incorrectly called the transfer leg (Claim 3) the readmission.

Result

2 collapsed episodes from 4 raw claims. Episode 1: Mar 1–Mar 10, LOS 9 days, 1 inter-hospital transfer. Episode 2: Mar 18–Mar 21, LOS 3 days. Episode 2 is a 30-day readmission (8 days after Episode 1 discharge). Raw claim count would have over-reported by 2 admissions.

Timeline Spec

Title

Transfer collapse: 4 facility claims become 2 episodes for one Medicare patient

Window
Start

2024-03-01

End

2024-03-21

Label

Observation window: Mar 1 to Mar 21 (21 days shown)

Events
  • Label

    Claim A: Observation stay, ProvA (bill 013x)

    Start

    2024-03-01

    Length Days

    1

    Quantity

    1-day observation

  • Label

    Claim B: Inpatient, ProvA (discharge_status 02 = transferred)

    Start

    2024-03-02

    Length Days

    3

    Quantity

    3-day inpatient

  • Label

    Claim C: Inpatient, ProvB (transfer-in leg)

    Start

    2024-03-05

    Length Days

    5

    Quantity

    5-day inpatient

  • Label

    Claim D: Inpatient, ProvB (new admission, 8-day gap)

    Start

    2024-03-18

    Length Days

    3

    Quantity

    3-day inpatient

Spans
  • Kind

    covered

    Start

    2024-03-01

    End

    2024-03-10

    Label

    Episode 1 (collapsed): 9 days, Claims A+B+C

  • Kind

    gap

    Start

    2024-03-10

    End

    2024-03-18

    Label

    8-day gap between episodes (true readmission window)

  • Kind

    covered

    Start

    2024-03-18

    End

    2024-03-21

    Label

    Episode 2 (new admission): 3 days, Claim D

Result
Label

4 raw claims collapsed to 2 episodes; Episode 2 is a 30-day readmission (8 days post-discharge)

Value

2

Caption

Each horizontal bar is one facility claim. Claims A, B, and C are stitched together into Episode 1 by the 0-day gap and the transfer discharge status on Claim B. Claim D is separated by an 8-day gap and becomes Episode 2, which is also a 30-day readmission. A naive count of bars would report 4 hospitalizations.

Alt Text

Timeline showing four facility claim bars. The first three bars (March 1, March 2, and March 5) are visually grouped under a single Episode 1 span covering March 1 to March 10. An 8-day gap follows. The fourth bar (March 18 to March 21) stands alone as Episode 2. A readmission label marks the gap between the two episodes.

Runnable example

python implementation

Collapse facility claims into hospitalization episodes. Required input (already de-duplicated to the latest accepted version, professional claims removed, and restricted to FFS Part A person-time): fac : facility claims -> person_id, admit_date (datetime),...

import pandas as pd
import numpy as np

GAP_DAYS = 1  # 0-1 day same-stay merge: captures obs->inpatient and bed-to-bed transfers

def collapse_episodes(fac: pd.DataFrame) -> pd.DataFrame:
    f = fac.copy()
    f["is_inpatient"] = f["bill_type"].str.startswith("011")
    f["is_observation"] = f["bill_type"].str.startswith("013")
    # Keep only acute inpatient + observation facility claims for an acute-hospitalization endpoint.
    f = f[f["is_inpatient"] | f["is_observation"]].sort_values(["person_id", "admit_date", "discharge_date"])

    # Running maximum prior discharge within person guards against nested/overlapping interim bills.
    f["prev_discharge"] = (f.groupby("person_id")["discharge_date"]
                            .transform(lambda s: s.cummax().shift()))
    gap = (f["admit_date"] - f["prev_discharge"]).dt.days
    prior_was_transfer = (f.groupby("person_id")["discharge_status"].shift() == "02")

    # New episode starts when the gap exceeds GAP_DAYS AND the prior leg was not an acute transfer.
    new_episode = (f["prev_discharge"].isna()) | ((gap > GAP_DAYS) & (~prior_was_transfer))
    f["episode_id"] = new_episode.groupby(f["person_id"]).cumsum()

    ep = (f.groupby(["person_id", "episode_id"])
            .agg(episode_start=("admit_date", "min"),
                 episode_end=("discharge_date", "max"),
                 n_legs=("admit_date", "size"),
                 n_providers=("provider_id", "nunique"),
                 opened_in_observation=("is_observation", "first"))
            .reset_index())
    ep["los_days"] = (ep["episode_end"] - ep["episode_start"]).dt.days
    ep["transfer_count"] = (ep["n_providers"] - 1).clip(lower=0)
    return ep
r implementation

Collapse facility claims into hospitalization episodes (data.table). Input mirrors the Python version, already de-duplicated, professional claims removed, FFS Part A only: fac : person_id, admit_date (Date), discharge_date (Date), provider_id, bill_type...

library(data.table)
GAP_DAYS <- 1L  # 0-1 day same-stay merge

collapse_episodes <- function(fac) {
  f <- as.data.table(fac)
  f[, is_inpatient   := startsWith(bill_type, "011")]
  f[, is_observation := startsWith(bill_type, "013")]
  f <- f[is_inpatient | is_observation]
  setorder(f, person_id, admit_date, discharge_date)

  # Running max prior discharge handles overlapping interim bills; shift gives the previous leg's end.
  f[, prev_discharge := shift(cummax(as.integer(discharge_date))), by = person_id]
  f[, gap := as.integer(admit_date) - prev_discharge]
  f[, prior_transfer := shift(discharge_status) == "02", by = person_id]

  f[, new_episode := is.na(prev_discharge) | (gap > GAP_DAYS & !(prior_transfer %in% TRUE))]
  f[, episode_id := cumsum(new_episode), by = person_id]

  ep <- f[, .(episode_start = min(admit_date),
              episode_end   = max(discharge_date),
              n_legs        = .N,
              n_providers   = uniqueN(provider_id),
              opened_in_observation = first(is_observation)),
          by = .(person_id, episode_id)]
  ep[, los_days := as.integer(episode_end - episode_start)]
  ep[, transfer_count := pmax(n_providers - 1L, 0L)]
  ep[]
}