MemoA04
ClientDr. ABC
Client OrganizationABC Department
Version1.0
StatusDraft
ClassificationInternal use only
Note: Data preparation is completed in Memo A00. This memo links hospitalized emergency visits to inpatient abstracts.

1 Overview

1.1 Introduction

The purpose of this memo is to link hospitalized emergency visits to the inpatient abstract for the same stay. The cohort consists of all NACRS visits with admitted_flag equal to 1. Memo A00 sets that flag when disposition is Admitted inpatient.

Linkage is visit-level, not person-level. A person with two admitted emergency visits can match two different DAD abstracts. The personal health number (PHN) is matched first, and the time window is then applied only to abstracts that share that number. A DAD abstract with a different personal health number is never accepted, even if the times are close.

Data preparation is completed in Memo A00. This memo reads analytic_nacrs.rds and analytic_dad.rds.

2 Linkage rule

In these files the personal health number (PHN) is stored as patient_id; there is no separate PHN column. Let \(i\) index hospitalized NACRS visits and \(j\) index DAD abstracts, and write

  • \(d_i\) for the ED discharge time of visit \(i\) (NACRS discharge_datetime);
  • \(a_j\) for the inpatient admission time of abstract \(j\) (DAD admission_datetime);
  • \(\Delta_{ij} = \lvert a_j - d_i \rvert\) for the absolute gap between the two, in hours.

Step 1: candidates. Abstract \(j\) is a candidate for visit \(i\) only when both conditions hold:

\[C_i = \bigl\{\, j \;:\; \mathrm{PHN}_j = \mathrm{PHN}_i \ \text{ and } \ \Delta_{ij} \le 6 \,\bigr\}\]

Because the gap is absolute, an admission up to 6 hours before or after the ED discharge qualifies, and a gap of exactly 6 hours is included. DAD rows with a missing patient_id can never meet the PHN condition.

Step 2: closest match. Among the candidates, the abstract with the smallest gap is kept:

\[j^{*}(i) = \mathop{\mathrm{arg\,min}}\limits_{j \in C_i} \Delta_{ij}\]

The visit is left unlinked when \(C_i\) is empty. If two or more candidates share the smallest gap, the visit is also left unlinked and counted as ambiguous.

±6-hour window di = ED discharge of visit i Same PHN Different PHN Δ = 1.5 h Linked: smallest gap Candidate (gap 4 h) Outside window PHN differs: never compared −8−6−4−20246810 Hours from ED discharge to inpatient admission (aj − di)
Figure 1. Matching one hospitalized ED visit. Only abstracts with the same PHN are considered. Of those admitted within 6 hours before or after the ED discharge, the closest one is linked.

2.1 Data

Training data notice: The visits and abstracts are randomly generated synthetic records. Preprocessing is completed in Memo A00.
Analytic files used for linkage
File Records Used in linkage
analytic_nacrs.rds 30000 5,810 hospitalized visits
analytic_dad.rds 60000 59,533 abstracts with a PHN

One row per hospitalized visit is written to data/analytic_linkage.rds. Unlinked visits are kept, with the DAD record ID left missing.

3 Linkage results

3.1 Funnel

The counts below are hospitalized emergency visits. Each step keeps only the visits that passed the previous step.

Linkage funnel for hospitalized emergency visits
Step Visits Share of hospitalized visits
Hospitalized NACRS visits 5810 100.0%
Same PHN on at least one DAD abstract 4922 84.7%
Discharge within 6 hours of that admission 4633 79.7%

3.3 Linked pairs

Description of the linked pairs
Measure Value
Linked visits 4,633
Distinct DAD abstracts 4,633
Same facility 4,633 of 4,633
DAD admission source Emergency Department 4633
Hours, admission minus discharge: minimum 0.17
Hours, admission minus discharge: median 1.07
Hours, admission minus discharge: maximum 2.00

The hours column is DAD admission time minus NACRS discharge time. A positive value means the inpatient admission is after the emergency discharge. Among the linked pairs, the median difference is 1.07 hours, and every difference is within 6.00 hours by construction. 4,633 of the linked pairs are at the same facility.

3.4 Personal health number matches outside the window

Closest same-PHN admission among visits that failed the time-window rule
Measure Value
Visits 289
Closest PHN match, absolute hours: minimum 7.00
Closest PHN match, absolute hours: median 16.00
Closest PHN match, absolute hours: maximum 24.00

These 289 visits do have a DAD abstract with the same personal health number. The closest of those admissions is still more than 6 hours from the emergency discharge. The closest gaps range from 7.00 to 24.00 hours, so these visits are not linked.

3.5 Linked and not linked

Memo A05 uses only the linked visits, which are a subset of all hospitalized visits. The table below compares linked and unlinked visits on CTAS, total emergency stay, and pre-disposition stay. The hospitalization question uses pre-disposition stay. The length-of-stay question uses total emergency stay.

CTAS and emergency stay among hospitalized visits, by linkage
Measure Linked Not linked
Visits 4,633 1,177
Median total emergency stay, minutes 235 239
Median pre-disposition stay, minutes 189 194
CTAS 1 1,443 (31.1%) 347 (29.5%)
CTAS 2 1,488 (32.1%) 393 (33.4%)
CTAS 3 1,110 (24.0%) 290 (24.6%)
CTAS 4 456 (9.8%) 117 (9.9%)
CTAS 5 136 (2.9%) 30 (2.5%)

Any difference in this table means that the length-of-stay results do not automatically extend to the unlinked hospitalized visits. No length of stay is imputed for them.

4 Shared data

All memos in Project 001 (A00–A09) use the same two synthetic source workbooks, pseudo_NACRS.xlsx and pseudo_DAD.xlsx. Hospital location and patient residence are separate variables. See A00 for definitions and provenance.