Work

Machine learning models based on routinely collected primary care data for documented diabetic retinopathy and nephropathy: development and internal validation

Year: 2026
Type: article
Study design: Observational Study
Abstract: Diabetic retinopathy (DR) and diabetic nephropathy (DN) are among the most common microvascular complications of type 2 diabetes mellitus (T2DM). Routinely collected clinical data could support exploratory case-finding strategies for documented diabetic complications in primary care. However, clinically applicable models based exclusively on routinely available variables remain scarce. To develop and internally validate machine learning models for identifying documented diabetic retinopathy and diabetic nephropathy using routinely collected clinical data from adults with T2DM managed in primary care. We conducted a cross-sectional study including 680 adults with T2DM from primary care centres in Cantabria, Spain. The models were developed to identify prevalent documented complications rather than predict incident disease. Conventional logistic regression, penalised logistic regression and random forest models were developed using routinely collected demographic, anthropometric, clinical, laboratory and lifestyle variables. Variables directly used to define the study outcomes were excluded from model development to minimise information leakage, and serum creatinine was evaluated separately in a predefined sensitivity analysis. Model performance was assessed using repeated stratified five-fold cross-validation with three repetitions. Discrimination, sensitivity, specificity, F1-score, Brier score and calibration were evaluated, and 1,000 non-parametric bootstrap resamples were used to estimate 95% confidence intervals and formally compare model discrimination. Documented diabetic retinopathy was present in 199 of 680 participants (29.3%), whereas documented diabetic nephropathy was present in 211 of 668 participants with available nephropathy outcome information (31.6%). For documented diabetic retinopathy, the random forest model achieved the highest discrimination (AUC 0.838, 95% CI 0.803–0.870), compared with conventional logistic regression (AUC 0.795, 95% CI 0.756–0.832). Formal bootstrap comparison demonstrated significantly higher discrimination for the random forest than for conventional logistic regression (ΔAUC 0.043, 95% CI 0.020–0.065; P = 0.002). For documented diabetic nephropathy, discrimination was lower across all models (AUC range 0.687–0.702), and no statistically significant differences were observed between modelling approaches. Sensitivity analysis showed that including serum creatinine did not materially change discrimination compared with the primary penalised logistic regression model without creatinine. Because serum creatinine is mathematically related to estimated glomerular filtration rate, which contributed to nephropathy ascertainment, creatinine-free models were retained as the primary analysis to minimise potential target-proxy leakage. Machine learning models based exclusively on routinely collected primary care data demonstrated moderate ability to identify documented diabetic retinopathy but lower performance for documented diabetic nephropathy. The random forest model showed significantly higher discrimination than conventional logistic regression for documented diabetic retinopathy, whereas no clear advantage was observed for documented diabetic nephropathy. These findings suggest that routinely collected clinical data may warrant further evaluation as exploratory case-finding tools in primary care, but the present study does not establish clinical utility or the ability to detect previously undiagnosed complications. The models should not be considered replacements for guideline-recommended screening programmes. External validation, prospective evaluation and assessment of clinical utility are required before clinical implementation.
Language: English
Open Access status: gold
Estimated APC paid: $2,790
OpenAlex ID: W7212128902
FWCI:
Cites:
Cited by:
Related to: