Project 001: ED-to-Inpatient Pathways
Who is admitted from the emergency department, how long do they stay, and what changes with asthma?
From Emergency Department to Inpatient Care: Admission, Length of Stay and Asthma-Related Risk in Simulated Alberta Administrative Data.
An end-to-end health data science project on one shared synthetic dataset: 30,000 Alberta-style emergency visits (NACRS) and 60,000 inpatient abstracts (DAD) across 30 hospitals.
Ten memos take it from raw extract to answers. They ask what is linked to admission, link admitted visits to their inpatient stays to ask what is linked to length of stay, then build a fair comparison for adults with asthma, by hospital and by region, using propensity-score matching, outcome regression and mixed models. Because the true effects are built into the data, the project also checks whether those methods recover them.
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.
Adult asthma extension, from the same 30,000 visits
Four questions, four answers
Headline results from the project summary, Memo A09. Every figure comes from simulated data.
Q1 · Admission · A03
Triage level drives admission
The adjusted odds of admission fall at every CTAS level, to an odds ratio of 0.056 at CTAS 5 versus CTAS 1. Time before the disposition decision adds little: OR 1.024 per 60 minutes (95% CI 1.003 to 1.045).
Q2 · Stay in hospital · A04–A05
ED time does not predict inpatient stay
4,633 of 5,810 admitted visits (79.7%) link to an inpatient stay. Once CTAS is included, ED stay is unrelated to inpatient stay (−0.011 days per 60 minutes, 95% CI −0.056 to 0.034). Stays after a CTAS 5 visit are 2.78 days shorter than after CTAS 1.
Q3 · Asthma · A06–A07
Asthma adds about 10 points of admission risk
Across 7,700 within-hospital matched pairs, admission is 31.8% versus 21.8%: +10.00 points (95% CI 7.59 to 12.41). Outcome regression on the same pairs gives +9.54 points (8.47 to 10.61). The value built into the simulation is 10.38.
Q4 · Regions · A08
The asthma gap differs by region
With a common patient mix, Edmonton-region hospitals admit adult asthma visits more often than Other (+7.23 points, 95% CI 2.16 to 12.99); Calgary's −5.72 points is not established. The asthma gap differs by region (χ² = 78.0 on 2 df, p < 0.001).
Do the methods work? Across repeated simulations with a known truth, the asthma estimators are biased by at most 0.61 points, 95% intervals cover the truth 92%–98% of the time, and false-positive rates are 3%–4% when there is no effect. Read the A09 summary
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.
Build the data
Import, derive and profile.
Admission and length of stay
The two original questions.
Adult asthma
Matching, outcome regression and regional models.
- A06Admission risk for asthma vs. similar patients at the same hospitalWithin-hospital propensity-score matching
- A07Standardized admission risk on A06's fixed pairsOutcome regression, hospital fixed effects
- A08Do asthma admissions, and the asthma gap, differ across Calgary, Edmonton and other regions?Logistic GLMM, hospital random intercepts
Project 002: Calgary Housing Observatory
What does Calgary's housing market look like, community by community?
An interactive R Shiny dashboard on 21,279 Calgary residential listings, matched to the City of Calgary's official community boundaries. Filter by price, home type, bedrooms and year built, and the community map, charts and table all update together.
The spread is far wider between communities than between sectors: among communities with at least 50 listings, median list prices run from about $272,000 in Lincoln Park to $2.26 million in Elbow Park.
- Listings
- 21,279 in 220 communities
- Median list price
- $575,000 $393 per square foot
- Median days on market
- 28 24 for houses, 39 for apartments
- Highest sector median
- West $743,000, against $440,000 in the East
Community-level summaries of one MLS listings extract: no addresses, MLS numbers or listing-level records are published. Figures are list prices, not sales or valuations.
A notebook for data analysis
I'm Miss V, a data analysis enthusiast with wide interests and one main pull: large data, the kind that lives in administrative records and big tables, and only becomes useful after careful cleaning, linkage and modelling. Healthcare administrative data is the area I care about most. The V Lab is where I learn each method properly, write it up as a long-form guide, and then put it to work in a project.
Projects use synthetic, public or community-level data only. The health projects follow the official documentation for datasets like NACRS and DAD, and the learning guides are open on GitHub.
- Methods
- Regression for binary and count outcomes, survival analysis, multilevel models, propensity scores, causal inference, meta-analysis
- Data
- Healthcare administrative data (NACRS, DAD, PIN, practitioner claims, lab and vital statistics), housing listings, record linkage and cohort design
- Tools
- R, R Markdown, Shiny, renv, lme4, ggplot2, Plotly, Snowflake SQL, ArcGIS, and my own R package, VLabR
Learning tracks
22 guides, each a single page with worked examples and R code you can run.
Biostatistics
14 guidesFrom foundations to survival analysis, multilevel models and causal inference.
Epidemiology
3 guidesDisease frequency, study designs, bias and modern causal methods.
Data visualization
2 guidesPublication-ready ggplot2 and interactive Plotly charts.
Reproducible reporting
1 guideR Markdown documents that rebuild themselves from the data.
Data platforms and GIS
2 guidesSnowflake for data where it lives; ArcGIS for where patients are.
VLabR and Python
ToolsAn R package for cleaning, summaries, de-identification and Alberta hospital travel, plus Python practice.
Reference pages: Alberta's official health geographies, finding disease clusters with SaTScan and writing math in Markdown and LaTeX.
Recently updated
- Project 002: Calgary Housing ObservatoryNew: an interactive Shiny dashboard of Calgary residential listings, summarized by community on official City of Calgary boundaries
- Project 001: ED-to-Inpatient PathwaysMemos realigned: A06 matches adult asthma visits, A07 standardizes those pairs, A08 compares regions, and A09 summarizes A00–A08
- VLabR 0.0.0.9043Adds Alberta hospital lookup, nearest-hospital travel, file import, and date helpers. Requires R 4.4.0
- Python LabBeginner Python exercises
- Getting started with ArcGISNew GIS course
- Biostatistics guides14 in-depth statistics guides