Abstract
Is it true that patients with similar conditions get similar diagnoses? In this paper, we introduce a method for representing medical visits based on free-text descriptions recorded by doctors. We present a new approach for clustering patient visits and apply it to a corpus of 100,000 records. Our method yields stable, distinct segments of visits that correlate strongly with final medical diagnoses, demonstrating how such algorithms can assist doctors in clinical practice.
Introduction
A vast amount of critical medical information is locked away in "free-text" clinical records—the unstructured notes doctors jot down during interviews and examinations. While structured data like age or sex is easily analyzed, narrative notes are rich in nuance but difficult for computers to process.
This paper addresses the challenge of clustering individual medical visits rather than entire patient histories. This is particularly relevant for languages like Polish, which lack the comprehensive medical ontologies (like UMLS) available for English. The goal is to help clinicians identify similar cases, validate unusual diagnoses, and discover patterns in symptoms and treatments across massive datasets.
Methodology
The researchers developed a four-step pipeline to transform unstructured text into meaningful clusters:
- Medical Concept Extraction: Using Polish-specific NLP tools (Concraft and TermoPL), frequent noun phrases were identified. 4,800 phrases were manually annotated with 137 semantic labels (e.g., anatomy, disease, test).
- Domain-Specific Embeddings: GloVe embeddings were trained specifically on the medical corpus. This captured how terms like "cough" shift meaning between a patient's interview (subjective) and a doctor's exam (objective).
- Visit Representation: Each visit was represented by a vector created by averaging the embeddings of concepts found in the interview and examination sections, then concatenating them.
- Clustering: Hierarchical clustering (Ward’s method) was selected for its superior stability over k-means. The "Elbow method" determined the optimal number of clusters for various medical specialties.
The Geometry of Clinical Language
A key finding of this research is that medical relationships are captured as geometric analogies in vector space. By training on domain-specific data, the model learned consistent spatial relationships between concepts.
As shown in the figure above, the model successfully maps relationships such as lateralization (e.g., elbow to right elbow) and the association between anatomy and symptoms (e.g., knee to knee pain). These consistent vector offsets demonstrate that the embeddings capture the underlying "logic" of medical terminology.
Key Results and Insights
- Stability and Accuracy: The clusters showed high stability, with an Adjusted Rand Index (ARI) between 0.69 and 0.87. On a custom medical analogy task, the model achieved a top-1 accuracy of ~17%, which is significant given the specialized nature of the dataset.
- Clinical Alignment: Clustering was performed without using ICD-10 diagnosis codes. However, the resulting clusters naturally aligned with these external labels. For instance, Family Medicine clusters clearly separated respiratory diseases from circulatory issues.
- The "Doctor Fingerprint": Some clusters mapped perfectly to individual doctors, suggesting the method can capture unique diagnostic or reporting styles.
- Recommendation Patterns: The model identified "characteristic" recommendations for specific clusters, such as identifying a prenatal care group in Gynecology based on the frequency of folic acid prescriptions.
Conclusion
While the reliance on manual annotation for initial phrase extraction is a limitation, this study proves that NLP pipelines can successfully capture the medical "truth" of unstructured records. Future work involves developing real-time recommendation systems to suggest potential diagnoses or treatments based on historical case clusters, effectively serving as a clinical decision support tool.
Summary updated