Leveraging Machine Learning Models and Pharmacy Refill Adherence as a Cost-Effective Proxy for Predicting HIV Viral Suppression during Antiretroviral Therapy in Resource-Limited Settings

This article has been Reviewed by the following groups

Read the full article

Discuss this preprint

Start a discussion What are Sciety discussions?

Listed in

Log in to save this article

Abstract

Introduction

Achieving viral suppression is central to HIV epidemic control; however, routine viral load (VL) testing in many low- and middle-income countries is constrained by laboratory capacity, logistics, and cost. In Tanzania, disparities in VL coverage persist across age groups and geographical regions, limiting the timely detection of treatment failure. Pharmacy refill adherence is a low-cost, routinely collected objective indicator of treatment behavior. This study assessed whether pharmacy refill adherence, enhanced using machine learning (ML) models, can reliably predict viral suppression among people living with HIV (PLHIV) in Tanzania.

Methods

We conducted a retrospective analysis using nationally representative patient-level data from the Care and Treatment Center (CTC-2) database, collected between 2017 and 2021. A random sample of 40,000 records was drawn, of which 28,044 patients met the inclusion criteria. Pharmacy refill adherence was calculated as the proportion of days covered and capped at 100%. Viral suppression was defined as a VL of <1,000 copies/mL. Logistic regression, Random Forest, Gradient Boosting Machine (GBM), and XGBoost models were trained using an 80/20 training–testing split, and the model performance was evaluated using the area under the receiver operating characteristic curve (AUC). Youden’s Index was used to determine the optimal adherence threshold.

Results

Among the 28,044 patients included in the analysis, the median age at ART initiation was 38 years, and 64.9% were female. The median pharmacy refill adherence was 90.64% (mean, 87.37%). Viral load (VL) measurements were available for 21,572 patients, of whom 88.7% achieved viral suppression. Higher pharmacy refill adherence was strongly associated with viral suppression, whereas lower adherence was observed among adolescents, young adults, and individuals who were lost to follow-up. Marked geographic variation was observed, with higher adherence in regions such as Dar es Salaam and lower adherence in more remote regions, including Rukwa and Singida. Among machine learning models, XGBoost demonstrated the highest predictive performance (AUC >0.85), followed by Gradient Boosting Machines and Random Forest, while logistic regression provided stable baseline estimates. Pharmacy refill adherence, duration of follow-up, clinic visit frequency, and patient age were the strongest predictors of viral suppression.

Conclusion

Pharmacy refill adherence is a strong predictor of viral suppression and provides a feasible and cost-effective tool for monitoring ART outcomes in settings with limited VL testing. Machine learning approaches further enhance the predictive value of routine program data and can support the early identification of patients at risk of virological failure. Integrating adherence-based predictive analytics into national HIV program monitoring systems may strengthen differentiated service delivery, improve treatment outcomes, and accelerate progress toward the UNAIDS 95–95–95 targets in Tanzania and similar resource-limited settings.

Article activity feed