MemoA00
ClientDr. ABC
Client OrganizationABC Department
Version2.0
StatusDraft
ClassificationInternal use only
Note: Derived research variables are built here. They are not stored in the source workbooks.

1 Overview

1.1 Introduction

The purpose of this memo is to build the NACRS and DAD variables required for the Project 001 questions, and to record how each one is defined. These variables are calculated from source fields and are not kept in the source workbooks.

The two questions use the constructed variables as follows:

  • Hospitalization, yes or no. Among emergency visits, CTAS (ctas_level, kept in the NACRS source file) and pre-disposition stay in minutes (pre_disposition_los_min) are examined in relation to hospitalization (admitted_flag). Total emergency stay (los_min) includes time after the disposition decision, so Memo A03 reports it only as an appendix comparison.
  • Inpatient length of stay, in days. Among hospitalized visits linked to a DAD record, CTAS and total NACRS stay (los_min) are examined in relation to inpatient length of stay (los_days). acute_los_days removes alternate-level-of-care days. Memo A05 uses it only as a sensitivity outcome.

The memo is organized as follows:

  • Data identifies the source files and lists the fields that remain in those files.
  • Derived variables states each rule, then summarizes the values created from the loaded files.
  • Checks confirms that the constructed fields agree with their source fields.

1.2 Data

Training data notice: The NACRS and DAD files used in this memo are randomly generated synthetic data intended solely for training and demonstration. They do not represent real patients or actual operational records. CTAS remains a source field. Emergency stay, hospitalization, and inpatient length of stay are built in this memo.

Data directory: data

Loaded source files
Dataset File Source rows Source columns Analytic columns
NACRS pseudo_NACRS.xlsx 30000 39 50
DAD pseudo_DAD.xlsx 60000 60 64

Analytic copies, including the derived columns, are written to data/analytic_nacrs.rds and data/analytic_dad.rds.

NACRS source variables (39)
  1. patient_id
  2. visit_id
  3. facility_id
  4. health_zone
  5. sex
  6. age
  7. postal_fsa
  8. arrival_datetime
  9. arrival_mode
  10. ctas_level
  11. chief_complaint
  12. main_diagnosis_icd10
  13. secondary_diagnosis_1
  14. secondary_diagnosis_2
  15. intervention_1
  16. intervention_2
  17. consult_service
  18. injury_flag
  19. mental_health_flag
  20. pain_score
  21. triage_wait_min
  22. physician_wait_min
  23. disposition
  24. revisit_72h_flag
  25. discharge_datetime
  26. disposition_decision_datetime
  27. hospital_id
  28. hospital_region
  29. patient_residence
  30. smoking
  31. obesity
  32. cardiometabolic_history
  33. asthma_history
  34. prior_ed_visits
  35. ed_arrival_severity
  36. dataset_version
  37. hospital_name
  38. hospital_city
  39. ed_service_listed
DAD source variables (60)
  1. dad_record_id
  2. patient_id
  3. chart_number
  4. facility_id
  5. health_zone
  6. sex
  7. age_at_admission
  8. postal_fsa
  9. admission_datetime
  10. discharge_datetime
  11. admission_category
  12. admission_source
  13. most_responsible_diagnosis
  14. comorbidity_1
  15. comorbidity_2
  16. comorbidity_3
  17. comorbidity_4
  18. comorbidity_5
  19. intervention_1
  20. intervention_2
  21. intervention_3
  22. intervention_4
  23. case_mix_group
  24. mcc_flag
  25. cci_score
  26. resource_intensity_weight
  27. alc_days
  28. icu_flag
  29. icu_hours
  30. surgery_flag
  31. transfusion_flag
  32. readmission_30d_flag
  33. discharge_disposition
  34. discharge_destination
  35. attending_service
  36. most_responsible_provider
  37. entry_code
  38. transfer_from_facility
  39. transfer_to_facility
  40. newborn_flag
  41. palliative_flag
  42. abstract_status
  43. data_quality_flag
  44. source_system
  45. link_patient_id_quality
  46. admission_date_quality
  47. created_datetime
  48. hospital_id
  49. hospital_region
  50. patient_residence
  51. smoking
  52. obesity
  53. cardiometabolic_history
  54. asthma_history
  55. prior_ed_visits
  56. ed_arrival_severity
  57. dataset_version
  58. hospital_name
  59. hospital_city
  60. ed_service_listed

