Personal clinical history predicts antibiotic resistance of urinary tract infections


Antibiotic resistance is prevalent among the bacterial pathogens causing urinary tract infections. However, antimicrobial treatment is often prescribed ‘empirically’, in the absence of antibiotic susceptibility testing, risking mismatched and therefore ineffective treatment. Here, linking a 10-year longitudinal data set of over 700,000 community-acquired urinary tract infections with over 5,000,000 individually resolved records of antibiotic purchases, we identify strong associations of antibiotic resistance with the demographics, records of past urine cultures and history of drug purchases of the patients. When combined together, these associations allow for machine-learning-based personalized drug-specific predictions of antibiotic resistance, thereby enabling drug-prescribing algorithms that match an antibiotic treatment recommendation to the expected resistance of each sample. Applying these algorithms retrospectively, over a 1-year test period, we find that they greatly reduce the risk of mismatched treatment compared with the current standard of care. The clinical application of such algorithms may help improve the effectiveness of antimicrobial treatments.

Access optionsAccess options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Fig. 1: Frequency of bacterial species and antibiotic resistance in urinary tract infections.
Fig. 2: Antibiotic-specific associations of resistance with demographic factors.
Fig. 3: Long-term ‘memory’ of resistance across same-patient samples.
Fig. 4: Direct association of past purchase with its cognate resistance leads, through association among resistances, to indirect association of purchases with non-cognate resistances.
Fig. 5: Algorithmically suggesting antibiotic prescription for empirical treatments can greatly improve upon the current standard of care.

Data availability

The data that support the findings of this study are available from Maccabi Healthcare Services but restrictions apply to the availability of these data, which were used under license for the current study, and so are not publicly available. Access to the data is, however, available upon reasonable request and signing an MTA agreement with Maccabi Healthcare Services.

Code availability

