F. Honwana, E. Mukonda, F. Gumedze, N.-y. Hsiao, L. Myer, M. Lesosky
Objectives Virologic failure (VF) remains a major challenge in HIV care, particularly in resource-limited settings where timely identification is critical. Dynamic prediction models can provide continuously updated, individual-level risk estimates using longitudinal biomarker data. However, their applicability to routinely collected electronic health record (EHR) data remains poorly understood. We developed and internally validated a dynamic prediction model for VF using routine EHR data from people with HIV (PWH) receiving antiretroviral therapy in South Africa. Methods A joint model (JM) linking a linear mixed-effects model for longitudinal HIV viral load (HIVVL) to a Cox model for time to first VF, adjusted for baseline age group and sex at birth, was developed using routine National Health Laboratory Service data from 122,425 PWH in the Western Cape, South Africa (SA) (January 2008-September 2018), randomly split into development (n = 91,818; 75%) and validation (n = 30,607; 25%) cohorts. Predictive performance was evaluated using time-dependent area under the receiver operating characteristic curve (AUC) and Brier scores at 12 and 24 months. Results Overall, 12,547 PWH (10.2%) experienced VF. The current value-parameterized model was used and showed moderate discrimination (AUC: 0.69 and 0.73) and good calibration (Brier scores: 0.033 and 0.051) at 12 and 24 months. Dynamic predictions updated meaningfully at each visit, demonstrating potential to flag individuals at elevated VF risk for timely clinical intervention. Conclusions Dynamic prediction models hold genuine promises to support personalized, timely clinical decision-making for PWH. However, EHR data with sparse measurements, missing clinical covariates, and irregular follow-up limit discriminative performance despite adequate calibration, demonstrating that data quality and covariate availability are at least as consequential as modelling strategy in real-world prediction settings.