Leveraging AI in healthcare for sorting ICD-10 codes
Building an Electronic Health Record (EHR) system is full of UX decisions, and sometimes the smallest friction points end up making a surprisingly big difference in day-to-day workflows. Recently we ran into one of these while working on an EHR for a client and figured it could be useful to share how we approached it, especially since it led us to a lightweight AI solution that others in the healthcare tech space might find helpful too.
When shared standards create UX confusion
Our client needed their EHR to support three core patient chart components: Problems, Allergies, and Medications. While medications have their own dedicated coding system and API endpoint, both problems and allergies rely on the same ICD-10 codes database.
When clinicians searched for allergy codes, they’d get results like “Allergy to penicillin” but also completely unrelated codes like “Chronic kidney disease” because both live in the same ICD-10 pool. The same thing happened when searching for problems, allergy codes would show up in the list. This forced users to mentally filter through a mix of relevant and irrelevant codes, which would slow them down during patient care.
The redundancy wasn't just annoying; it was inefficient. In healthcare settings where every second counts, forcing users to sift through unrelated codes defeats the purpose of having structured data in the first place.
Teaching AI to think like a clinician
We could have gone the route of manually categorizing thousands of ICD-10 codes or trying to build some sort of rule-based filtering system, but both options seemed like they’d be brittle and hard to maintain. Instead, we decided to try an AI-powered approach.
The idea was pretty straightforward: could we teach an AI model to distinguish between a problem and an allergy, just like a clinician would? If so, we could use that to filter the results in real time.
We tested several OpenAI models (GPT-4 Turbo, GPT-4.1, GPT-4.5 Preview, o3-mini, and o1) and found that the o1 model produced the most consistent categorization results. A big part of making this work was crafting a prompt that set the right clinical context.
The AI needed to understand that these categories are mutually exclusive: something is either a problem (a medical condition or diagnosis) or an allergy (a hypersensitivity reaction), never both. We pointed the model to the official WHO ICD-10 database as a reference and asked it to apply clinical reasoning to each code.
It took a few iterations to get the formatting right, but we eventually got to a point where the AI could reliably take a mixed list of ICD-10 codes and return only those that made sense for the user’s current task, whether they were adding a new problem or recording an allergy.
AI as a Healthcare UX tool
This proof of concept represents something larger than just solving one client's navigation problem. It demonstrates how AI can help combine standardized healthcare data and intuitive user interfaces.
The same approach could be adapted for other categorization challenges in healthcare technology: filtering procedure codes by specialty, or even organizing clinical notes by urgency level. AI is pretty good at picking up on context and nuance, which is exactly what’s missing when rigid data standards run into real-world use.
We’ve open-sourced our proof of concept on GitHub in case other teams want to build on it. It includes our prompts, the model comparisons we ran, and the implementation patterns that worked best for us.
Of course, this isn't production-ready out of the gate for clinical environments. Healthcare applications demand rigorous validation and safeguards. But as an experimental feature with proper verification mechanisms, fallback options, and probably some safety layers, it can work in a production setting. As an experiment, it’s a nice example of how AI can help make standardized data feel a bit more human.
At the end of the day, the future of healthcare tech isn’t just about collecting and storing data, it’s about surfacing it in ways that actually make clinicians’ lives easier. Sometimes the most impactful things are the ones that quietly reduce friction.
(Also, shout out to Victor Ferraz for surfacing this issue and kicking off the whole exploration!)