Abstract
This research presents our application of artificial intelligence (AI) in predicting urolithiasis risk. Previous applications, including AI for stone disease, have focused on stone composition and aiding diagnostic imaging. AI applications centered around patient-specific characteristics, lifestyle considerations, and diet have been limited. Our study comprised a robust sample size of 976 Chilean participants, with meticulously analyzed demographic, lifestyle, and health data through a comprehensive questionnaire. We developed a predictive model using various classifiers, including logistic regression, decision trees, random forests, and extra trees, reaching high accuracy (88%) in identifying individuals at risk of kidney stone formation. Key protective factors highlighted by the algorithm include the pivotal role of hydration, physical activity, and dietary patterns that played a crucial role, emphasizing the protective nature of higher fruit and vegetable intake, balanced dairy consumption, and the nuanced impact of specific protein sources on kidney stone risk. In contrast, identified risk factors encompassed gender disparities with males found to be 2.31 times more likely to develop kidney stones than females. Thirst and self-perceived dark urine color emerged as strong predictors, with a significant increase in the likelihood of stone formation. The development of predictive tools with AI, in urolithiasis management signifies a paradigm shift toward more precise and personalized health care. The algorithm’s ability to process extensive datasets, including dietary habits, heralds a new era of data-driven medical practice. This research underscores the transformative impact of AI in medical diagnostics and prevention, paving the way for a future where health care interventions are not only more effective but also tailored to individual patient needs. In this case, AI is an important tool that can help patients stay healthy, prevent diseases, and make informed decisions about their overall well-being.
Introduction
Artificial intelligence (AI) represents the computer’s capacity to replicate and execute cognitive functions akin to those of humans. AI technologies depend on vast amounts of data to execute their function. Over the last 20 years there has been a steep increase in the utilization of AI technologies for the benefit of aiding diagnosis, treatment, and understanding of a variety of urological disorders. 1 Specifically, there has been an increasing interest in harnessing AI technologies that can aid in the diagnosis, procedural outcome predictions, as well as passage and recurrence rates in kidney stone disease (KSD). 1 AI has been employed in KSD to streamline the interpretation of radiological imaging, including computer tomography (CT) and ultrasound scans. It has also been utilized for predicting management outcomes and expediting the analysis of stone compositions. 2 Given the relatively high global prevalence of nephrolithiasis in the general population (∼12%), 3 this is an area that can greatly benefit from technologies that can expedite and improve the accuracy of diagnoses, outcomes, and even predictions.
AI has been mostly applied toward aiding stone composition analyses given that this aspect of KSD care is recognized as paramount in guiding the right treatment. 4 Improving the accuracy of stone composition analyses has been driven by prior studies highlighting the underpowered nature of a significant portion of clinical laboratories in precisely characterizing stone composition. 5 Several studies have emerged, consistently highlighting the proficiency of AI models in accurately identifying stone composition, achieving over 90% accuracy, particularly when utilizing imaging data, especially from CT. 6 –8 To a lesser degree, research has explored the application of AI in KSD risk and examining its associations with lifestyle factors. Within this realm, previous studies have developed machine learning algorithms for predicting kidney stone formation using both genetic polymorphisms and a limited number of lifestyle factors achieving an accuracy rate between 74–89%. 9 Diverging from prevailing AI diagnostic tools that predominantly concentrate on singular risk factors, such as laboratory values or the exploration of recurrence risk, 10,11 our research project delved into an overlooked dimension of KSD. Specifically, we dedicated our focus to developing a specialized AI model designed to forecast the probability of an individual patient developing KSD by leveraging insights from patient-specific factors. Consequently, our study successfully crafted an AI model capable of predicting an individual’s susceptibility to KSD. To the best of our knowledge, this investigation stands as the pioneering comprehensive AI model assessing KSD risk through the integration of patient demographics, lifestyle factors, laboratory values, and comorbidities.
Methods
Questionnaire design and data collection
Incorporating the latest scholarly research, a comprehensive questionnaire was collaboratively created by Chilean urologists specializing in endourology with over a decade of experience, nephrologists dedicated to urinary lithiasis treatment, and nutritionists proficient in the dietary management of renal calculi. Besides, the survey was reviewed by specialists in other areas, as endocrinologists; general practitioners and urologists; methodology and programming specialists to review the execution of the questions, answers, and survey design. The questionnaire included inquiries about demographics, nutrition, sports, medical and family history, along with recent urine analyses (Supplementary Appendix A).
The pilot test was conducted with a mix of participants (n = 100), including both stone formers and healthy volunteers from two health care facilities in Chile, encompassing both a public and a private center. The primary objective was to assess the survey’s comprehensibility and the participants’ ease in completing it.
The variables for the study were carefully selected through a combined approach. While expert opinion shaped the initial framework of variables, we also incorporated variables that have been robustly identified by published literature as significant contributors to kidney stone risk. The synergy of these two sources aimed to create a comprehensive and evidence-based survey instrument. Besides the data collection, patients were questioned about the usability of the survey.
Subsequently, it was widely disseminated through social media (Instagram, Facebook, LinkedIn, and WhatsApp) by QR codes shared with urologist from different clinical centers, patients suffering from calculi, their families and people who were not related with them.
The survey, in original language, will be provided in supplementary information. Participation was anonymous and unpaid. This proactive distribution within a selected Chilean cohort yielded 976 complete responses for further analytical processing.
Inclusion and exclusion criteria and KSD definition
Survey participation had relatively flexible inclusion criteria, requiring participants to be at least 18 years old and capable of completing the survey comprehensively. To maintain the integrity and relevance of the study results, exclusion criteria were defined. Individuals with severe mental or physical conditions impeding smartphone usage and those unable to provide informed consent due to illiteracy were excluded.
A crucial aspect of the machine learning (ML) model involves providing an adequate number of positive cases, specifically patients diagnosed with KSD. This enables the model to learn and identify the risk in new patients with an unknown status. Consequently, defining stringent criteria was imperative to categorize individuals completing the survey as having KSD. These criteria encompassed that a specialist had reported to the patient the presence of a kidney stone by a recent computed tomography (CT) scan or undergoing a surgical procedure for kidney stone removal within 10 days preceding the questionnaire completion. 12,13
Machine learning model development
The study saw the creation of a supervised ML model. This model was constructed with a variety of classifiers, such as logistic regression, decision trees, random forests, and extra trees classifiers, and programmed using the Python language in a local computing environment.
Pattern recognition and classification
The ML model was designed to detect complex patterns distinguishing patients with kidney stones from those without. This pattern recognition phase was crucial for identifying key predictive factors. Subsequently, the model entered a classification phase, wherein it assigned probabilities of kidney stone formation to individuals in the cohort blindly. The model’s precision in classification was verified against an independent dataset.
Statistical analysis and model interpretability
Statistical methods were employed to enhance the interpretability of the model. Odds ratios were calculated to measure the influence of each predictor, while confidence intervals and p-values were used to determine the statistical significance of these predictors. The model was selected based on superior performance metrics against existing models on training and validation datasets.
Model deployment and feature influence analysis
Upon completion of training, the model incorporated a balancing feature for the target variable to address potential imbalances in the dataset. The predictive model, employing a suite of machine learning classifiers, has been refined to include a specific set of variables identified as significant predictors of kidney stone disease. The retained variables comprise gender, physical activity, thirst, self-perceived urine color, age, dietary factors, fluid intake, and family history of calculi. These were selected based on statistical significance and their contributions to model efficacy. The final model, demonstrating improved accuracy over previous models, was prepared for clinical deployment.
Results
Participants
We analyzed responses from 976 Chilean participants who received the survey from their medical doctors and through social media.
Of the surveyed cohort, 14% (137 patients) were identified as having kidney stones at the time of the questionnaire. The demographic breakdown revealed a median age of 43 years in the nonkidney stone group and 46 years in the kidney stone group, with the difference being statistically significant (p = 0.027) (Table 1). The sample was predominantly Hispanic (75%) (Table 1), with a male representation of 53%. No differences were observed in the sex distribution of participants between and within the groups (Table 1 and Supplementary Table S1).
Demographic, Lifestyle, and Clinical Characteristics among Individuals with and without Kidney Stone Disease
Welch Two Sample t-test; Fisher’s exact test; Fisher’s Exact Test for Count Data with simulated p-value (based on 2000 replicates) IQR= Interquartile range.
Risk habits in KSD patients
The survey included question about food and water consumption, habits previously related with KSD risk, besides the medical history of the participants that was related with calculi. When analyzed, several of them were altered between groups (Supplementary Tables S2, S3 and S4). First, a marked disparity was observed in hydration habits. Individuals with KSD reported a high incidence of thirst during their usual day (66%, p = 0.003), and 63% of this group also reported abstaining from fluid intake for periods exceeding 4 hours (p = 0.6), although the latter did not present a statistically significant difference (Table 1). This was related with the color of the urine reported by the participants, where 63% of KSD-affected participants reported burnt orange-colored urine, contrasting with 11.5% reporting pale yellow straw urine, a distinction yielding high statistical significance (p < 0.001). Fluid consumption patterns further differentiated the groups. About 22% of KSD-afflicted individuals consumed less than 500 mL of water per day, and 39% limited their intake to approximately 1 liter daily (Table 1).
Dietary habits showed that 62.5% of the KSD group did not consume fruits or did so up to three times per week, and a similar pattern was observed with vegetable intake, with 34.6% abstaining from or minimally consuming vegetables (Table 1).
Physical inactivity was identified as a prevalent factor in the KSD group, where 47% did not engage in any form of exercise, compared with 36% in the non-KSD group (Table 1).
Kidney stone predictors
From the habits related with KSD, we analyzed how they contribute with the risk of having kidney stones. Notably, an increase in physical activity frequency corresponded with a decrease in kidney stone risk, quantified by a risk reduction factor of 0.760 (95% confidence interval (CI) [0.58, 0.99], p = 0.042).
Gender also emerged as a significant risk predictor. Male participants were found to be 2.31 times more likely to develop kidney stones than females (95% CI [1.36, 3.91], p < 0.001).
Thirst and self-perceived urine color were also strong predictors, with a 1.77-fold increase in the likelihood of stone formation associated with self-reported thirst (95% CI [1.16, 2.70], p = 0.008), and a 1.34-fold increase with each gradation toward more concentrated urine color (95% CI [1.15, 1.56], p = 0.002). The regression coefficient of these variables was included in Supplementary Table S5.
Model
A supervised Machine Learning (ML) model was developed using the Python Software Foundation to assess the performance of various models in predicting the occurrence of kidney stones. Logistic regression, decision tree classifier, random forest classifier, and extra trees classifier were evaluated to determine the importance of each variable in the prediction process. An algorithmic success rate of 88% was achieved across four distinct machine learning models.
The predictive model, employing a suite of ML classifiers, has been refined to include a specific set of variables identified as significant predictors of KSD. The retained variables comprise gender, physical activity, thirst, self-perceived urine color, age, dietary factors, fluid intake, and family history. These were selected based on statistical significance and their contributions to model efficacy.
In pursuit of ensuring the external validity of our predictive model, we employed an independent dataset comprising 731 patient records obtained from a hospital in Chile, representing a collection period spanning the last four years. This dataset reflects the demographic and clinical variability necessary for a rigorous external validation, and it includes a proportional representation of individuals diagnosed with KSD, as well as those without the condition.
The performance of two predictive models for KSD was evaluated through receiver operating characteristic (ROC) curve analysis. The model designated as “IA Model” yielded an area under the curve (AUC) of 0.94, whereas the “Alternative Model” recorded an AUC of 0.67 (Fig. 1). These results illustrate the discriminative capabilities of each model in the context of identifying the presence of KDS. The ROC curves provide a quantitative basis for comparing the effectiveness of these predictive tools.

