Testicular salvage: using machine learning algorithm to develop a predictive model in testicular torsion

To compare the models developed with a classical statistics method and a machine learning model to predict the possibility of orchiectomy using preoperative parameters in patients who were admitted with testicular torsion. Patients who underwent scrotal exploration due to testicular torsion between the years 2000 and 2020 were retrospectively reviewed. Demographic data, features of admission time, and other preoperative clinical findings were recorded. Cox Regression Analysis as a classical statistics method and Random Forest as a Machine Learning algorithm was used to create a prediction model. Among patients, 215 (71.6%) were performed orchidopexy and 85 (28.3%) were performed orchiectomy. The multivariate analysis revealed that monocyte count, symptom duration, and the number of previous Doppler ultrasonography were predictive of orchiectomy. Classical Cox regression analysis had an area under the curve (AUC) 0.937 with a sensitivity and specificity of 88 and 87%. The AUC for the Random Forest model was 0.95 with a sensitivity and specificity of 92 and 89%. The ML model outperformed the conventional statistical regression model in the prediction of orchiectomy. The ML methods are cheap, and their powers increase with increasing data input; we believe that their clinical use will increase over time.


Introduction
A great deal of data has been accumulated by the transfer of medical data to the electronic milieu [1,2]. Modern clinical practices take their origin from the interpretation of these data. The machine learning (ML) methods developed with the help of statistics, computer sciences, and artificial intelligence (AI), reveal the complicated relationships and patterns which could not be otherwise elucidated by the conventional statistical methods and lead to the creation of relatively better and more convenient predictive models.
Testicular torsion (TT) is one of the most frequently encountered urological emergencies, with an incidence of 1/4000 in male patients younger than 25 [3]. The atypical presentations of these cases can lead to a delay in diagnosis or can cause misdiagnosis. Consequently, these cases can result in organ loss, subfertility, or infertility [4]. It is known that testicular vitality is associated with the duration of symptoms in these patients, and preoperative determination of the testicular vitality can allow the clinicians to give their patients and family members more reliable information and also optimize their expectations regarding postoperative outcomes. Preoperative determination of testicular vitality can also prevent medicolegal issues.
In this study, we reviewed our patients who underwent orchiopexy or orchiectomy with the diagnosis of testicular torsion to develop a model for the prediction of testicular vitality. We used patients' preoperative data, conventional statistical methods, and ML methods for developing this novel model.

Patient cohort
After ethical review committee (2021-42/18.01.2021) approval, data of the patients aged between 1 and 18 who were diagnosed and surgically treated with TT diagnosis in the same hospital between January 2000 and December 2020 were retrospectively reviewed. All patients had presented to either the emergency department or urology outpatient clinic with symptoms such as scrotal pain, swelling, or erythema. Doppler ultrasonography (D-USG) was performed in cases with clinical suspicion. D-USG was not performed in cases where it is not technically appropriate, especially in the younger age group and small testes, where testicular blood flow is difficult to detect. D-USG was repeated in case of inconsistency of clinical findings, especially in patients referred from an external center with a pre-diagnosis of torsion. They all underwent orchiopexy or orchiectomy afterward. Patients with incomplete data, those with chronic respiratory, hematological, or vascular diseases which can potentially impair tissue oxygenation, and patients with hepatic or renal failure were excluded. Also, patients with autoimmune diseases, which can lead to changes in complete blood count (CBC) parameters, patients using non-steroidal anti-inflammatory medications or systemic steroids regularly, those with a history of radiotherapy or chemotherapy, and patients who have an acute viral or bacterial infection were omitted. Patients who were younger than one were excluded for the exclusion of the neonatal testicular torsion cases. Patients with a previously diagnosed scrotal or testicular disorder, those with bilateral testicular torsion, those who underwent manual detorsion, who were not diagnosed with TT during surgical exploration, and patients diagnosed with the torsion of appendix testis were also excluded to create a homogenous study population. In addition, cases with testicular atrophy in the first 6 months were excluded from the study to obtain homogeneous groups, considering that they may be affected due to deficiencies in perioperative evaluation or the surgeon's preference willing for testicular salvage.

Data collection
Twenty-six data parameters, including demographic features, symptomatology during the presentation, and data obtained by preoperative imaging and laboratory tests, were retrieved from patient folders. Type (i.e., direct presentation to our center or referral to our center), location (emergency department or urology outpatient clinic), and time (working time or out of hours, day, month, and season) of the presentation were also noted. The time from the onset of symptoms to the surgery performed was considered as "symptom duration". Working time presentation was defined as presentation between 8 am and 5 pm during weekdays (i.e., Monday to Friday). Parameters including neutrophil-lymphocyte ratio, thrombocyte-lymphocyte ratio, and monocyte-lymphocyte ratio (MLR) were calculated based on the preoperative CBC result. Data obtained from D-USG, TT grade and type of surgery were also recorded.
All surgeries were performed by general or spinal anesthesia in the supine position. Immediately after surgical detorsion, a warm damp gauze was placed onto the testis, and the testis was kept warm for 15-20 min. In case of testicular reperfusion or seeing fresh bleeding from the incision surface, fixation with nonabsorbable sutures (except silk) was performed. The testis was placed into the scrotum once it was ensured that it was well-perfused. Subsequently, it was fixated by non-absorbable sutures (except silk) (i.e., orchiopexy). Orchiectomy was performed in the case of a black, necrotic, or non-perfused testis. The contralateral testis was routinely fixated. No drains were used. Prophylactic antibiotherapy was given in all cases.
Patients were divided into two groups based on the type of surgery (i.e., orchiopexy or orchiectomy). Patients who underwent surgical detorsion and orchiopexy were assigned to Group 1, and those who underwent orchiectomy were assigned to Group 2.