Code used for data analysis is available upon request.


  1. 1.

    Ventola, C. L. The antibiotic resistance crisis: part 1: causes threats. P T. 40, 277–283 (2015).

  2. 2.

    Rossolini, G. M., Arena, F., Pecile, P. & Pollini, S. Update on the antibiotic resistance crisis. Curr. Opin. Pharmacol. 18, 56–60 (2014).

  3. 3.

    Goossens, H., Ferech, M., Vander Stichele, R. & Elseviers, M., ESAC Project Group. Outpatient antibiotic use in Europe and association with resistance: a cross-national database study. Lancet 365, 579–587 (2005).

  4. 4.

    Bronzwaer, S. L. A. M. et al. A European study on the relationship between antimicrobial use and antimicrobial resistance. Emerg. Infect. Dis. 8, 278–282 (2002).

  5. 5.

    Costelloe, C., Metcalfe, C., Lovering, A., Mant, D. & Hay, A. D. Effect of antibiotic prescribing in primary care on antimicrobial resistance in individual patients: systematic review and meta-analysis. BMJ 340, c2096 (2010).

  6. 6.

    Fridkin, S. K. et al. The effect of vancomycin and third-generation cephalosporins on prevalence of vancomycin-resistant enterococci in 126 U.S. adult intensive care units. Ann. Intern. Med. 135, 175–183 (2001).

  7. 7.

    Malhotra-Kumar, S., Lammens, C., Coenen, S., Van Herck, K. & Goossens, H. Effect of azithromycin and clarithromycin therapy on pharyngeal carriage of macrolide-resistant streptococci in healthy volunteers: a randomised, double-blind, placebo-controlled study. Lancet 369, 482–490 (2007).

  8. 8.

    Kang, C.-I. et al. Bloodstream infections caused by antibiotic-resistant Gram-negative bacilli: risk factors for mortality and impact of inappropriate initial antimicrobial therapy on outcome. Antimicrob. Agents Chemother. 49, 760–766 (2005).

  9. 9.

    Kumar, A. et al. Initiation of inappropriate antimicrobial therapy results in a fivefold reduction of survival in human septic shock. Chest 136, 1237–1248 (2009).

  10. 10.

    Huang, A. M. et al. Impact of rapid organism identification via matrix-assisted laser desorption/ionization time-of-flight combined with antimicrobial stewardship team intervention in adult patients with bacteremia and candidemia. Clin. Infect. Dis. 57, 1237–1245 (2013).

  11. 11.

    Stamm, W. E. & Norrby, S. R. Urinary tract infections: disease panorama and challenges. J. Infect. Dis. 183, S1–4 (2001).

  12. 12.

    Engel, J. D. & Schaeffer, A. J. Evaluation of and antimicrobial therapy for recurrent urinary tract infections in women. Urol. Clin. North. Am. 25, 685–701 (2005).

  13. 13.

    Geerlings, S. E. Clinical presentations and epidemiology of urinary tract infections. Microbiol. Spectr. 4 (2016).

  14. 14.

    Shapiro, D. J., Hicks, L. A., Pavia, A. T. & Hersh, A. L. Antibiotic prescribing for adults in ambulatory care in the USA, 2007–09. J. Antimicrob. Chemother. 69, 234–240 (2014).

  15. 15.

    Low, M. et al. Infectious disease burden and antibiotic prescribing in primary care in Israel. Ann. Clin. Microbiol. Antimicrob. 17, 26 (2018).

  16. 16.

    Kahlmeter, G. An international survey of the antimicrobial susceptibility of pathogens from uncomplicated urinary tract infections: the ECO/textperiodcentered SENS Project. J. Antimicrob. Chemother. 51, 69–76 (2003).

  17. 17.

    Farrell, D. J., Morrissey, I., De Rubeis, D., Robbins, M. & Felmingham, D. A UK multicentre study of the antimicrobial susceptibility of bacterial pathogens causing urinary tract infection. J. Infect. 46, 94–100 (2003).

  18. 18.

    Foxman, B. Epidemiology of urinary tract infections: incidence, morbidity, and economic costs. Am. J. Med. 113, 5S–13S (2002).

  19. 19.

    Flores-Mireles, A. L., Walker, J. N., Caparon, M. & Hultgren, S. J. Urinary tract infections: epidemiology, mechanisms of infection and treatment options. Nat. Rev. Microbiol. 13, 269–284 (2015).

  20. 20.

    Pouwels, K. B. et al. Association between use of different antibiotics and trimethoprim resistance: going beyond the obvious crude association. J. Antimicrob. Chemother. 73, 1700–1707 (2018).

  21. 21.

    Ashkenazi, S., Even-Tov, S., Samra, Z. & Dinari, G. Uropathogens of various childhood populations and their antibiotic susceptibility. Pediatr. Infect. Dis. J. 10, 742–746 (1991).

  22. 22.

    Kahan, N. R. et al. Empiric treatment of uncomplicated urinary tract infection with fluoroquinolones in older women in Israel: another lost treatment option? Ann. Pharmacother. 40, 2223–2227 (2006).

  23. 23.

    Hooton, T. M., Besser, R., Foxman, B., Fritsche, T. R. & Nicolle, L. E. Acute uncomplicated cystitis in an era of increasing antibiotic resistance: a proposed approach to empirical therapy. Clin. Infect. Dis. 39, 75–80 (2004).

  24. 24.

    Arslan, H., Azap, O. K., Ergönül, O. & Timurkaynak, F. Urinary Tract Infection Study Group. Risk factors for ciprofloxacin resistance among Escherichia coli strains isolated from community-acquired urinary tract infections in Turkey. J. Antimicrob. Chemother. 56, 914–918 (2005).

  25. 25.

    Ikram, R., Psutka, R., Carter, A. & Priest, P. An outbreak of multi-drug resistant Escherichia coli urinary tract infection in an elderly population: a case-control study of risk factors. BMC Infect. Dis. 15, 224 (2015).

  26. 26.

    Foxman, B. & Brown, P. Epidemiology of urinary tract infections: transmission and risk factors, incidence, and costs. Infect. Dis. Clin. North Am. 17, 227–241 (2003).

  27. 27.

    Tenney, J., Hudson, N., Alnifaidy, H., Li, J. T. C. & Fung, K. H. Risk factors for aquiring multidrug-resistant organisms in urinary tract infections: a systematic literature review. Saudi Pharm J. 26, 678–684 (2018).

  28. 28.

    Colgan, R., Johnson, J. R., Kuskowski, M. & Gupta, K. Risk factors for trimethoprim-sulfamethoxazole resistance in patients with acute uncomplicated cystitis. Antimicrob. Agents Chemother. 52, 846–851 (2008).

  29. 29.

    Burman, W. J. et al. Conventional and molecular epidemiology of trimethoprim-sulfamethoxazole resistance among urinary Escherichia coli isolates. Am. J. Med. 115, 358–364 (2003).

  30. 30.

    Kang, M.-S., Lee, B.-S., Lee, H.-J., Hwang, S.-W. & Han, Z.-A. Prevalence of and risk factors for multidrug-resistant bacteria in urine cultures of spinal cord injury patients. Ann. Rehabil. Med. 39, 686–695 (2015).

  31. 31.

    Lee, G., Cho, Y.-H., Shim, B. S. & Lee, S. D. Risk factors for antimicrobial resistance among the Escherichia coli strains isolated from Korean patients with acute uncomplicated cystitis: a prospective and nationwide study. J. Korean Med. Sci. 25, 1205–1209 (2010).

  32. 32.

    Johnson, L. et al. Emergence of fluoroquinolone resistance in outpatient urinary Escherichia coli isolates. Am. J. Med. 121, 876–884 (2008).

  33. 33.

    Paul, M. et al. Improving empirical antibiotic treatment using TREAT, a computerized decision support system: cluster randomized trial. J. Antimicrob. Chemother. 58, 1238–1245 (2006).

  34. 34.

    MacFadden, D. R., Ridgway, J. P., Robicsek, A., Elligsen, M. & Daneman, N. Predictive utility of prior positive urine cultures. Clin. Infect. Dis. 59, 1265–1271 (2014).

  35. 35.

    Olesen, S. W., Barnett, M. L., MacFadden, D. R., Lipsitch, M. & Grad, Y. H. Trends in outpatient antibiotic use and prescribing practice among US older adults, 2011–15: observational study. BMJ 362, k3155 (2018).

  36. 36.

    Ena, J., Amador, C., Martinez, C. & Ortiz de la Tabla, V. Risk factors for acquisition of urinary tract infections caused by ciprofloxacin resistant Escherichia coli. J. Urol. 153, 117–120 (1995).

  37. 37.

    Brown, P. D., Freeman, A. & Foxman, B. Prevalence and predictors of trimethoprim-sulfamethoxazole resistance among uropathogenic Escherichia coli isolates in Michigan. Clin. Infect. Dis. 34, 1061–1066 (2002).

  38. 38.

    Metlay, J. P., Strom, B. L. & Asch, D. A. Prior antimicrobial drug exposure: a risk factor for trimethoprim-sulfamethoxazole-resistant urinary tract infections. J. Antimicrob. Chemother. 51, 963–970 (2003).

  39. 39.

    Low, M. et al. Association between urinary community-acquired fluoroquinolone-resistant Escherichia coli and neighbourhood antibiotic consumption: a population-based case-control study. Lancet Infect. Dis. 19, 419–428 (2019).

  40. 40.

    Wang, A., Daneman, N., Tan, C., Brownstein, J. S. & MacFadden, D. R. Evaluating the relationship between hospital antibiotic use and antibiotic resistance in common nosocomial pathogens. Infect. Control Hosp. Epidemiol. 38, 1457–1463 (2017).

  41. 41.

    Gupta, K. et al. International clinical practice guidelines for the treatment of acute uncomplicated cystitis and pyelonephritis in women: a 2010 update by the Infectious Diseases Society of America and the European Society for Microbiology and Infectious Diseases. Clin. Infect. Dis. 52, e103–e120 (2011).

  42. 42.

    Lipsky, B. A. Urinary tract infections in men. Epidemiology, pathophysiology, diagnosis, and treatment. Ann. Intern. Med. 110, 138–150 (1989).

  43. 43.

    Ginsburg, C. M. & McCracken, G. H. Jr. Urinary tract infections in young infants. Pediatrics 69, 409–412 (1982).

  44. 44.

    Edlin, R. S., Shapiro, D. J., Hersh, A. L. & Copp, H. L. Antibiotic resistance patterns of outpatient pediatric urinary tract infections. J. Urol. 190, 222–227 (2013).

  45. 45.

    Kahlmeter, G. & Menday, P. Cross-resistance and associated resistance in 2478 Escherichia coli isolates from the Pan-European ECO/textperiodcentered SENS Project surveying the antimicrobial susceptibility of pathogens from uncomplicated urinary tract infections. J. Antimicrob. Chemother. 52, 128–131 (2003).

  46. 46.

    Hanley, J. A. & McNeil, B. J. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology 143, 29–36 (1982).

  47. 47.

    Lieberman, T. D. et al. Parallel bacterial evolution within multiple patients identifies candidate pathogenicity genes. Nat. Genet. 43, 1275–1280 (2011).

  48. 48.

    Didelot, X., Bowden, R., Wilson, D. J., Peto, T. E. A. & Crook, D. W. Transforming clinical microbiology with bacterial genome sequencing. Nat. Rev. Genet. 13, 601–612 (2012).

  49. 49.

    Bradley, P. et al. Rapid antibiotic-resistance predictions from genome sequence data for Staphylococcus aureus and Mycobacterium tuberculosis. Nat. Commun. 6, 10063 (2015).

  50. 50.

    Khoury, M. J. & Ioannidis, J. P. A. Medicine. Big data meets public health. Science 346, 1054–1055 (2014).

  51. 51.

    Beam, A. L. & Kohane, I. S. Big data and machine learning in health care. JAMA 319, 1317–1318 (2018).

  52. 52.

    Grad, Y. H. & Lipsitch, M. Epidemiologic data and pathogen genome sequences: a powerful synergy for public health. Genome Biol. 15, 538 (2014).

  53. 53.

    Sandora, T. J., Gerner-Smidt, P. & McAdam, A. J. What’s your subtype? The epidemiologic utility of bacterial whole-genome sequencing. Clin. Chem. 60, 586–588 (2014).

