Journal  /  Research

Machine learning algorithm accurately predicts mental health crises

Koa Health, in collaboration with Birmingham and Solihull Mental Health NHS Foundation Trust, developed a machine learning model capable of predicting mental health crises from electronic health records up to 28 days in advance. The research was published in Nature Medicine in May 2022 and represents a significant step towards proactive, data-driven mental health care.

Machine learning algorithm accurately predicts mental health crises
01

Background

Nearly 1 billion people worldwide live with a mental disorder. The global mental health burden, considerably worsened by the COVID-19 pandemic, has placed healthcare systems under mounting pressure: demand for mental health services is rising while the availability of skilled clinical personnel remains limited.

Mental health crises — situations in which patients can neither care for themselves nor function effectively in the community, or in which they may pose a risk to themselves or others — are a significant and recurring source of that demand. Timely intervention can prevent symptoms from escalating into crisis and reduce the need for hospitalisation. The challenge is identifying which patients are approaching that threshold before it is too late.

In clinical practice, the manual review of complex patient records to make proactive care decisions is not feasible at scale. Clinicians are required to manage large caseloads, and the signals that precede a crisis are often subtle, distributed across months of recorded interactions, and difficult to synthesise without computational support.

02

The study

The research was led by Roger Garriga, Javier Mas, and Aleksandar Matic at Koa Health (Barcelona), in collaboration with Semhar Abraha, Jon Nolan, and George Tadros at Birmingham and Solihull Mental Health NHS Foundation Trust.

The team developed a machine learning model that uses electronic health records to continuously monitor patients for crisis risk over a rolling 28-day window. The model was trained and validated on anonymised EHR data collected over seven years from patients under the care of the NHS Trust — one of the largest mental health trusts in England.

The model was designed to assess risk continuously rather than at fixed clinical review points, meaning it can flag elevated risk between scheduled appointments and at a time when intervention is still possible.

Publication: Machine learning model to predict mental health crises from electronic health recordsNature Medicine, Volume 28, pages 1240–1248 (2022). DOI: 10.1038/s41591-022-01811-5

03

Results

The model's retrospective performance on the held-out test set:

  • AUROC of 0.797 (area under the receiver operating characteristic curve)
  • Area under the precision-recall curve of 0.159
  • Predicted crises with a sensitivity of 58% at a specificity of 85%

Following the retrospective validation, the team conducted a 6-month prospective study to evaluate the algorithm's use in real clinical practice. Clinicians were presented with the model's risk predictions as part of their workflow.

  • Predictions were found to be clinically valuable in 64% of cases — either for supporting caseload management or for taking action to mitigate the risk of an impending crisis
  • The study evaluated the added value of the predictions specifically in the context of clinical decision-making, not just predictive accuracy in isolation

The authors note this is, to their knowledge, the first study to continuously predict the risk of a wide range of mental health crises and to prospectively evaluate the added clinical value of such predictions in practice.

04

Why it matters

The significance of this work is twofold: technical and operational.

On the technical side, applying machine learning to EHR data for continuous crisis prediction is a meaningful advance. Previous approaches to risk stratification in mental health have tended to rely on periodic structured assessments, which capture a snapshot rather than a trajectory. A continuously updating model can respond to changes in a patient's condition as they accumulate in the record.

On the operational side, the prospective clinical evaluation is what sets this study apart from most ML-in-healthcare research. Demonstrating that a model produces clinically actionable output — not just statistically significant predictions — is the harder and more important test. The finding that clinicians found the predictions useful in nearly two thirds of cases provides meaningful evidence that this kind of tool can integrate into NHS workflows rather than simply remaining a research artefact.

The model also addresses a structural problem in mental health services: the gap between appointments. Crises do not wait for the next scheduled review. A system that monitors patients continuously and flags risk in real time gives clinical teams the option to act before a crisis has fully developed, potentially preventing hospital admissions and reducing harm.

05

Further reading

Full technical findings, including details on model architecture, feature engineering, and the prospective study design, are available in the Nature Medicine paper.

Next Article

Stakeholder management through uncertainty
Product

Stakeholder management through uncertainty

4 min read