Statistical methods
Numbers and percentages were used for categorical data. For continuous variables, means and standard deviations were calculated. Kolmogorov-Smirnov tests were used to test the normal distribution. Means of two normally distributed groups were compared using Student's t test. To compare the means between non-normally distributed groups, the Mann-Whitney U test was used. Pearson chi-square and Fisher's exact tests were used to compare the frequency of categorical variables. The p values of less than 0.05 were regarded as statistically significant. To identify the predictive factors of orchiectomy and develop a novel predictive model, univariable and multivariable binary logistic regression analyses were used. To measure the model's predictive power, The Receiver Operating Curve (ROC) analysis was performed. Statistical analysis was performed using Statistical Package of Social Sciences version 21 (IBM SPSS Statistics; IBM Corp., Armonk, NY).

Machine learning model
Python 3.6.1 programming language and Scikit-Learn 0.23.2 were used to create a machine learning model. Decision trees were used as a learning algorithm in Random Forest models. Multiple decision trees with different parameters give a prediction, and the final prediction is based on those classifiers. The dataset was split into two parts: the development set (n = 256) and the test set (n = 44). Ten-fold cross-validation was applied. The accuracy of the model's probability output was evaluated in the cross-validation and the average of outputs to obtain a final output was calculated.

Patient characteristics
After the application of the inclusion and exclusion criteria, 300 patients were included in this study. Among these patients, 215 (71.6%) underwent orchiopexy (Group 1) and 85 (28.3%) underwent orchiectomy (Group 2). The mean patient age of the entire cohort was 11.9 ± 4.1 years; there was no significant difference between the two groups regarding patient age. Two groups were similar concerning body mass index, chief complaint, side of torsion, presentation time (including day, month, and season), and D-USG findings. The rate of orchiopexy was significantly higher in patients presenting to the emergency department during nighttime. The rate of orchiectomy was significantly higher in patients who were referred from another center. The white blood cell (WBC) and monocyte counts (MC) were significantly higher in the orchiectomy group (i.e., Group 2) than in the orchiopexy group (i.e., Group 1). Duration of symptoms, the rate of performance of multiple D-USG imaging, and torsion grade were significantly higher in Group 2 than in Group 1. Demographic data, clinical features at presentation, laboratory, and imaging data are displayed in Table 1.
In the pathological examination of orchiectomy materials, testicular and epididymal tissues including hemorrhagic infarct findings were detected in all patients. Neoplasia was not found in any patient.

Univariate and multivariate analysis
The multivariate analysis revealed that MC, symptom duration, and performance of multiple D-USGs were predictive of orchiectomy (Table 2). Classical Cox regression analysis revealed an area under the curve (AUC) of 0,937 with a sensitivity and specificity of 88 and 87%, respectively (Table 3 and Fig. 1).

Machine learning models
Random Forest was used for predicting orchiectomy. The predictive power of the model is displayed in Table 3. The accuracy prediction score of Random Forest was 0.9, and the AUC for the receiver-operating characteristic (ROC) curves was 0.95 (Fig. 2). The sensitivity and specificity of the created model were 92 and 89%, respectively. The model outperformed the conventional statistical regression model in the prediction of orchiectomy.

