Ascertaining antidepressant treatment episodes from specialist mental healthcare record text fields and applying these data to characterise difficult-to-treat depression: an algorithm development and retrospective cohort study in UK secondary mental healthcare
- 1Psychological Medicine, King’s College London, London, UK
- 2South London and Maudsley NHS Foundation Trust, London, UK
Abstract
Objectives: About 30% of individuals with depression treated with gold standard interventions do not respond adequately, often termed ‘difficult-to-treat depression’ (DTD). Despite this, DTD is not systematically tracked in specialist mental healthcare. This project sought to develop an algorithm to ascertain antidepressant treatment episodes from electronic health records (EHRs).
Design: An algorithm development and retrospective cohort study.
Setting: Using EHR data from a large south London mental healthcare provider, randomly selected and annotated clinical notes were extracted to develop an algorithm capturing temporality of antidepressant treatment courses.
Participants: In a sample of individuals with diagnosed depressive disorders, at least two different and consecutively recorded antidepressants were identified (n=4557).
Primary and secondary outcome measures: Using multivariable linear (for continuous variables) and logistic (for categorical variables) regression models, clinical (eg, numbers of recorded psychiatric symptoms and physical comorbidities) and demographic (eg, gender and ethnicity) characteristics were compared according to the number of antidepressants received.
Results: A total of 13 341 episode-level clinical entries were used to define antidepressant treatment episodes. Performance evaluations against manual annotation demonstrated high precision in identifying antidepressant prescription start dates (82%–94%) and good accuracy in detecting episode switching patterns (direct switch: >90%; cross-tapering/co-prescribing: 74%–82%). In the sample of 4557 patients with at least two consecutively prescribed antidepressants, those with higher numbers of recorded antidepressants had a higher number of recorded negative (β range=0.20–0.66, all p<0.05), depressive (β range=0.50–1.55, all p<0.05) and manic symptoms (β range=0.18–0.55, all p<0.05), as well as a greater number of prescribed non-antidepressant psychotropics (OR range=1.24–1.37, all p<0.05).
Conclusions: This project developed a novel algorithm identifying antidepressant episodes, predominantly from text records, among patients with depressive disorders. Antidepressant treatment episodes were successfully determined using this algorithm and enabled meaningful differentiation of characteristics associated with different levels of DTD. Wider applicability and generalisability need to be established.
Related
- Clinical presentation and pattern of diagnostic work-up leading to specialist referral: a retrospective citywide analysis of 11 primary care centres in Turku, Finland
- Development and validation of a questionnaire to assess factors affecting the role effectiveness of intravenous therapy specialist nurses in Beijing, China.
- Mapping Routinely Collected Hospital Quality and Safety Data onto a Modified Donabedian Governance Framework: A Two-Year Retrospective Descriptive Analysis in a Tertiary Specialist Hospital.
- Pressure injuries as adverse events in the context of patient’s safety during 2013–2020 in a specialist hospital: A retrospective study
- Specialist teleconsultation and changes in potentially inappropriate medication regimens among older adults in primary care: The AMELIORATION retrospective cohort study.
BibTeX
@article{ma2026ascertaining,
title = {{Ascertaining antidepressant treatment episodes from specialist mental healthcare record text fields and applying these data to characterise difficult-to-treat depression: an algorithm development and retrospective cohort study in UK secondary mental healthcare}},
author = {Ruimin Ma and Matthew Broadbent and Robert Stewart},
journal = {BMJ Open},
year = {2026},
month = nov,
doi = {10.1136/bmjopen-2026-119485},
url = {https://bmjopen.bmj.com/lookup/doi/10.1136/bmjopen-2026-119485},
note = {CC BY},
}
RIS
TY - JOUR
TI - Ascertaining antidepressant treatment episodes from specialist mental healthcare record text fields and applying these data to characterise difficult-to-treat depression: an algorithm development and retrospective cohort study in UK secondary mental healthcare
AU - Ruimin Ma
AU - Matthew Broadbent
AU - Robert Stewart
PY - 2026
DA - 2026/11/18
JO - BMJ Open
DO - 10.1136/bmjopen-2026-119485
UR - https://bmjopen.bmj.com/lookup/doi/10.1136/bmjopen-2026-119485
AB - Objectives: About 30% of individuals with depression treated with gold standard interventions do not respond adequately, often termed ‘difficult-to-treat depression’ (DTD). Despite this, DTD is not systematically tracked in specialist mental healthcare. This project sought to develop an algorithm to ascertain antidepressant treatment episodes from electronic health records (EHRs). Design: An algorithm development and retrospective cohort study. Setting: Using EHR data from a large south London mental healthcare provider, randomly selected and annotated clinical notes were extracted to develop an algorithm capturing temporality of antidepressant treatment courses. Participants: In a sample of individuals with diagnosed depressive disorders, at least two different and consecutively recorded antidepressants were identified (n=4557). Primary and secondary outcome measures: Using multivariable linear (for continuous variables) and logistic (for categorical variables) regression models, clinical (eg, numbers of recorded psychiatric symptoms and physical comorbidities) and demographic (eg, gender and ethnicity) characteristics were compared according to the number of antidepressants received. Results: A total of 13 341 episode-level clinical entries were used to define antidepressant treatment episodes. Performance evaluations against manual annotation demonstrated high precision in identifying antidepressant prescription start dates (82%–94%) and good accuracy in detecting episode switching patterns (direct switch: >90%; cross-tapering/co-prescribing: 74%–82%). In the sample of 4557 patients with at least two consecutively prescribed antidepressants, those with higher numbers of recorded antidepressants had a higher number of recorded negative (β range=0.20–0.66, all p<0.05), depressive (β range=0.50–1.55, all p<0.05) and manic symptoms (β range=0.18–0.55, all p<0.05), as well as a greater number of prescribed non-antidepressant psychotropics (OR range=1.24–1.37, all p<0.05). Conclusions: This project developed a novel algorithm identifying antidepressant episodes, predominantly from text records, among patients with depressive disorders. Antidepressant treatment episodes were successfully determined using this algorithm and enabled meaningful differentiation of characteristics associated with different levels of DTD. Wider applicability and generalisability need to be established.
SN - 2044-6055
SN - 2044-6055
ER -