revisit_72h_flag and readmission_30d_flag remain in the source files because they cannot be rebuilt from the visits in these two workbooks. ctas_level and alc_days also remain in the source files.

2 Derived variables

A field is derived when its value is determined by one or more source fields. Missing inputs produce missing values. Binary indicators are 1 or 0, not character labels.

Research variables constructed in this memo
Dataset Variable Study role Rule
NACRS los_min Question 2 exposure; question 1 appendix Rounded minutes from arrival_datetime to discharge_datetime.
NACRS pre_disposition_los_min Question 1 exposure Rounded minutes from arrival_datetime to disposition_decision_datetime.
NACRS post_disposition_los_min Part of total stay, not an exposure Rounded minutes from disposition_decision_datetime to discharge_datetime.
NACRS admitted_flag Outcome: hospitalized 1 when disposition is Admitted inpatient; otherwise 0.
NACRS lwbs_flag Disposition indicator 1 when disposition is Left without being seen; otherwise 0.
NACRS ambulance_flag Arrival indicator 1 when arrival_mode is Ground ambulance; otherwise 0.
NACRS timing_quality_flag Timing quality Triage wait greater than physician wait; else physician wait greater than los_min; else Pass.
NACRS fiscal_year Reporting period Alberta fiscal year from arrival_datetime. The year starts on April 1.
DAD los_days Outcome: inpatient stay Calendar days from the admission date to the discharge date, in UTC.
DAD acute_los_days Sensitivity outcome: acute stay los_days minus alc_days, floored at 0. alc_days stays in the source file.
DAD death_flag Disposition indicator 1 when discharge_disposition is Died; otherwise 0.
DAD fiscal_year Reporting period Alberta fiscal year from admission_datetime. The year starts on April 1.
NACRS age10 Centered age for A07-A09 (age - 50)/10; age in years.
NACRS season Calendar baseline covariate Season from arrival month: Dec-Feb Winter, Mar-May Spring, Jun-Aug Summer, Sep-Nov Autumn.
NACRS asthma_visit Adult-asthma exposure/cohort indicator 1 if main_diagnosis_icd10 begins with J45; 0 otherwise; missing if the main diagnosis is missing. Adult restriction is applied separately.

2.1 NACRS emergency stay

los_min is total emergency stay, the rounded number of minutes from arrival_datetime to discharge_datetime. It is the stay measure used for the inpatient length-of-stay question. The hospitalization question uses pre_disposition_los_min instead, because total stay includes minutes after the disposition decision. The pre-disposition and post-disposition segments are split at disposition_decision_datetime, and together they sum to the total stay.

Constructed NACRS stay, in minutes
Variable Mean (SD) Median Min-Max P1 P5 P10 Q1 Q2 Q3 P90 P95 P99 Missing N Non-missing Missing %
los_min 213.87 (88.57) 196.00 49.00 - 1054.00 83.00 105.00 120.00 152.00 196.00 257.00 329.00 380.00 503.00 0 30000 30000 0
pre_disposition_los_min 187.37 (86.05) 170.00 40.00 - 1014.00 63.00 84.00 97.00 127.00 170.00 228.00 299.00 350.00 471.00 0 30000 30000 0
post_disposition_los_min 26.50 (15.19) 22.00 4.00 - 173.00 8.00 11.00 13.00 16.00 22.00 32.00 46.00 57.00 83.00 0 30000 30000 0

2.3 NACRS timing quality and fiscal year

timing_quality_flag classifies each visit using the source wait times and the constructed los_min. The first matching rule is used: triage wait greater than physician wait; otherwise physician wait greater than emergency stay; otherwise Pass. fiscal_year is the Alberta fiscal year of arrival_datetime. Each fiscal year runs from April through March and is written as 2025-26.

Constructed NACRS timing quality
timing_quality_flag Visits
Pass 29395
NA 605
Constructed NACRS fiscal year
fiscal_year Visits
2024-25 7580
2025-26 22420

2.4 DAD length of stay

