Back

Predicting Intentional Self-Harm Following Psychiatric Discharge in Catalonia, Spain: Machine Learning Models from Linked Registry Data

Alayo, I.; Pujol, O.; Amigo, F.; Ballester, L.; Cirici Amell, R.; Contaldo, S. F.; Ferrer, M.; Guinart, D.; Latorre, L.; Leis, A.; Lopez Fernandez, M.; Mayer, M. A.; Pastor, M.; Pena-Salazar, C.; Portillo-Van Diest, A.; Ramirez-Anguita, J. M.; Sanz, F.; Alonso, J.; Kessler, R. C.; Mehlum, L.; Palao, D.; Perez Sola, V.; Vilagut, G.; Mortier, P.

2025-09-28 psychiatry and clinical psychology
10.1101/2025.09.26.25336360
Show abstract

IntroductionPatients recently discharged from psychiatric hospitalization are at increased risk of intentional self-harm, including suicide. Using linked population-based registry data from Catalonia, Spain, we developed machine learning-based prediction models for post-discharge intentional self-harm across different follow-up horizons, sex, and age groups, and evaluated their generalizability and robustness with multiple validation strategies. MethodsRetrospective cohort study including 41,827 individuals accounting for 71,865 psychiatric hospitalizations with discharge at age [≥]10 years, between January 1, 2015, and December 31, 2018, in Catalonia, Spain, with follow-up until December 31, 2019. Primary outcome was intentional self-harm (fatal or non-fatal) within 7, 30, 90, 180, and 365 days post-discharge. Models incorporated 247 predictors from electronic health records, including sociodemographic characteristics, mental and physical disorder categories, categories of dispensed psychotropic medication, and history of self-harm and psychiatric hospitalization. Model performance was evaluated using the area under the receiver operating characteristic curve (AUCROC) and the area under the precision-recall curve (AUCPR). Predictor importance was assessed using Shapley Additive Explanations (SHAP). ResultsWithin 365 days, 4,901 hospitalizations (6.8%) were followed by intentional self-harm. The 365-day model trained on the full cohort achieved a AUCROC of 0.819, in the test sample with adjusted AUCPR indicating a median 5.4-fold improvement over baseline prevalence. This model generalized well across event horizons and sex-age strata, outperforming subgroup-specific models when data sparsity limited performance. Separate models trained by event horizons, and stratified by sex, and sex-age groups achieved a median AUCROC of 0.775 (IQR 0.764-0.808), with adjusted AUCPR indicating a median 5.4-fold improvement over baseline prevalence (IQR 4.5-6.2). Key predictors included the recency of the last registered diagnosis of depressive episodes, recurrent depression, adjustment disorders, and schizophrenia, as well as recent SSRI dispensation and the number of childhood-onset disorder and musculoskeletal disease diagnoses in the previous five years. Predictor importance varied considerably across sex-age strata, with smaller differences across horizons. Subject-level and temporal split validation strategies reduced performance (AUCROC 0.711-0.746), though estimates remained clinically informative (2.8-3.1-fold improvement over baseline prevalence). ConclusionsMachine learning models using routinely collected health records predicted intentional self-harm after psychiatric hospitalization with good discrimination and clinically meaningful precision-recall performance. A single 365-day model generalized well across horizons and demographic groups, suggesting that one broadly trained model may provide a pragmatic and scalable approach for clinical implementation.

Matching journals

1
Translational Psychiatry
Springer Science and Business Media LLC · based on 94 published papers
Top 1.0%
25× avg
2
Psychological Medicine
Cambridge University Press (CUP) · based on 52 published papers
Top 0.7%
31× avg
3
The British Journal of Psychiatry
Royal College of Psychiatrists · based on 21 published papers
Top 0.3%
55× avg
4
Schizophrenia Bulletin
Oxford University Press (OUP) · based on 21 published papers
Top 0.8%
32× avg
5
npj Digital Medicine
Springer Science and Business Media LLC · based on 85 published papers
Top 5%
5.8× avg
6
Scientific Reports
Springer Science and Business Media LLC · based on 701 published papers
Top 51%
3.0%
7
Molecular Psychiatry
Springer Science and Business Media LLC · based on 84 published papers
Top 2%
11× avg
8
PLOS ONE
Public Library of Science (PLoS) · based on 1737 published papers
Top 80%
2.8%
9
JAMA Psychiatry
American Medical Association (AMA) · based on 11 published papers
#1
68× avg
10
Biological Psychiatry
Elsevier BV · based on 36 published papers
Top 2%
12× avg
11
PLOS Medicine
Public Library of Science (PLoS) · based on 95 published papers
Top 4%
5.3× avg
12
JAMA Network Open
American Medical Association (AMA) · based on 125 published papers
Top 7%
3.4× avg
13
BMJ Mental Health
BMJ · based on 15 published papers
Top 0.5%
40× avg
14
Psychiatry Research
Elsevier BV · based on 33 published papers
Top 3%
13× avg
15
BJPsych Open
Royal College of Psychiatrists · based on 24 published papers
Top 0.9%
27× avg
16
Journal of Affective Disorders
Elsevier BV · based on 72 published papers
Top 4%
4.6× avg
17
Biological Psychiatry Global Open Science
Elsevier BV · based on 23 published papers
Top 1%
19× avg
18
Nature Communications
Springer Science and Business Media LLC · based on 483 published papers
Top 29%
1.8%
19
American Journal of Psychiatry
American Psychiatric Association Publishing · based on 14 published papers
Top 0.7%
29× avg
20
Nature Medicine
Springer Science and Business Media LLC · based on 88 published papers
Top 8%
3.2× avg
21
Neuropsychopharmacology
Springer Science and Business Media LLC · based on 29 published papers
Top 2%
11× avg
22
BMC Medicine
Springer Science and Business Media LLC · based on 155 published papers
Top 16%
1.7× avg
23
Biological Psychiatry: Cognitive Neuroscience and Neuroimaging
Elsevier BV · based on 27 published papers
Top 2%
12× avg
24
Journal of Psychiatric Research
Elsevier BV · based on 22 published papers
Top 2%
15× avg
25
Schizophrenia Research
Elsevier BV · based on 11 published papers
Top 0.9%
23× avg
26
Frontiers in Psychiatry
Frontiers Media SA · based on 56 published papers
Top 7%
2.4× avg
27
Journal of Medical Internet Research
JMIR Publications Inc. · based on 81 published papers
Top 14%
0.8%
28
Schizophrenia
Springer Science and Business Media LLC · based on 13 published papers
Top 1%
12× avg
29
Epidemiology and Psychiatric Sciences
Cambridge University Press (CUP) · based on 10 published papers
Top 1%
14× avg