Project 001: ED-to-Inpatient Pathways

Who gets admitted from the emergency department, and how long do they stay?

From Emergency Department to Inpatient Care: Admission, Length of Stay and Asthma-Related Risk in Simulated Alberta Administrative Data. Release 2.0, October 2026.

An end-to-end health data science project on one unified set of simulated Alberta administrative data. It follows patients from the emergency department into hospital, asks what is linked to admission and length of stay, then builds a fairer comparison for adults with asthma using propensity-score matching and mixed models. Because the data are simulated, it also checks whether those methods recover the effects built into the data.

Every patient record is simulated. The 30 hospital names are real Alberta emergency departments used as reference labels only; no result describes how those hospitals actually perform.

A01 30,000 ED visits at 30 hospitals (NACRS-style)
24,190 not admitted: 23,585 sent home, 605 left without being seen
A03 5,810 admitted to hospital (19.4%)
1,177 not linked: 888 with no ID match in DAD, 289 outside the 6-hour window
A04 4,633 linked to a DAD inpatient stay (79.7%)
A05 4 days median inpatient stay (mean 4.79), modelled on ED time and CTAS

Adult asthma sub-study, from the same 30,000 visits

24,926adult ED visits
8,170main diagnosis asthma
A077,700matched pairs within hospital
Cohort flow for synthetic data release 2.0 (9 October 2026). Numbers come from memos A01–A07.

From raw extract to model, in ten memos

The project is written the way a consulting analysis would be: one memo per step, each reading the output of the one before it.

Source on GitHub

Build the data

Import, derive and profile.

  1. A00Import both workbooks and derive the research variablesData preparation
  2. A01Profile the emergency cohort: coverage, distributions, quality checksDescriptive statistics
  3. A02Profile the inpatient cohortDescriptive statistics

Admission and length of stay

The two original questions.

  1. A03Does time in the ED and triage level relate to admission?Logistic regression
  2. A04Link admitted ED visits to inpatient staysDeterministic record linkage, 6-hour window
  3. A05How do ED stay and acuity relate to inpatient length of stay?Linear regression, acute-stay sensitivity
  4. A06Summary of A00–A05 on release 2.0Findings memo

Adult asthma

Causal and multilevel methods, with hospital clustering.

  1. A07Admission risk for asthma vs. similar patients at the same hospitalPropensity-score matching, clustered RD/RR
  2. A08Adjusted admission risk, risk difference and risk ratio on the matched pairsOutcome regression, g-computation
  3. A09Do asthma admissions, and the asthma effect, differ across Calgary, Edmonton and other regions?Logistic GLMM, hospital random intercepts

A notebook for health data science

I'm Miss V. The V Lab is where I learn health data science properly and then use it: each method gets a long-form guide first, and then a place in a project built on realistic Alberta administrative data.

Everything here is synthetic or public. The data designs follow the official documentation for datasets like NACRS and DAD, and every page and analysis is open on GitHub.

How the lab works

Methods
Regression for binary and count outcomes, survival analysis, multilevel models, propensity scores, causal inference, meta-analysis
Health data
NACRS, DAD, PIN, practitioner claims, lab and vital statistics, record linkage and cohort design
Tools
R, R Markdown, renv, lme4, ggplot2, Plotly, Snowflake SQL, ArcGIS, and my own R package, VLabR

Recently updated