los_days is the inpatient length of stay used for the second question. It is the number of calendar days from the UTC admission date to the UTC discharge date. alc_days is not recalculated; it remains in the DAD source file. acute_los_days is los_days minus alc_days, floored at zero. Memo A05 uses that acute stay only as a sensitivity outcome. death_flag is 1 when discharge_disposition is Died. fiscal_year uses the admission datetime and the same April–March rule as NACRS.

DAD length of stay, in days
Variable Mean (SD) Median Min-Max P1 P5 P10 Q1 Q2 Q3 P90 P95 P99 Missing N Non-missing Missing %
los_days 4.15 (2.23) 4.00 1.00 - 33.00 1.00 2.00 2.00 3.00 4.00 5.00 7.00 8.00 12.00 0 60000 60000 0
acute_los_days 3.95 (2.28) 3.00 1.00 - 32.00 1.00 1.00 2.00 2.00 3.00 5.00 7.00 8.00 11.00 0 60000 60000 0
alc_days 0.20 (0.62) 0.00 0.00 - 3.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 2.00 3.00 0 60000 60000 0
Constructed DAD death indicator
discharge_disposition 0 1
Died 0 883
Home 46795 0
Home with support 9637 0
Rehabilitation 2685 0
Constructed DAD fiscal year
fiscal_year Abstracts
2024-25 14995
2025-26 45005

3 Checks

Construction checks
Check Evaluated Violations Status
NACRS pre + post stay equals los_min 30000 0 Pass
NACRS los_min matches arrival to discharge 30000 0 Pass
admitted_flag matches Admitted inpatient 30000 0 Pass
ambulance_flag matches Ground ambulance 30000 0 Pass
acute_los_days equals max(los_days - alc_days, 0) 60000 0 Pass
death_flag matches Died 60000 0 Pass
DAD los_days is non-negative 60000 0 Pass

4 Shared data release 2.0

All ten memos A00–A09 use the same two source workbooks. Release 2.0-2026-10-09 replaces the former resampled records and the separate A07 cohort with a single hospital-based synthetic generation mechanism. Previous workbooks and reports are archived locally under outputs/unification/before_v2/.

The 30 hospital IDs are study codes for selected real ED facility names, with 10 in each study region: Other, Calgary and Edmonton. The latter two include surrounding towns, based on the referenced historical AHS geography. This is a selected sample; it does not reflect the actual number of hospitals or current administrative governance. facility_id and hospital_id are identical. health_zone retains five referenced geographic labels; patient_residence separately records the patient’s region of residence.

The new source variables are hospital ID, hospital region, patient residence, smoking, obesity, cardiometabolic history, asthma history, prior-year ED visits, pre-care ED severity, and data version. The pre-care severity score is synthetic, has arbitrary units, and is affected by the current episode. It is not a validated clinical score.

Three additional NACRS analysis fields are built here: age10 = (age - 50)/10, calendar season from the arrival month, and asthma_visit = 1 for a main diagnosis starting with J45. A secondary asthma diagnosis or a history of asthma does not define this exposure. The source workbooks deliberately contain only source fields; the derived RDS files are disposable caches, not independently generated datasets.

Each NACRS patient has one ED visit. Every admitted visit continues as exactly one DAD record, some of which carry deliberate identifier or timing defects for linkage practice. DAD also includes other inpatients who are not in the NACRS extract. Transfers between hospitals are not simulated. Repeat-visit/readmission flags are generated labels rather than reconstructed follow-up. A small synthetic LWBS group keeps an assigned episode diagnosis for method testing; this should not be read as a completed clinical assessment.

Counterfactual probabilities and the hospital effects used to generate the data are stored separately in data/simulation_truth.rds and are never used for fitting or matching.

4.1 Public hospital reference metadata

Both workbooks include the same hospital_reference sheet, with actual hospital names, municipalities, study regions, ED service listings, official source URLs, and a reference-check date of 2026-10-09. hospital_name, hospital_city and ed_service_listed are also included on each source record. The hospital IDs, patients, volumes, case mix and all outcomes remain synthetic. Being listed with an ED does not guarantee uninterrupted service at any given time. See the AHS Emergency Services directory.