Download references


We thank M. Datta, A. McAdam, G. Priebe and P. Ramesh for thorough reading of the manuscript and important comments. This work was supported in part by US National Institutes of Health grant no. R01 GM081617 (to R.K.) and European Research Council FP7 ERC grant no. 281891 (to R.K.) as well as The Ernest and Bonnie Beutler Research Program of Excellence in Genomic Medicine (to R.K.).

Author information

V.S. and R. Kishony perceived the study. I.Y., O.S., G.K., V.S. and R. Kishony designed the study. R. Katz, M.P., O.T. and V.S. retrieved and interpreted electronic health records. I.Y., O.S., G.N. and R. Kishony analyzed the data. I.Y., O.S., G.C., V.S. and R. Kishony interpreted the results. I.Y. and R. Kishony wrote the manuscript with comments from all authors.

Correspondence to Roy Kishony.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Peer review information: Michael Basson was the primary editor on this article and managed its editorial process and peer review in collaboration with the rest of the editorial team.

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data

Extended Data Fig. 1 Availability of resistance measurements over time.

For each of the six antibiotics, the fraction of urine samples for which resistance was measured, overall (black) and for each of the three most common species (colors), is plotted across the 10-year sampling period. Also indicated are the time ranges used for model training (green horizontal bars) and testing (red bars). Time periods during which measurements of resistance to cephalexin were scarce and were removed from analysis (gray bar).

