Structuring Electronic Health Record Data Through a Large Language Model Pipeline With Gayathri Namasivayam, PhD
Expert Perspectives · Keira Smith · 2025-07-11
At the 2025 American Society of Clinical Oncology (ASCO) Annual Meeting, Gayathri Namasivayam, PhD, Senior Manager of Data Science and Machine Learning at Ontada, shared her team’s innovative work using large language models (LLMs) to extract critical cancer information from unstructured electronic health records (EHRs). While at ASCO, she spoke with Oncology Data Advisor to explain the project’s motivation, methodology, and promising results, offering valuable insights for oncology clinicians seeking to improve data quality and completeness in their own practices.
Click the button to subscribe to our emails, including the Monthly Newsletter and more!
The Challenge of Unstructured EHR Data
Unstructured documents in EHRs—such as progress notes and scanned PDFs—are a treasure trove of clinical information, but their free text and image-based formats make data extraction a formidable challenge. “We have two primary sources of unstructured documents,” Dr. Namasivayam explained. “Progress notes are just plain text documents with a lot of information about the patient’s medical history and interaction. The second kind are PDFs, which can include imaging reports, biomarker and lab results, financial documents, and pathology reports. Often, these PDFs are scanned documents with no underlying text layer, making direct extraction impossible.”
Building a Robust Extraction Pipeline
To address this gap, Dr. Namasivayam’s team began by clearly defining their extraction goals and evaluating a range of machine learning approaches. “We started out by looking at what we wanted to extract and evaluated different machine learning approaches,” she said. “We identified the approach that worked best with the least number of errors. Ultimately, we leveraged the most recent advances in artificial intelligence—large language models—using prompt engineering to guide the models in extracting clinical information from documents.”
This pipeline first converts scanned PDFs into text using optical character recognition (OCR), then combines the resulting text with carefully crafted prompts. These prompts, designed by data scientists, instruct the LLM to extract specific clinical details such as cancer diagnosis, histology, grade, and staging.
Impressive Accuracy and Validation
Validation was a critical step. “We had chart abstractors manually review and extract information from a random sample of pathology documents and progress notes,” Dr. Namasivayam described. “We then passed the same documents through our pipeline and compared the outputs.” The pipeline achieved an F1 score—a metric using a combined measure of precision and recall—greater than 0.85 on all the clinical information extracted from the PDFs and progress notes. This high level of accuracy demonstrates the pipeline’s reliability and its potential to significantly enhance the completeness and quality of oncology data.
Expanding the Pipeline’s Reach
Looking ahead, Dr. Namasivayam’s team is eager to expand the pipeline’s capabilities. “Since we achieved success on extracting this specific clinical information from pathology reports, we are applying the same pipeline to extract other relevant clinical information like metastatic sites, and to other domains like biomarker and genomic reports, imaging, and treatment,” she said. “We are looking forward to extracting much more information and increasing the completeness and accuracy of our EHR.”
Practical Implications for Oncology Clinicians
Dr. Namasivayam emphasized the pipeline’s simplicity and adaptability: “This pipeline is very simple. It can be applied to different kinds of documents, and I would encourage others with similar use cases to try it. Our documents are quite varied, and I think this pipeline might work quite well on different sets of documents coming from other practices. It might just need a slight tweak to the prompt, but overall, it’s quite robust.”
Key Takeaways
- Unstructured EHR data, especially scanned PDFs and progress notes, contain vital clinical information that is often inaccessible for structured analysis.
- Large language models, guided by prompt engineering, can accurately extract cancer diagnosis, histology, grade, and staging from these documents.
- The pipeline achieved an F1 score greater than 0.85, indicating high reliability.
- The approach is adaptable and can be extended to other clinical domains and document types.
- Oncology clinicians are encouraged to consider similar pipelines to improve data completeness and quality in their own practices.
About Dr. Namasivayam
Gayathri Namasivayam, PhD, is the Senior Manager for Data Science and Machine Learning at Ontada, where she leads efforts to extract clinical information from patient documents. She is passionate about pioneering innovative methods for improving data collection, quality, and accuracy in order to enhance patient outcomes.
