ResearchBMC Primary Care · Sep 10, 2026

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

Díaz Vera AS, Abellán Alemán J, Golac Rabanal MDS, Marco Detchart C, Astudillo Astudillo MA, Zhuzhingo Vásquez CJ, et al
Family Medicine & Primary CareEndocrinology & DiabetesDigital Health & AIAdult

Study type: Observational study: it can show a link, but not prove that one thing causes another.

Read the full paper free at PubMed Central ↗

Abstract

Background 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. Objective 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. Methods 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. Results 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. Conclusions 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.

More on this topic

AI in medicine

Subject terms

Humans; Diabetic Retinopathy; Diabetic Nephropathies; Female; Male; Diabetes Mellitus, Type 2; Cross-Sectional Studies; Primary Health Care; Machine Learning; Middle Aged; Random Forest; Logistic Models

DOI: 10.1186/s12875-026-03542-9 · PubMed: 43114193

Cite this article

Díaz Vera AS, Abellán Alemán J, Golac Rabanal MDS, et al. Machine learning models based on routinely collected primary care data for documented diabetic retinopathy and nephropathy: development and internal validation. BMC Prim Care. 2026;27(1). doi:10.1186/s12875-026-03542-9

RIS (EndNote, Zotero, Mendeley)BibTeX

Spotted a mistake? Suggest a correction

Top Family Medicine & Primary Care studies every Monday

The week’s key trials and guidelines, free to read, in one short email. No account; unsubscribe in one click.

Choose specialties and topics

Similar articles

Research Adults · BMC Prim Care · Jul 6, 2026 · Family Medicine & Primary Care, Endocrinology & Diabetes

Clinical phenotypes of type 2 diabetes and their association with microvascular complications in primary care: a cluster analysis

Research Adults · Rheumatology · Apr 22, 2026 · Rheumatology, Digital Health & AI

Amyloidosis secondary to familial Mediterranean fever: machine learning-based prediction models

Research Adults · Transl Vis Sci Technol · Aug 26, 2026 · Ophthalmology, Digital Health & AI

Machine Learning and Metabolomics to Characterize Warburg-Like Metabolic Subtypes in Human Retinal Endothelial Cells Exposed to Risk Factors Associated With Proliferative Diabetic Retinopathy

Research Adults · BMC Prim Care · Jan 30, 2026 · Family Medicine & Primary Care, Digital Health & AI

Development and validation of a machine learning based suitability assessment model for primary healthcare facilities in metropolitan China

Meta-analysis Adults n = 1,325,493 · Diabetologia · Dec 14, 2020 · Endocrinology & Diabetes, Cardiology

Younger age at type 2 diabetes diagnosis linked to higher mortality and vascular risk