Extended Data Fig. 2 Frequency of resistance over time.

Frequencies of resistance for each of the three common species (colored lines) and the overall sample (black lines) over the 10-year data set. Empty time intervals correspond to periods during which resistance was not frequently measured (matching the gray horizontal bar of Extended Data Fig. 1).

Extended Data Fig. 3 Frequency of resistance as a function of age for different demographic groups.

Frequency of resistance to each of the six antibiotics, in each of ten age bins (0,10,…,100 years). a, Frequencies of resistance for five non-overlapping demographic groups: men not residing in retirement homes (blue), men residing in retirement homes (dotted blue), women not pregnant and not residing in retirement homes (magenta), women in retirement homes (magenta dotted) and pregnant women (red). b, Comparing the overall frequency of resistance to the six drugs for women and men across age.

Extended Data Fig. 4 Odds ratios of resistance to each of the antibiotics for past purchases of different drugs across a range of purchase-to-sample time intervals: adjustments for demographics and cross-resistance.

a, Multivariate logistic regression models for the association of each antibiotic resistance with past purchases of the indicated drugs not accounting for cross-resistance (Methods: Logistic regression ‘Purchase history’. Same graphical scheme as in Fig. 4a,b). b, Logistic regression model as in a adjusted for cross-resistance (Methods: Logistic regression ‘Purchase history adjusted for cross-resistance’). c, Logistic regression model as in a adjusted for demographics (Methods: Logistic regression ‘Purchase history adjusted for demographics’. Gray asterisks indicate statistical significance and non-significant values, with Bonferroni corrected P > 0.05, are blanked.

Extended Data Fig. 5 Correlations among resistances to different antibiotics.

Correlation among resistance measurements for each pair of antibiotics across all samples for which both resistances were measured. Cephalexin and cefuroxime axetil, which have a particularly high correlation (marked with ‘x’), were treated as ‘analogous’ in the analysis of indirect effects of purchases on resistance (Methods: Logistic regression ‘Purchase history adjusted for cross-resistance’).

Extended Data Fig. 6 Model performance on test and training data.

AUC for receiver operator characteristic for prediction of resistance based on demographics, sample history and purchase history, individually and in a complete model combining all feature sets. Each feature set was modeled using LR, and the complete model was modeled by both LR and GBDT. To identify overfitting, model performance on the testing data set (gray) was contrasted with model performance on the training data set (black; Extended Data Fig. 1 for definition of training and test time periods). A low level of overfitting is seen for all drugs except trimethoprim, which showed no overfitting. See Supplementary Fig. 4 for feature importance in GBDT models.

Extended Data Fig. 7 The fraction of samples that can be treated by at least one drug given set thresholds on the single-drug resistance probability scores.

Given the complete-model-assigned probabilities of resistance \(P_k^m\) of each sample m to each antibiotic k, we calculated the fraction of samples, within the 1-year test period, that have at least one drug with resistance score below a threshold. a,b, This fraction is calculated assuming that the threshold used to determine resistance of single drugs is either: the same probability threshold Pthreshold for all drugs (counting all samples for which \(P_k^m < P^{\mathrm{threshold}}\) for at least one antibiotics k) (a) or the same rank threshold rthreshold for all drugs, counting all samples for which \(P_k^m < P_k^{\mathrm{threshold}}\left( {r^{\mathrm{threshold}}} \right)\) for at least one antibiotics k, where \(P_k^{\mathrm{threshold}}\left( {r^{\mathrm{threshold}}} \right)\) is the probability threshold of drug k that includes a fraction rthreshold of the samples (b).

Extended Data Fig. 8 Schematic diagram of machine-learning-trained prescription models.

A set of samples with features of demographics, sample resistance history and antibiotic purchase history labeled for resistance to each antibiotic k (‘train set’) is used to train an antibiotic resistance prediction model (Methods: Logistic regression, terms 1–9). The model is applied to an SDET set of cases from the test period to calculate the probabilities of resistance to each antibiotic. In an unconstrained model the antibiotic with minimal probability for resistance is suggested. The calculated probabilities of resistance together with the respective prescriptions of the SDET set of cases are used to add a ‘cost’ term. In a constrained drug prescription model, the antibiotic with the minimal cost-adjusted probability is suggested.

Extended Data Fig. 9 Robustness of machine-learning-trained prescription models across age and gender and with respect to the clinical definition of resistance.

a, Frequency of mismatched treatment across all SDET cases, comparing physician’s prescriptions (dark bar) to algorithmic recommendations by the constrained and unconstrained models (cyan and magenta hatched, respectively) for females (top) and males (bottom) separated into three major age groups. b, Frequency of mismatched treatment across all SDET cases (Methods), when classifying ‘Intermediate’ level of resistance as ‘resistant’. Comparing mismatch frequencies of physicians’ prescriptions (dark bar) to algorithmic recommendations (light bars), either unconstrained (magenta hatched) or constrained for recommending drugs at the same ratio as physicians (cyan hatched). Also presented are the null expectations for randomly prescribing drugs with equal probabilities (random ‘dice’, magenta dashed) or for random drug permutations (random permutations, cyan dashed).

Supplementary information

Supplementary Information

Supplementary Figs. 1–5 and Supplementary Tables 1–3

Reporting Summary

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Further reading