Abstract
Pathology reports are considered the gold standard in medical research due to their comprehensive and accurate diagnostic information. Natural language processing (NLP) techniques have been developed to automate information extraction from pathology reports. However, existing studies suffer from two significant limitations. First, they typically frame their tasks as report classification, which restricts the granularity of extracted information. Second, they often fail to generalize to unseen reports due to variations in language, negation, and human error. To overcome these challenges, we propose a BERT (bidirectional encoder representations from transformers) named entity recognition (NER) system to extract key diagnostic elements from pathology reports. We also introduce four data augmentation methods to improve the robustness of our model. Trained and evaluated on 1438 annotated breast pathology reports, acquired from a large medical center in the United States, our BERT model trained with data augmentation achieves an entity F1-score of 0.916 on an internal test set, surpassing the BERT baseline (0.843). We further assessed the model's generalizability using an external validation dataset from the United Arab Emirates, where our model maintained satisfactory performance (F1-score 0.860). Our findings demonstrate that our NER systems can effectively extract fine-grained information from widely diverse medical reports, offering the potential for large-scale information extraction in a wide range of medical and AI research.
Introduction
Pathology reports contain vital diagnostic data, yet their unstructured nature makes them a bottleneck for large-scale clinical research. Traditional NLP approaches often rely on simple report classification (e.g., "cancer present" vs. "absent"), which fails to capture granular details like specific lesion positions or the relationship between multiple findings. Furthermore, these models frequently struggle to generalize across different healthcare systems where writing styles and formatting vary significantly.
This research addresses these challenges by moving beyond classification to a granular Named Entity Recognition (NER) framework. By leveraging Clinical BERT and a novel data augmentation strategy, we demonstrate a system that is both highly accurate and robust enough to handle international variations in medical reporting.
Methodology
The core of our system is a Clinical BERT model, which utilizes a self-attention mechanism to understand the context of medical terms—a critical feature for correctly interpreting medical negation (e.g., "no evidence of ductal carcinoma").
To improve robustness, we introduced a Data Augmentation Module consisting of four specific transformations:
- Mention Replacement (MR): Swapping an entity with another of the same type from the dataset.
- Synonym Replacement (SR): Replacing words with synonyms using WordNet.
- Label-wise Token Replacement (LwTR): Replacing individual tokens with others sharing the same label.
- Shuffle within Segments (SiS): Randomly reordering tokens within an entity segment to help the model ignore rigid formatting.
Results
The model was trained on 1,438 breast pathology reports from NYU Langone Health. On the internal NYU test set, the augmented BERT model achieved an overall F1-score of 0.916, a substantial improvement over the baseline BERT score of 0.843.
As shown in the performance metrics, the model was nearly perfect at identifying cancer grade (0.983 F1) and very strong at cancer subtype (0.928 F1). While "lesion position" (0.827 F1) proved more difficult due to the high variability in how clinicians describe locations (e.g., "10 o'clock" vs. "uoq"), the augmentation strategies significantly buffered against this noise.
To test generalizability, we evaluated the model on an external dataset from SEHA hospitals in the United Arab Emirates. The augmented model maintained a high F1-score of 0.860, whereas the non-augmented baseline dropped to 0.739, proving that the augmentation strategies effectively prepare the model for diverse linguistic and formatting conventions.
Discussion and Conclusion
Our findings demonstrate that NER systems, when paired with robust data augmentation, can effectively extract fine-grained information from diverse medical reports. While the initial annotation cost remains high, the resulting model offers a scalable solution for clinical research. Future work will focus on expanding the scope of extracted entities (such as tumor size and biomarkers) and exploring the integration of Large Language Models (LLMs) to further refine extraction accuracy and reduce the need for manual labeling.
Code Availability: The authors have published their code at https://github.com/nyukat/pathology_extraction.
Summary updated