Model · May — Jul 2024

Predicting PHQ-9 Depression Scores from Multi-Clinic EHR Data

Predicting depression severity from routine EHR data.

  • RoleCapstone · ML lead, team of 2
  • TimeframeMay — Jul 2024
  • TypeModel
140K+EHR encounters processed
MDSCapstone project, UBC
Multi-clinicEHR data from several clinics

The target

PHQ-9: nine questions, each scored 0–3

Standard severity bands (Kroenke et al., 2001). Drag to explore.

12Moderate

The pipeline

Select a step to see what it does.

Figure 1. What the model predicts, and how. Patient data is confidential, so no study data is shown on this page.

01The problem

Measuring depression severity normally needs a separate PHQ-9 visit, so patients often get flagged late.

02Approach & architecture

Led a UBC MDS capstone for GreenspaceHealth: engineered features from 140K+ multi-clinic encounters and built a calibrated, explainable model that predicts PHQ-9 severity without the questionnaire.

03Why the split matters

  • training visit
  • test visit
  • test visit from a patient the model trained on
0test visits
0from patients seen in training
0%of the test set leaks

Figure 2. Leakage lab: 16 synthetic patients with 3–8 visits each, 20% held out for testing. An illustration of the method, not study data.

04Results & impact

Measured What the work shows

Processed 140K+ EHR encounters from several clinics into a modelling dataset and delivered a model with feature-importance reports to GreenspaceHealth as the UBC MDS capstone.

Expected Possible impact, not yet measured

The aim is to flag patients whose depression may be worsening between visits, using routine EHR data alone. That use has not been evaluated in a clinic.

05Lessons

Held-out splits matter more than model architecture in clinical ML — the early Random Forest looked deceptively strong until the validation strategy switched from held-out visits to held-out patients. The biggest practical win was investing in the data pipeline before the model: most of the accuracy gain came from feature engineering on the warehouse side, not from the temporal architecture itself.

—Stack

PythonSnowflake SQLscikit-learnpandasRandom ForestTemporal Neural Network

Done as my Master of Data Science capstone with GreenspaceHealth. Underlying patient data is confidential under research agreement and is not reproduced here — this case study covers methodology, role, and outcomes only.