How machine learning on real world clinical data improves adverse event recording for endoscopy

Jakob Nikolas Kather, Md, MSc, Stefan Wittlinger, Isabella C. Wiest, Mahboubeh Jannesari Ladani, Jakob Nikolas Kather, Matthias P. Ebert, Fabian Siegel, Sebastian BelleNpj Digit. Medicine 2025

Abstract

Endoscopic procedures are critical for gastrointestinal care, yet complications such as bleeding and perforation are frequently underreported in official registries. This study presents a machine learning approach that utilizes "digital exhaust"—structured hospital metadata—to retrospectively detect adverse events (AEs). By training a Random Forest classifier on features like billing codes and material logs, the researchers achieved high diagnostic accuracy, offering a scalable and privacy-preserving alternative to manual clinical audits.

The Challenge of Underreporting

While endoscopic mucosal resection (EMR) is a standard intervention, it carries inherent risks. Current methods for tracking complications rely heavily on manual chart reviews of discharge letters and clinical notes. This process is labor-intensive, prone to human error, and often fails to capture events that emerge days after the procedure or result in readmission. Consequently, many institutions lack an accurate "ground truth" regarding their complication rates, which limits the effectiveness of patient safety initiatives.

Data Sources and Clinical Workflow

To address this, the study focused on structured metadata generated throughout the patient journey. Unlike unstructured clinical notes, which are difficult to process and contain sensitive information, metadata provides a "digital signature" of clinical events.

Figure 3: Overview of the clinical workflow and the corresponding data types generated at each stage, from admission to discharge.

As shown in the workflow above, the model analyzes data points such as ICD-10 (diagnosis) codes, OPS (procedure) codes, specific materials used (e.g., hemostatic clips), and the duration of the hospital stay. These features collectively signal the occurrence of an adverse event more reliably than any single code in isolation.

Machine Learning Pipeline and Study Design

The researchers utilized a dataset of 2,490 inpatient cases from University Hospital Mannheim. To overcome the lack of labeled data, they employed a Large Language Model (Llama-2 70B) to extract "silver standard" labels from clinical reports, which were then validated against a human-labeled subset of 500 cases.

Figure 4: The study design illustrating the input metadata, the training/test data split, and the Random Forest classifier used to predict complications.

The core of the system is a Random Forest classifier. The model was trained to identify three specific outcomes: perforation, bleeding, and 30-day readmission. By focusing on tabular metadata, the approach ensures "privacy by design," as it does not require access to raw, identifiable patient narratives to function.

Key Results and Insights

The model demonstrated robust performance across all target categories, significantly outperforming baseline classifiers:

  • Readmission: Achieved an AUC-ROC of 0.96 and an AUC-PR of 0.90.
  • Perforation: Achieved an AUC-ROC of 0.90 and an AUC-PR of 0.69.
  • Bleeding: Achieved an AUC-ROC of 0.84 and an AUC-PR of 0.64.

Interestingly, the model was more adept at detecting perforations than bleeding. This is likely because perforations trigger a more drastic and distinct change in the clinical workflow (e.g., immediate use of specific surgical materials and extended stays), whereas bleeding can sometimes have a "quieter" signature in the administrative data.

Limitations and Future Directions

While promising, the study was conducted at a single center, and the model's ability to generalize to other hospital systems remains to be validated. Additionally, the current system is limited to tracking readmissions within the same facility. Future work will focus on prospective applications, potentially moving from retrospective auditing to real-time monitoring to alert clinical staff to high-risk patients before discharge.

Summary updated

BibTeX
@article{msc2025how,
  author = {Jakob Nikolas Kather, MD, MSc and Stefan Wittlinger and Isabella C. Wiest and Mahboubeh Jannesari Ladani and Jakob Nikolas Kather and Matthias P. Ebert and Fabian Siegel and Sebastian Belle},
  title = {{How machine learning on real world clinical data improves adverse event recording for endoscopy}},
  journal = {Npj Digit. Medicine},
  year = {2025},
  doi = {10.1038/s41746-025-01826-5},
}
Figure