Abstract
Natural Language Processing (NLP) methods hold promise for improving clinical prediction by utilising information otherwise hidden in the clinical notes of electronic health records. However, clinical practice—as well as the systems and databases in which clinical notes are recorded and stored—change over time. As a consequence, the content of clinical notes may also change over time, which could degrade the performance of prediction models. Despite its importance, the stability of clinical notes over time has rarely been tested. Therefore, in this study, we examined the lexical stability of clinical notes from the Psychiatric Services of the Central Denmark Region in the period from January 1, 2011, to November 22, 2021 (a total of 14,811,551 clinical notes describing 129,570 patients) by quantifying sentence length, readability, syntactic complexity and clinical content - and estimating changepoints in these metrics. We find lexical and syntactic stability over time, which bodes well for the use of Natural Language Processing for predictive modelling in clinical practice.
Introduction: The Problem of Data Drift
In machine learning, "data drift" occurs when the distribution of data used to train a model changes over time, potentially leading to significant performance degradation. In clinical psychiatry, this is a critical concern as medical practices evolve, diagnostic criteria (such as ICD-10) are updated, and electronic health record (EHR) systems are modified. If a clinician in 2021 describes symptoms differently than one in 2011, an NLP model trained on historical data might fail to generalize to modern patients. This study investigates whether psychiatric clinical notes are "lexically stable"—that is, whether the language of psychiatry has remained consistent enough over a decade to support reliable predictive modeling.
Methods: Quantifying Linguistic Stability
The researchers analyzed the PSYCOP (Psychiatric Clinical Outcome Prediction) cohort, a massive dataset from the Central Denmark Region comprising over 14.8 million clinical notes from 129,570 patients between 2011 and 2021. To "stress test" text stability, four key linguistic indicators were employed:
- Mean Note Length: The number of tokens (words and punctuation) per note.
- Automated Readability Index (ARI): A metric estimating the "grade level" required to understand the text.
- Dependency Distance: A proxy for syntactic complexity, measuring the average distance between a word and its grammatical "head."
- Novelty: Calculated using Jensen-Shannon divergence to measure shifts in the distribution of 309 psychopathology-related keywords compared to the recent past.
The NLP pipeline utilized the spaCy Danish model and the textdescriptives library. To identify sudden shifts, the researchers applied the PELT (Pruned Exact Linear Time) changepoint detection algorithm, which statistically identifies when a metric deviates from its historical average.
Results: A Decade of Consistency
The analysis revealed remarkable stability in psychiatric documentation. Out of nearly 3,000 possible data points across various metrics, only 17 changepoints (0.6%) were detected. When looking at aggregate data, there were zero changepoints in readability, syntactic complexity, or novelty.
Key Findings:
- Administrative vs. Clinical Change: Most detected changepoints were administrative rather than clinical. For instance, the "Conclusion" note type shifted due to changes in EHR categorization rather than changes in clinical language.
- Resilience to External Shocks: While the COVID-19 pandemic introduced new terms related to "virtual communication," it did not fundamentally alter how clinicians described core psychopathology like delusions or anxiety.
- Gradual Trends: While the style remained stable, there was a steady, gradual increase in note length over the decade (averaging 71.5 tokens). This suggests that while the content is stable, the volume of documentation is slowly increasing.
- Standardized Language: Despite the subjective nature of mental health, the vocabulary used for psychopathology showed very low novelty scores, indicating a highly standardized professional language.
Discussion and Limitations
The findings provide a "green light" for the long-term use of NLP in psychiatric predictive modeling. However, some limitations remain. The "novelty" metric, based on word frequency, might miss subtle shifts in the context or sentiment of specific terms. Additionally, the analysis is sensitive to changes in rare terms, which might reflect shifts in patient populations rather than writing style. While the PELT algorithm is excellent for finding sudden breaks, it may be less sensitive to extremely slow, multi-year "drifts."
Future work should involve "model stability" testing—training predictive models on historical data and evaluating their performance on contemporary clinical notes to confirm that the observed lexical stability translates into sustained predictive accuracy.
Summary updated