Suicide prediction with natural language processing of electronic health records

Αλεξάνδρα Κορδά, Marco Heide, Alena Nag, Valerie-Noelle Trulley, Helena Rogg, Mihai Avram, S. Eickhoff, Kamila Jauch‐Chara, Kai Wehkamp, Xingyi Song, Thomas Martinetz, Jörn Conell, Angus Roberts, Robert Stewart, Christina Andreou, Stefan BorgwardtmedRxiv 2023

Abstract Suicide attempts are one of the most challenging psychiatric outcomes and have great importance in clinical practice. However, they remain difficult to detect in a standardised way to assist prevention because assessment is mostly qualitative and often subjective. As digital documentation is increasingly used in the medical field, Electronic Health Records (EHRs) have become a source of information that can be used for prevention purposes, containing codified data, structured data, and unstructured free text. This study aims to provide a quantitative approach to suicidality detection using EHRs, employing natural language processing techniques in combination with deep learning artificial intelligence methods to create an algorithm intended for use with medical documentation in German. Using psychiatric medical files from in-patient psychiatric hospitalisations between 2013 and 2021, free text reports will be transformed into structured embeddings using a German trained adaptation of Word2Vec, followed by a Long-Short Term Memory (LSTM) – Convolutional Neural Network (CNN) approach on sentences of interest. Text outside the sentences of interest will be analysed as context using a fixed size ordinally-forgetting encoding (FOFE) before combining these findings with the LSTM-CNN results in order to label suicide related content. This study will offer promising ways for automated early detection of suicide attempts and therefore holds opportunities for mental health care.

Introduction

Suicide remains a massive global health crisis, yet identifying at-risk individuals is notoriously difficult. Currently, mental health professionals rely on qualitative assessments and subjective scores. While Electronic Health Records (EHRs) contain a wealth of data, most of the "signal" for suicidality is buried in unstructured free-text clinical notes rather than structured billing codes (like ICD-10), which often lack the sensitivity needed for accurate prediction. This paper addresses the gap in tools specifically optimized for the German language and the unique linguistic structures found in psychiatric medical documentation.

Methodology

The proposed system follows a multi-stage pipeline designed to transform raw clinical notes into actionable risk labels.

High-level workflow of the suicide prediction pipeline, from pretraining to external validation.

Data Preprocessing and Embeddings

Textual data is first cleaned using the Natural Language Toolkit (NLTK), with specific attention to German-specific characters like umlauts. To capture semantic relationships, the researchers utilize a German-trained adaptation of Word2Vec. This ensures the model understands the nuances of German medical terminology rather than relying on translated English models.

Model Architecture: C-LSTM-CNN

The core of the detection engine is a hybrid architecture that processes both a "focus" sentence and its surrounding context.

Architecture of the C-LSTM-CNN model featuring Bi-directional LSTM for focus text and FOFE for context encoding.
  1. Focus Model: For a specific "sentence of interest," the model uses a Bi-directional LSTM to capture word dependencies in both directions, followed by a CNN to extract local features and patterns.
  2. Contextual Encoding (FOFE): To interpret the focus sentence, the model needs to know what was said before and after it. Using Fixed-size Ordinally-Forgetting Encoding (FOFE), the model represents variable-length surrounding text as a fixed-size vector, where sentences closer to the focus are weighted more heavily.
  3. Classification: Features from the focus and context modules are concatenated and passed through a Softmax layer to categorize the text as Positive, Negative, Uncertain, or No Label regarding suicide risk.

Datasets and Validation

The study draws from two primary sources:

  • Primary Cohort (Lübeck): EHRs from the Centre of Integrative Psychiatry (ZIP), Campus Lübeck, covering 2013–2021. This includes 1,395 documents related to suicidal behavior.
  • External Validation (Kiel): A separate dataset from Campus Kiel used to test the model's generalizability.

A subset of these documents was manually annotated by medical students under psychiatric supervision to create a "gold standard" for training.

Results and Discussion

Preliminary results on the completed suicide dataset (comprising 259 positive and 5,016 negative sentences) demonstrate the model's potential:

  • Mean Validation Accuracy: 76.98%
  • Overall Precision: 63.49%

Notably, the model performed significantly better at identifying negative labels (86.0% precision) than positive labels (40.98% precision). This disparity highlights the challenge of class imbalance in psychiatric datasets, where suicidal mentions are relatively rare compared to general clinical notes. The use of FOFE is critical here; in psychiatry, a single sentence like "Patient feels better" can mean something entirely different depending on whether the previous paragraph discussed a suicide attempt or a successful medication adjustment.

Conclusion

This research underscores the importance of context and language specificity in psychiatric NLP. By integrating FOFE with a Bi-LSTM-CNN architecture, the model moves beyond simple keyword matching to a more nuanced understanding of clinical narratives. Future work will focus on scaling the dataset and transitioning from sentence-level labeling to holistic patient-level risk prediction to support real-time clinical decision-making.

Summary updated

BibTeX
@misc{2023suicide,
  author = {Αλεξάνδρα Κορδά and Marco Heide and Alena Nag and Valerie-Noelle Trulley and Helena Rogg and Mihai Avram and S. Eickhoff and Kamila Jauch‐Chara and Kai Wehkamp and Xingyi Song and Thomas Martinetz and Jörn Conell and Angus Roberts and Robert Stewart and Christina Andreou and Stefan Borgwardt},
  title = {{Suicide prediction with natural language processing of electronic health records}},
  year = {2023},
  doi = {10.1101/2023.09.28.23296268},
  howpublished = {medRxiv},
}
Figure