Discussion
It is widely accepted that AI and its subbranch ML help the researchers retrieve relatively more valuable information from the accumulated electronic medical data, and shape future medical practices [5]. The values of AI and ML are amplified by the increasing amount of stored medical data and they can expose relatively more complicated interparameter relationships than those revealed by conventional statistical methods [6,7]. Therefore, powerful predictive models can be created by using these tools.
The ML methods, which have been frequently used in all medical specialties, including urology, are utilized for the prediction of outcomes in the treatment of urinary tract stone disease, determination of the tumor subtype and Fuhrman grade in patients with renal cell carcinoma, and prediction of post-treatment disease recurrence and complications in patients with bladder cancer [2,5]. Also, models were created to assess and predict surgical treatment success, and functional and oncological outcomes in patients with prostate cancer [2,5].
In the cases of TT, the rate of orchiectomy is 32% [8]. In patients with TT, accurate preoperative planning is essential since complications such as infection and anti-sperm antibody-mediated infertility can be prevented by orchiectomy in the case of a non-viable necrotic testis [9]. Previously published literature showed that testicular vitality is significantly associated with the duration of symptoms and torsion grade [10,11]. Although it was stated that testicular vitality could be protected in 90-100% of TT cases provided that the surgical intervention was performed within the first 6 h, this rate decreased to 50% in cases that were surgically explored after the 12th hour [12].
On the other hand, it is known that all TT cases explored after the 12th hour do not necessitate orchiectomy, and in 44% of the cases surgically treated during the first 6-h period, testicular volume loss could occur [9]. Jang et al. stated that NLR was significantly associated with testicular vitality in addition to the duration of symptoms and torsion grade [13]. In a study conducted by Benlioglu et al., MC was found to be significantly higher in the TT and epididymoorchitis groups compared to the healthy control groups [14]. The sensitivity of the MC for TT was 84.4% and the specificity was 42.7% [14]. In the subgroup analysis of TT, it was found that the MC among the patients who underwent orchiopexy and orchiectomy was significantly higher in the orchiectomy group [14]. In a study conducted by Bedel et. al., similar to monocyte functions, MLR ratios were found to have 67.1% sensitivity and 75% specificity for TT prediction compared to the control group [15]. In this study, we also found a significant number of monocytes in the group that underwent orchiectomy. In addition, we found that MC predicted orchiectomy in multivariate analyzes. This relationship was not demonstrated for MLR. The functions of monocytes in the immune system are cytokine expression, antigen presentation, and phagocytosis. It has been shown that abnormally activated monocytes may play a role in the pathogenesis of inflammation [16]. Considering that intact, unharmed testicular tissues are naturally protected from the immunological system, we believe that histological and physiological changes in torsioned and damaged testicular tissues may cause monocyte reaction. Zheng et al. reported that duration of symptoms and D-USG findings could predict testicular vitality [17]. In this study, we determined that duration of symptoms, monocyte count, and performance of multiple D-USGs were significantly associated with testicular vitality, and thus they were predictive of orchiectomy. Multiple D-USGs, which are applied in a situation such as inconsistency of clinical and radiological findings, especially for patients referred from an external center, technical inadequacies in ultrasonography performed in emergency conditions, indirectly prolong the time to surgery and increase the possibility of orchiectomy. In such patients, we believe that the adequacy of the equipment to be used especially in night shifts, and the clinicians with sufficient clinical experience in this regard are of vital importance to preserve testicular vitality.
Although we also found that torsion grade was associated with testicular vitality, we did not include this parameter in our predictive model since we mainly focused on preoperative parameters. While the sensitivity and specificity of the model created by conventional statistical methods were 88 and 87%, the sensitivity and specificity of the model created by ML were 92 and 89%, respectively. Considering the impact of orchiectomy on testicular function, the psychosocial effects of organ loss, risk of infertility, and potential medicolegal issues in TT cases, models for predicting testicular vitality such as ours are essential for surgical planning, consenting patients, and families, and optimization of postoperative expectations [9,18,19].
Since ML methods are inexpensive and their power can be amplified by the increasing amount of electronic medical data, we postulate that the popularity of these methods will increase, and they will be part of routine clinical practice in the near future.
Although our study has some strengths, such as concrete inclusion and exclusion criteria, its retrospective design and absence of the acute phase reactant levels in the database can be considered weaknesses. The decision for orchidopexy versus orchiectomy appears to be surgeon-dependent and this creates an additional limitation. To obtain a homogeneous group, the exclusion of patients with atrophy in the first 6 months from the study and not specifying the atrophy rates is another limitation of our study. Additionally, having more than one Doppler-USG as a bad prognostic factor is probably due to visiting more than one center (losing time before  surgery) which could be associated with a lack of medical devices or trained personnel at nightshifts. There is a need for further evaluation. In addition, there are increasing concerns regarding fixation, particularly with non-absorbable sutures such as silk. Since our study covers a very long period, we prefer absorbable sutures in our current clinical practice instead of the non-absorbable sutures we used in the past.

Conclusion
The creation of reliable models for predicting testicular vitality in cases with TT is essential for accurate surgical planning, patient consenting, optimization of postoperative expectations, and prevention of medicolegal issues. The ML methods can lead to the creation of relatively more reliable models than those made by using conventional statistical methods with the help of increasing predictive power by increasing the amount of accumulated electronic medical data.
Author contributions The authors confirm contributions to the paper as follows: study conception and design: ME, AHY, AİT, data collection: AA, KB, İE, analysis and interpretation of results: FA, AA, draft manuscript preparation: AEF, SŞ. All authors reviewed the results and approved the final version of the manuscript. Funding: No funding was received for conducting this study.

Conflict of interest
The authors confirm that there are no relevant financial or non-financial competing interests to report.
Ethical approval Ethics committee approval was received for this study from the ethics committee of Health Science University, Bakırköy Dr. Sadi Konuk Training and Research Hospital.
Experimental-informed consent Written informed consent was obtained from patients who participated in this study.