Machine Learning-Assisted Analysis Of Pain Reduction: Evaluating Pre-Operative Oral Metronidazole In Patients Undergoing Open Hemorrhoidectomy
DOI:
https://doi.org/10.52783/jns.v14.2715Keywords:
Postoperative Pain, Hemorrhoidectomy, Machine Learning, Pain Prediction, MetronidazoleAbstract
Background: The management of postoperative pain in hemorrhoidectomy patients represents a major clinical challenge because preoperative oral metronidazole shows inconsistent treatment results. Subjective pain assessment tools used in traditional methods result in inconsistent treatment results because they depend on patient-reported measurements. Machine learning models facilitate data-based assessment of pain within clinical settings which enables better pain management decisions thus helping patients to recover effectively.
Objective: The research will evaluate the effectiveness of oral metronidazole given before surgery for pain reduction while building a predictive model with machine learning to determine significant pain score predictors at the 24-hour postoperative period.
Methods: The researchers performed a retrospective observational study that analyzed clinical data from hemorrhoidectomy patients. The data collection included patient age and BMI along with surgical details about operative time and removed hemorrhoids and pain scores measured at 2h, 6h, 12h, 24h along with medication usage records. The analysis included exploratory data examination and feature importance evaluation to determine significant factors affecting postoperative pain. An evaluation using Gradient Boosting together with Random Forest and Linear Regression and XGBoost occurred within an 80:20 train-test split configuration to assess model performance. The model evaluation used Mean Absolute Error (MAE) alongside Mean Squared Error (MSE) and R² score for assessment.
Results: The Random Forest model proved to be the most effective algorithm due to its R² score of 0.78 and its minimal MAE (0.63) and MSE (0.87), indicating excellent predictive reliability. The analysis of feature importance showed medication administration (MED) stood as the main predictor variable and BMI and early postoperative pain levels at 12 hours ranked as secondary predictors. Early pain control interventions become essential due to the strong relationship found between pain scores obtained at 12 hours and 24 hours. Research findings indicate that patients with elevated BMI values together with increased 12-hour postoperative pain scores develop prolonged pain symptoms thus requiring individualized pain management approaches.
Conclusion: Both the effectiveness of preoperative oral metronidazole in pain reduction together with the superior performance of machine learning models to predict pain trajectory outcomes are validated through this research. AI-driven predictive models launched into clinical decision systems create precise pain management through real-time identification of risks and customized analgesic treatment approaches.
Additional research should employ multiple health care facilities with real-time patient tracking systems to confirm and enhance pain management methods.
Downloads
Metrics
References
Carapeti, E. A., Kamm, M. A., McDonald, P. J., & Phillips, R. K. (1998). Double-blind randomised controlled trial of effect of metronidazole on pain after day-case haemorrhoidectomy. The Lancet, 351(9097), 169-172.
Davoudi, A., Malhotra, K. R., Shickel, B., Siegel, S., Williams, S., Ruppert, M., ... & Rashidi, P. (2019). Intelligent ICU for autonomous patient monitoring using pervasive sensing and deep learning. Scientific reports, 9(1), 8020.
Gallo, G., Mistrangelo, M., Passera, R., Testa, V., Pozzo, M., Perinotti, R., ... & Trompetto, M. (2018). Efficacy of mesoglycan in pain control after excisional hemorrhoidectomy: a pilot comparative prospective multicenter study. Gastroenterology Research and Practice, 2018(1), 6423895.
Langford, D. J., Reichel, J. F., Zhong, H., Basseri, B. H., Koch, M. P., Kolady, R., ... & Wu, C. L. (2025). Machine learning research methods to predict postoperative pain and opioid use: a narrative review. Regional Anesthesia & Pain Medicine, 50(2), 102-109.
Lohsiriwat, V. (2012). Hemorrhoids: from basic pathophysiology to clinical management. World journal of gastroenterology: WJG, 18(17), 2009.
Mounsey, A. L., Halladay, J., & Sadiq, T. S. (2011). Hemorrhoids. American family physician, 84(2), 204-210.
Wanis, K. N., Emmerton-Coughlin, H. M., Coughlin, S., Foley, N., & Vinden, C. (2017). Systemic metronidazole may not reduce posthemorrhoidectomy pain: a meta-analysis of randomized controlled trials. Diseases of the Colon & Rectum, 60(4), 446-455.
Salekin, M. S., Zamzmi, G., Goldgof, D., Kasturi, R., Ho, T., & Sun, Y. (2020, November). First investigation into the use of deep learning for continuous assessment of neonatal postoperative pain. In 2020 15th IEEE International Conference on Automatic Face and Gesture Recognition (FG 2020) (pp. 415-419). IEEE.
Dong, H., Chen, W. X., Li, Y. J., & Wang, D. C. (2025). Efficacy of metronidazole in reducing pain after hemorrhoidectomy: a meta-analysis of randomized controlled trials. BMC Surgery, 25(1), 1-14.
Lin, Z., Li, S., Zhou, Y., Lu, X., Yang, B., Yu, Z., ... & Sun, J. (2023). A comparative study of esketamine-dexmedetomidine and sufentanil-dexmedetomidine for sedation and analgesia in lung tumor percutaneous radiofrequency ablation (PRFA): a randomized double-blind clinical trial. BMC anesthesiology, 23(1), 304.
Mongelli, F., Treglia, G., La Regina, D., Di Giuseppe, M., Galafassi, J., Majno-Hurst, P. E., & Christoforidis, D. (2021). Pudendal nerve block in hemorrhoid surgery: a systematic review and meta-analysis. Diseases of the Colon & Rectum, 64(5), 617-631.
Ganio, E., Altomare, D. F., Gabrielli, F., Milito, G., & Canuti, S. (2001). Prospective randomized multicentre trial comparing stapled with open haemorrhoidectomy. British Journal of Surgery, 88(5), 669-674.
Pescatori, M., & Gagliardi, G. (2008). Postoperative complications after procedure for prolapsed hemorrhoids (PPH) and stapled transanal rectal resection (STARR) procedures. Techniques in coloproctology, 12(1), 7-19.
Werner, P., Lopez-Martinez, D., Walter, S., Al-Hamadi, A., Gruss, S., & Picard, R. W. (2019). Automatic recognition methods supporting pain assessment: A survey. IEEE Transactions on Affective Computing, 13(1), 530-552.
Morinaga, K., Hasuda, K., & Ikeda, T. (1995). A novel therapy for internal hemorrhoids: ligation of the hemorrhoidal artery with a newly devised instrument (Moricorn) in conjunction with a Doppler flowmeter. American Journal of Gastroenterology (Springer Nature), 90(4).
Langford, D. J., Reichel, J. F., Zhong, H., Basseri, B. H., Koch, M. P., Kolady, R., ... & Wu, C. L. (2025). Machine learning research methods to predict postoperative pain and opioid use: a narrative review. Regional Anesthesia & Pain Medicine, 50(2), 102-109.
Lohsiriwat, V., & Jitmungngan, R. (2022). Strategies to reduce post-hemorrhoidectomy pain: a systematic review. Medicina, 58(3), 418.
Zhang, C., He, J., Liang, X., Shi, Q., Peng, L., Wang, S., ... & Xu, J. (2024). Deep learning models for the prediction of acute postoperative pain in PACU for video‐assisted thoracoscopic surgery. BMC Medical Research Methodology, 24(1), 232.
Dong, H., Chen, W. X., Li, Y. J., & Wang, D. C. (2025). Efficacy of metronidazole in reducing pain after hemorrhoidectomy: a meta-analysis of randomized controlled trials. BMC Surgery, 25(1), 1-14.
Kazachenko, E., Garmanova, T., Derinov, A., Markaryan, D., Lee, H., Magbulova, S., & Tsarkov, P. (2022). Preemptive analgesia for hemorrhoidectomy: study protocol for a prospective, randomized, double-blind trial. Trials, 23(1), 536.
Perera, H., & Costa, L. (2023, July 28). PERSONALITY CLASSIFICATION OF TEXT THROUGH MACHINE LEARNING AND DEEP LEARNING: A REVIEW (2023). International Journal for Research in Advanced Computer Science and Engineering, 9(4), 6–12. https://doi.org/10.53555/cse.v9i4.2266
Downloads
Published
How to Cite
Issue
Section
License

This work is licensed under a Creative Commons Attribution 4.0 International License.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
Terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.