Applied Health Economics, RWE & HTA
Overview / Module 1
Module 1 · Part 1 · Health data and methods · Days 1–10

The Canadian Health System and Health Data Engineering

Who pays for care in Ontario and Quebec, what records that leaves, the coding systems, and an analysis-ready cohort with costs in Python, R and SAS.

Tools

PythonDuckDBdbtRSAS

Module capstone

Analysis-ready cohort and 3-year cost dataset

The 10 days

About this module

Module 1 runs for ten days. By Day 10 you will have turned raw administrative tables into an analysis-ready cohort with three years of costs, built in Python, R and SAS. Days 1–3 come first because nothing later makes sense without them. You need to know who pays for care in Ontario and Quebec, which records that payment leaves behind, and how those records are coded.

The running case. Corridor Health is a synthetic population of 250,000 adults: 62% in Ontario and 38% in Quebec. Its tables have the shape of the files a health economist meets at ICES, CIHI or RAMQ: a registry, physician claims, hospital discharge abstracts and public drug claims. Everyone in it is invented. So are the prices, fees, plan amounts and every code marked "course code". Renavex is a fictional drug for chronic kidney disease in type 2 diabetes. Over the course you will follow it from its first reimbursement review to a full health technology assessment.

What you build in Days 1–3

DayYou buildYou learn
1corridor/db.py (all tables as DuckDB views), corridor/costshare.py (who pays for a prescription)How health care and drugs are paid for in Ontario and Quebec, and how a new drug reaches public coverage
2corridor/privacy.py (small-cell suppression, uniqueness checks)Who holds health data in the corridor, how access and privacy work, person-time, and what each data source cannot see
3corridor/codes.py and codelists/diabetes_ckd.csvICD-10, ICD-9, CCI, DIN, ATC, fee codes, case-mix groups and resource weights, and hospital costing

Folder layout after Day 3

corridor-health/
├── requirements.txt
├── .gitignore
├── data/
│   ├── make_data.py          # the generator (run once; ~25 s; writes ~165 MB of CSV)
│   ├── *.csv                 # generated tables (not committed to Git)
│   └── truth/                # hidden answers for later days - do not open
├── corridor/                 # your course package, one module at a time
│   ├── __init__.py
│   ├── db.py                 # Day 1
│   ├── costshare.py          # Day 1
│   ├── privacy.py            # Day 2
│   └── codes.py              # Day 3
├── codelists/diabetes_ckd.csv
├── day01/ day02/ day03/      # one script per section
└── tests/                    # pytest known-answer tests

Packages. M1–M4 use Python. R joins on Day 8 and SAS on Day 9.

# Corridor Health course: Python packages (Modules 1-4). Tested versions.
duckdb==2.0.1
pandas==3.1.1
numpy==2.5.5
matplotlib==3.11.2
pytest==9.2.0

A note on the numbers. Plan rules, fees and prices are course values that look like the real ones. They are not today's amounts. Real plans change their amounts every year (RAMQ every 1 July), so always look up current values before real work.