Routine urinalysis-based machine learning framework for predicting urine culture contamination
Related Experiment Video
Updated: Nov 8, 2026

Low-Cost, Volume-Controlled Dipstick Urinalysis for Home-Testing
Published on: May 8, 2021
Yunying Chen1, Xianfei Ye2, Cuiying Ye1
1Department of Laboratory Medicine, Hangzhou Children's Hospital, Hangzhou, PR China.
Background:
Urine culture contamination is a common preanalytical challenge, yet conventional urinalysis strategies rarely treat it as an independent outcome.
Methods:
This retrospective study included 8446 specimens from 6686 patients, split at the patient level into training and internal validation sets. An additional 3481 specimens from 2819 patients at two other campuses of the same hospital system were used for external validation. Nineteen demographic and routine urinalysis variables were analyzed. We developed a two-stage XGBoost framework that first distinguished bacterial growth from negative culture and then contamination from pathogenic growth. Thresholds were selected during training to maintain ≥95% sensitivity for bacterial-growth detection in Stage 1 and ≥ 95% specificity for pathogenic growth in Stage 2. Comparators included one-stage three-class, class-weighted, and binary contamination-versus-rest XGBoost models and SEC-based rules.
Results:
The binary contamination-versus-rest model and SEC-based rules showed limited contamination recall (0.411 [0.348-0.475] to 0.589 [0.525-0.651]). Relative to the two-stage reference, the one-stage three-class model had significantly lower contamination recall (0.572 versus 0.732) and pathogenic-growth recall (0.746 versus 0.901) in internal validation (both Holm-adjusted P < 0.001), whereas the class-weighted model achieved comparable contamination recall (0.765) but with reduced pathogenic-growth recall (0.741) and a higher pathogen-to-contamination error rate (0.091 versus 0.033). Decision curve analysis showed positive net benefit at both external sites. SHapley Additive exPlanations (SHAP) identified bacilli count, SEC, and WBC as the main contributors in Stage 2.
Conclusions:
This two-stage framework may support urine culture diagnostic stewardship by flagging approximately three-quarters of contaminated cultures before culture reporting. Prospective multicenter and cross-platform validation is needed before routine implementation.
Related Concept Videos
Urine Studies II: Urine Culture and Sensitivity Test
Urine Studies I: Urinalysis
Automated Microbial Diagnostics
Steps in Outbreak Investigation