Receiver Operating Characteristic (ROC) curves for two predictive models of kidney stone disease.
Discussion
Analyzing the importance of hydration in preventing kidney stone disease (KSD)
Our study emphasizes the crucial role of hydration in preventing KSD, aligning with the general field consensus. Hydration-related factors identified by our AI model, such as low water intake and urine color, are significant predictors of KSD. This is supported by the findings of a systematic review by Gamage and colleagues, 14 which indicated that increased fluid intake correlates with decreased stone formation. They also highlight the importance of the type of fluid, noting that certain juices can reduce calcium oxalate saturation in urine, thus lowering stone risk, a detailed aspect our model could integrate into its predictive algorithms. The same review recommends a urine output of 2 to 2.5 liters per day to prevent stone formation, 14,15 aligning with our model’s emphasis on adequate hydration. Interestingly, caffeinated beverages may decrease the risk of KSD, while sugary drinks have the opposite effect due to high fructose levels. 14 These insights complement our findings and suggest potential areas for further refinement of our AI model, which could be trained to consider the types of fluids consumed as variables in risk assessment. Demographic-specific incidence rates, with higher prevalence in hotter climates due to dehydration, align with our study’s findings, highlighting the importance of environmental and lifestyle factors in KSD risk. 16
Physical activity and their clinical implications
Ferraro et al. analyzed data from 215,133 participants over up to 20 years, resulting in 5,355 cases of kidney stones. 17 Initial age-adjusted analyses suggested that higher levels of physical activity were associated with a lower risk of incident kidney stones in women but not in men. However, after multivariate analysis, there was no significant association between physical activity and kidney stone risk. 17 Conversely, our study indicated that an increase in physical activity frequency corresponded with a decrease in kidney stone risk (risk reduction factor of 0.760). These findings suggest a more definitive protective role of physical activity against kidney stone formation. This discrepancy could be due to differences in the populations studied, the covariates adjusted for in the analyses, or other unknown factors.
Dietary patterns
Our examination of dietary patterns in kidney stone formation reveals significant disparities, particularly in the consumption of fruits, vegetables, dairy, and protein. However, we were unable to establish their protective or risk effect. This observation is noteworthy when compared with the findings of Ferraro et al. 18 In our study, we noted a markedly lower frequency of fruit and vegetable intake among kidney stone patients. Specifically, 62.5% of individuals with kidney stones consumed fruits less than three times weekly, and 34.6% had a similar consumption pattern for vegetables. This finding is critical, as Ferraro et al. underscore the protective role of these foods. 18 Their alkalinizing properties and citrate content are essential in reducing the risk of stone formation, as they help to decrease urinary supersaturation of lithogenic substances. 13
Additionally, our analysis revealed a reduced frequency of dairy intake in the kidney stone group, with 44% consuming dairy products only 1 to 3 times per week. This is particularly significant given the emphasis by Ferraro et al. on the importance of a balanced intake of low-fat dairy products. 18 The calcium in dairy plays a pivotal role in kidney stone prevention by potentially reducing oxalate absorption, which is a key component in many types of stones. 18
Our findings show a lower fish intake (37% never consumed) in the kidney stone group, aligning with Lin et al.’s work on the detrimental effects of high nondairy animal protein intake on kidney stones. 19 However, Lin et al. found no significant link between fish consumption and stone risk, emphasizing the pivotal role of protein type in kidney stone prevention. 19
Moreover, our study identified significant variances in alcohol consumption, particularly distilled spirits and wine, between individuals with and without kidney stones. However, the impact of alcohol on kidney stone risk is not extensively addressed in the literature indicating a potential avenue for further research. 20
Future perspectives and health care impact
The integration of AI as an auxiliary tool in patient evaluation within urolithiasis management marks a pivotal shift toward more precise and enhanced health care. Our study’s utilization of advanced AI models, trained on extensive datasets, including dietary habits, genetic predispositions, and medical histories, achieved an 88% success rate in predicting urolithiasis risk. This precision indicates a significant improvement in identifying individuals at risk, with the AI’s ability to process large-scale data allowing for highly individualized risk assessments. For example, our study found males to be over twice as likely to develop kidney stones as females, and specific hydration habits were closely linked to stone formation. By enabling the early detection of disease and facilitating the development of tailored preventive strategies, AI’s role in health care suggests a future where medical interventions are not only more effective but also more resource-efficient, heralding a new era of patient-centric and data-driven medical practice. 21
AI’s future implications in our research are promising, with potential impacts on patient well-being and health care economics. By enhancing urolithiasis management through personalized treatment plans, AI may reduce kidney stone recurrence, improving patients’ quality of life. Economically, accurate risk prediction could lead to substantial cost savings for patients and insurers, enhancing health care accessibility and affordability.
AI fosters social collaboration, pooling expertise across health professionals for integrated services, improving care quality and enabling cost-effective prevention. This could enhance the public health system, reducing hospital readmissions and overall health care costs.
Environmentally, the adoption of AI and digital health tools holds the potential to contribute to the reduction in article and physical resource usage, aligning with sustainable practices and supporting the conservation of environmental resources. Additionally, by leveraging AI to minimize the necessity for in-person consultations, there is a possibility of reducing carbon emissions. 22
Our study benefits from widespread survey distribution, encompassing diverse sources, such as internet platforms, email, and social media. This extensive outreach enhances the representativeness of our dataset, providing a nuanced understanding of factors influencing kidney stone formation. However, as a survey-based study, reliance on self-reported data introduces challenges in verifying accuracy, necessitating cautious interpretation due to potential recall bias.
A potential selection bias toward individuals with kidney stones or those with a vested interest in urological conditions may impact generalizability. Yet, this bias contributes to the robustness of our ML algorithm, enhancing its accuracy in identifying at-risk individuals. While our study showcases AI’s potential in predicting urolithiasis risk, ongoing concerns about AI’s safety and ethical implications in clinical practice highlight the need for careful consideration as this technology evolves. 23
Finally, by developing this auto-report/anonymous survey, we are arising the need of self-monitoring and self-perception of the risk of developing KSD in patients. This survey leaded to the development of a risk model that help patients to become more aware of their health status and associated risks. This way, patients with previous KSD episodes can make informed decisions about their lifestyle and health habits that may influence their well-being.
Conclusion
Our study showcases the potential of AI in predicting urolithiasis, achieving an 88% accuracy across machine learning models. This AI model identified crucial risk factors for kidney stones, such as hydration levels and exercise, and highlighted the value of personalized health care strategies, mainly related with water consumption and food intake. With AI’s predictive capabilities, we can foresee improvements in clinical outcomes, health care efficiency, and patient lifestyle adjustments. The broader impacts of AI include cost reduction in health care and advancements in public health strategies, underscoring its transformative role in the future of medical diagnostics and prevention.
Footnotes
Acknowledgments
The authors wish to note that preliminary results of this research were previously presented at the 40th World Congress of Endourology, held on october, 2023. The authors thank engineer Felipe Kramarenko from Gty SpA solutions who helped them in the development of the machine learning algorithms.
Authors’ Contributions
J.F.: Conceptualization, methodology, validation, formal analysis, investigation, resources, writing—original draft, writing— review and editing, visualization, supervision, project administration, and funding acquisition. C.S.: Conceptualization, methodology, investigation, resources, writing—original draft, writing—review and editing, visualization, and supervision. J.S.A.: Formal analysis, investigation, data curation, writing—original draft, writing—review and editing, and visualization. C.C., B.G.: Formal analysis, investigation, writing—original draft, writing—review and editing, and visualization. F.L., M.A.P.: methodology, validation, writing—original draft, writing—review and editing.
Author Disclosure Statement
No competing financial interests exist.
Funding Information
Supplementary Materials
Supplementary Appendix A
Supplementary Table S1
Supplementary Table S2
Supplementary Table S3
Supplementary Table S4
Supplementary Table S5
Abbreviations Used
References
Supplementary Material
Please find the following supplemental material available below.
For Open Access articles published under a Creative Commons License, all supplemental material carries the same license as the article it is associated with.
For non-Open Access articles published, all supplemental material carries a non-exclusive license, and permission requests for re-use of supplemental material or any part of supplemental material shall be sent directly to the copyright owner as specified in the copyright notice associated with the article.
