Codelist development for and anxiety disorders and depression diagnoses

Overview

This report assesses the suitability of NHS England Primary Care Domain Reference Sets for identifying diagnoses of common mental health conditions, specifically anxiety diagnoses and depression, and compares them with codelists constructed to match the definitions used in the Adult Psychiatric Morbidity Survey: Survey of Mental Health and Wellbeing, England, 2023/4.

The analysis proceeds in two stages. First, the coverage and usage of the NHS Refsets are assessed using data from the NHS England SNOMED Code Usage in Primary Care dataset. Second, condition-specific codelists are constructed to mirror APMS diagnostic definitions, and usage patterns of these lists are evaluated over time.

NHS Primary Care Refsets

The Primary Care Domain Refset contain codelist for anxiety and depression diagnostic (anx_cod,depr_cod) and resolved (anx_res_cod,dep_res_cod) codes.

Diagnosis

Analysis of codelists

The below figure shows the coding of anxiety disorders and depression diagnoses, as specified in the NHS Primary Care Domain Refsets (anx_cod, depr_cod).

Show the code
anx_cod_depr_cod_usage <- snomed_usage |> 
  mutate(
    depr_cod = snomed_code %in% depr_cod$code,
    anx_cod = snomed_code %in% anx_cod$code
    ) |> 
  pivot_longer(
    cols = c(depr_cod, anx_cod),
    names_to = "codelist") |> 
  filter(value == TRUE) |> 
  group_by(end_date, codelist) |> 
  summarise(count = sum(usage, na.rm = TRUE))

fig_depr_anx_cod_trends <- anx_cod_depr_cod_usage |> 
  mutate(codelist = factor(
    codelist,
    levels = c("depr_cod", "anx_cod"), 
    labels = c("Depression diagnostic codes", "Anxiety diagnostic codes"))) |> 
  ggplot(
      aes(
        y = count,
        x = end_date,
        colour = codelist,
        shape = codelist
      )
    ) +
    geom_line(alpha = 0.2) +
    geom_point() +
    labs(
      title = "Yearly counts of anxiety disorder and depression diagnoistic codes",
      x = NULL,
      y = NULL,
      colour = NULL,
      shape = NULL,
      caption = "Data from NHS England SNOMED Code Usage in Primary Care."
    ) +
    scale_x_date(
      date_breaks = "1 year",
      labels = label_date_short()
    ) +
    scale_y_continuous(
      labels = label_number(accuracy = 1),
      limits = c(0, NA)
    ) +
    theme_bw() +
    theme(legend.position = "bottom") +
    scale_colour_viridis_d(end = .8)

ggsave(
  filename = here("output", "figures", "cod_devel", "dx", "fig_depr_anx_cod_trends.png"),
  fig_depr_anx_cod_trends,
  height = 4,
  width = 8
)

fig_depr_anx_cod_trends

Analysis of individual codes

Show the code
overlap <- intersect(depr_cod$code, anx_cod$code)

snomed_usage |> 
  filter(snomed_code %in% overlap) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  create_table_sem_tag(
    title = md("Codes appearing in both the NHS Refsets for depression and anxiety diagnoses"),
    subtitle = "Timeframe: August 2011 to July 2024"
  ) |> 
  cols_hide(ratio_usage)
Codes appearing in both the NHS Refsets for depression and anxiety diagnoses
Timeframe: August 2011 to July 2024
SNOMED code Description Usage
Disorder
231504006 Mixed anxiety and depressive disorder 20,659,770
16264901000119109 Recurrent moderate major depressive disorder co-occurrent with anxiety 810
16264621000119109 Recurrent mild major depressive disorder co-occurrent with anxiety 695
16264821000119108 Recurrent severe major depressive disorder co-occurrent with anxiety 475
16265301000119106 Recurrent major depressive disorder in partial remission co-occurrent with anxiety 40
Data scource: NHS England SNOMED Usage in Primary Care.

This table shows the 20 most used codes covering 99.35% of the total code usage of the codelist. The full list of included codes is avilable on OpenCodelists, see depr_cod.

Show the code
# Display formatted table
tab_depr_cod_counts <- depr_cod_counts |>
  create_table_sem_tag(
    title = md("*Depression* diagnosis codes (`depr_cod`)"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_depr_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_depr_cod_usage.png")
  )

tab_depr_cod_counts
Depression diagnosis codes (depr_cod)
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
231504006 Mixed anxiety and depressive disorder 20,659,770 43.751%
35489007 Depressive disorder 20,623,000 43.673%
310496002 Moderate depression 1,098,060 2.325%
87414006 Reactive depression (situational) 1,042,110 2.207%
191616006 Recurrent depression 990,730 2.098%
310495003 Mild depression 434,190 0.919%
192080009 Chronic depression 357,170 0.756%
310497006 Severe depression 287,310 0.608%
300706003 Endogenous depression 251,490 0.533%
36923009 Major depression, single episode 217,360 0.460%
78667006 Dysthymia 171,700 0.364%
83458005 Agitated depression 158,640 0.336%
274948002 Endogenous depression - recurrent 134,630 0.285%
191604000 Single major depressive episode, severe, with psychosis 122,470 0.259%
231499006 Endogenous depression first episode 96,870 0.205%
268621008 Recurrent major depressive episodes 68,420 0.145%
73867007 Severe major depression with psychotic features 54,090 0.115%
247803002 Seasonal affective disorder 51,760 0.110%
15639000 Moderate major depression, single episode 47,470 0.101%
191676002 Reactive depressive psychosis 46,570 0.099%
Data scource: NHS England SNOMED Usage in Primary Care.

This table shows the 20 most used codes covering 99.58% of the total code usage of the codelist. The full list of included codes is avilable on OpenCodelists, see anx_cod.

Show the code
# Display formatted table
tab_anx_cod_counts <- anx_cod_counts |>
  create_table_sem_tag(
    title = md("*Anxiety* diagnosis codes (`anx_cod`)"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_anx_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_anx_cod_usage.png")
  )

tab_anx_cod_counts
Anxiety diagnosis codes (anx_cod)
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
231504006 Mixed anxiety and depressive disorder 20,659,770 44.792%
197480006 Anxiety disorder 13,705,140 29.714%
21897009 Generalized anxiety disorder 1,493,400 3.238%
371631005 Panic disorder 580,480 1.259%
191722009 Agoraphobia with panic attacks 121,340 0.263%
386810004 Phobic disorder 114,790 0.249%
70691001 Agoraphobia 104,740 0.227%
25501002 Social phobia 82,920 0.180%
Finding
198288003 Anxiety state 4,085,680 8.858%
48694002 Anxiety 3,572,040 7.745%
191708009 Chronic anxiety 544,060 1.180%
191709001 Recurrent anxiety 234,810 0.509%
231501003 Needle phobia 100,780 0.219%
247854002 Flying phobia 53,610 0.116%
19887002 Claustrophobia 53,010 0.115%
247805009 Anxiety and fear 41,720 0.090%
386808001 Phobia 39,290 0.085%
247808006 Anxiety about body function or health 36,480 0.079%
38617005 Dental phobia 28,550 0.062%
Situation
161470009 History of anxiety state 275,320 0.597%
Data scource: NHS England SNOMED Usage in Primary Care.

Resolved

Analysis of codelists

Show the code
nhsrefset_res_cod_usage <- snomed_usage |> 
  mutate(
    anx_res = snomed_code %in% anx_res_cod$code,
    dep_res = snomed_code %in% dep_res_cod$code
    ) |> 
  pivot_longer(
    cols = c(
      anx_res,
      dep_res
    ),
    names_to = "codelist") |> 
  filter(value == TRUE) |> 
  group_by(end_date, codelist) |> 
  summarise(count = sum(usage, na.rm = TRUE))

fig_nhsrefset_res_cod_trends <- nhsrefset_res_cod_usage |> 
  mutate(codelist = factor(
    codelist,
    levels = c(
      "anx_res",
      "dep_res"
    ),
    labels = c(
      "Anxiety disorder resolved",
      "Depression resolved"
    ))) |> 
  ggplot(
      aes(
        y = count,
        x = end_date,
        colour = codelist,
        shape = codelist
      )
    ) +
    geom_line(alpha = 0.4) +
    geom_point(size = 2) +
    labs(
      title = "Yearly counts of resolved codes as specified by NHS Refsets",
      x = NULL,
      y = NULL,
      colour = NULL,
      shape = NULL,
      caption = "Data from NHS England SNOMED Code Usage in Primary Care."
    ) +
    scale_x_date(
      date_breaks = "1 year",
      labels = label_date_short()
    ) +
    scale_y_continuous(
      labels = label_number(accuracy = 1),
      limits = c(0, NA)
    ) +
    theme_bw() +
    theme(legend.position = "bottom") +
    scale_color_okabe_ito()

ggsave(
  filename = here("output", "figures", "cod_devel", "dx", "fig_nhsrefset_res_cod_trends.png"),
  fig_nhsrefset_res_cod_trends,
  height = 4,
  width = 8
)

fig_nhsrefset_res_cod_trends

Analysis of individual codes

Show the code
anx_res_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% anx_res_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_anx_res_cod_counts <- anx_res_cod_counts |>
  create_table_sem_tag(
    title = md("*Anxiety* disorder resolved codes (`anx_res_cod`)"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_anx_res_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_anx_res_nhsrefset_cod_usage.png")
  )

tab_anx_res_cod_counts
Anxiety disorder resolved codes (anx_res_cod)
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Finding
1037391000000102 Anxiety resolved 3,755 98.556%
Disorder
16265061000119105 Recurrent major depressive disorder co-occurrent with anxiety in full remission 45 1.181%
11941006 Panic disorder with agoraphobia, agoraphobic avoidance in full remission AND panic attacks in full remission 5 0.131%
82494000 Panic disorder without agoraphobia with panic attacks in full remission 5 0.131%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
dep_res_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% dep_res_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_dep_res_cod_counts <- dep_res_cod_counts |>
  create_table_sem_tag(
    title = md("*Depression* dignosis resolved (`dep_res_cod`)"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_dep_res_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_dep_res_nhsrefset_cod_usage.png")
  )

tab_dep_res_cod_counts
Depression dignosis resolved (dep_res_cod)
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Finding
196381000000100 Depression resolved 440,010 100.000%
Data scource: NHS England SNOMED Usage in Primary Care.

APM Survey

In the Adult Psychiatric Morbidity Survey: Survey of Mental Health and Wellbeing, England, 2023/4 the following mental health conditions are assessed in Chapter 1: Common mental health conditions and Chapter 3: Posttraumatic stress disorder of the survey, see Appendix A: Assessment of disorders for more details.

Show the code
condition_names <- list(
  gad = "Generalised anxiety disorder (GAD)",
  cmhc_nos = "Common mental health conditions not otherwise specified (CMHC-NOS)",
  ocd = "Obsessive and compulsive disorder (OCD)",
  dep = "Depressive episode",
  pd = "Panic disorder (PD)",
  phobia = "Phobia",
  ptsd = "Posttraumatic stress disorder (PTSD)"
)

measures_mental_health_conditions <- list(
  gad = list(
    condition = "Generalised anxiety disorder (GAD)",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  cmhc_nos = list(
    condition = "Common mental health conditions not otherwise specified (CMHC-NOS)",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  ocd = list(
    condition = "Obsessive and compulsive disorder (OCD)",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  dep = list(
    condition = "Depressive episode",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  pd = list(
    condition = "Panic disorder",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  phobia = list(
    condition = "Phobia",
    diagnostic_status = "Present to diagnostic criteria",
    classification_system = "ICD-10",
    assessment_tool = "CIS-R",
    survey_phase = "1",
    reference_period = "Past week"
  ),
  ptsd = list(
    condition = "Posttraumatic stress disorder (PTSD)",
    diagnostic_status = "Screen positive",
    classification_system = "DSM-IV",
    assessment_tool = "PTSD Check List",
    survey_phase = "1",
    reference_period = "Past week"
  )
)

df_measures_mental_health_conditions <- map_dfr(measures_mental_health_conditions, ~.x, .id = "condition_tag")

gt(df_measures_mental_health_conditions) |> 
  cols_label(
    condition = "Condition",
    diagnostic_status = "Diagnostic status",
    classification_system = "Classification system",
    assessment_tool = "Assessment tool",
    survey_phase = "Survey phase",
    reference_period = "Reference period"
  ) |> 
  cols_hide(
    c(
      condition_tag,
      diagnostic_status,
      survey_phase,
      reference_period
      )
    )
Condition Classification system Assessment tool
Generalised anxiety disorder (GAD) ICD-10 CIS-R
Common mental health conditions not otherwise specified (CMHC-NOS) ICD-10 CIS-R
Obsessive and compulsive disorder (OCD) ICD-10 CIS-R
Depressive episode ICD-10 CIS-R
Panic disorder ICD-10 CIS-R
Phobia ICD-10 CIS-R
Posttraumatic stress disorder (PTSD) DSM-IV PTSD Check List

Diagnosis

Analysis of codelists

Show the code
amps_cod_usage <- snomed_usage |> 
  mutate(
    gad_cod = snomed_code %in% gad_cod$code,
    cmhcnos_cod = snomed_code %in% cmhcnos_cod$code,
    ocd_cod = snomed_code %in% ocd_cod$code,
    depression_cod = snomed_code %in% depression_cod$code,
    pd_cod = snomed_code %in% pd_cod$code,
    phobia_cod = snomed_code %in% phobia_cod$code,
    ptsd_cod = snomed_code %in% ptsd_cod$code
    ) |> 
  pivot_longer(
    cols = c(
      gad_cod,
      cmhcnos_cod,
      ocd_cod,
      depression_cod,
      pd_cod,
      phobia_cod,
      ptsd_cod
    ),
    names_to = "codelist") |> 
  filter(value == TRUE) |> 
  group_by(end_date, codelist) |> 
  summarise(count = sum(usage, na.rm = TRUE))

fig_amps_cod_trends <- amps_cod_usage |> 
  mutate(codelist = factor(
    codelist,
    levels = c(
      "gad_cod",
      "cmhcnos_cod",
      "ocd_cod",
      "depression_cod",
      "pd_cod",
      "phobia_cod",
      "ptsd_cod"
    ),
    labels = c(
      "GAD",
      "CMHC-NOS",
      "OCD",
      "Depression",
      "PD",
      "Phobia",
      "PTSD"
    ))) |> 
  ggplot(
      aes(
        y = count,
        x = end_date,
        colour = codelist,
        shape = codelist
      )
    ) +
    geom_line(alpha = 0.4) +
    geom_point(size = 2) +
    labs(
      title = "Yearly counts of diagnoistic codes following AMPS methods",
      x = NULL,
      y = NULL,
      colour = NULL,
      shape = NULL,
      caption = "Data from NHS England SNOMED Code Usage in Primary Care."
    ) +
    scale_x_date(
      date_breaks = "1 year",
      labels = label_date_short()
    ) +
    scale_y_continuous(
      labels = label_number(accuracy = 1),
      limits = c(0, NA)
    ) +
    theme_bw() +
    theme(legend.position = "bottom") +
    scale_color_okabe_ito()

ggsave(
  filename = here("output", "figures", "cod_devel", "dx", "fig_amps_cod_trends.png"),
  fig_amps_cod_trends,
  height = 4,
  width = 8
)

fig_amps_cod_trends
Show the code
fig_amps_cod_trends_zoom <- fig_amps_cod_trends +
    facet_zoom(ylim = c(30000, 200000), zoom.size = 3) +
    scale_x_date(
      breaks = c(
        as.Date("2012-07-31"),
        as.Date("2016-01-01"),
        as.Date("2020-01-01"),
        as.Date("2024-07-31")
      ),
      labels = label_date("%Y")
    )

ggsave(
  filename = here("output", "figures", "cod_devel", "dx", "fig_amps_cod_trends_zoom.png"),
  fig_amps_cod_trends_zoom,
  height = 4,
  width = 8
)

fig_amps_cod_trends_zoom

Analysis of individual codes

Show the code
gad_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% gad_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_gad_cod_counts <- gad_cod_counts |>
  create_table_sem_tag(
    title = md("Generalised Anxiety Disorder"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_gad_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_gad_usage.png")
  )

tab_gad_cod_counts
Generalised Anxiety Disorder
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
21897009 Generalized anxiety disorder 1,493,400 100.000%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
cmhcnos_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% cmhcnos_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_cmhcnos_cod_counts <- cmhcnos_cod_counts |>
  create_table_sem_tag(
    title = md("CMHC-NOS diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_cmhcnos_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_cmhcnos_cod_usage.png")
  )

tab_cmhcnos_cod_counts
CMHC-NOS diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
231504006 Mixed anxiety and depressive disorder 20,659,770 100.000%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
ocd_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% ocd_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_ocd_cod_counts <- ocd_cod_counts |>
  create_table_sem_tag(
    title = md("Obsessive-compulsive disorder diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_ocd_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_ocd_cod_usage.png")
  )

tab_ocd_cod_counts
Obsessive-compulsive disorder diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
191736004 Obsessive-compulsive disorder 889,580 96.476%
83482000 Body dysmorphic disorder 32,490 3.524%
723913009 Olfactory reference disorder 5 0.001%
Data scource: NHS England SNOMED Usage in Primary Care.
  • ICD-10 codes: F32.00 (Mild depressive episode without somatic symptoms) and F32.01 (Mild depressive episode with somatic symptoms) were grouped to produce mild depressive episode (i.e. with or without somatic symptoms). F32.10 (Moderate depressive episode without somatic symptoms) and F32.11 (Moderate depressive episode with somatic symptoms) were similarly grouped to produce moderate depressive episode. Mild depressive episode, moderate depressive episode and severe depressive episode were then combined to produce the final category of depressive episode.
  • OpenCodelists: Depression diagnostic codes
Show the code
depression_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% depression_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_depression_cod_counts <- depression_cod_counts |>
  create_table_sem_tag(
    title = md("Depression diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_depression_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_depression_cod_usage.png")
  )

tab_depression_cod_counts
Depression diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
35489007 Depressive disorder 20,623,000 74.271%
310496002 Moderate depression 1,098,060 3.955%
87414006 Reactive depression (situational) 1,042,110 3.753%
191616006 Recurrent depression 990,730 3.568%
58703003 Postpartum depression 764,080 2.752%
310495003 Mild depression 434,190 1.564%
192080009 Chronic depression 357,170 1.286%
310497006 Severe depression 287,310 1.035%
300706003 Endogenous depression 251,490 0.906%
36923009 Major depression, single episode 217,360 0.783%
78667006 Dysthymia 171,700 0.618%
83458005 Agitated depression 158,640 0.571%
274948002 Endogenous depression - recurrent 134,630 0.485%
191604000 Single major depressive episode, severe, with psychosis 122,470 0.441%
231499006 Endogenous depression first episode 96,870 0.349%
268621008 Recurrent major depressive episodes 68,420 0.246%
73867007 Severe major depression with psychotic features 54,090 0.195%
247803002 Seasonal affective disorder 51,760 0.186%
Finding
871840004 Episode of depression 269,510 0.971%
Situation
473126001 Suspected depressive disorder 162,930 0.587%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
pd_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% pd_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_pd_cod_counts <- pd_cod_counts |>
  create_table_sem_tag(
    title = md("Panic Disorder (PD) diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_pd_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_pd_cod_usage.png")
  )

tab_pd_cod_counts
Panic Disorder (PD) diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
371631005 Panic disorder 580,480 99.212%
192037000 Acute panic state due to acute stress reaction 4,190 0.716%
56576003 Panic disorder without agoraphobia 230 0.039%
89948007 Panic disorder with agoraphobia AND mild panic attacks 35 0.006%
35607004 Panic disorder with agoraphobia 25 0.004%
43150009 Panic disorder without agoraphobia with severe panic attacks 25 0.004%
65064003 Panic disorder without agoraphobia with moderate panic attacks 20 0.003%
72861004 Panic disorder without agoraphobia with mild panic attacks 20 0.003%
5509004 Panic disorder with agoraphobia AND severe panic attacks 15 0.003%
53956006 Panic disorder without agoraphobia with panic attacks in partial remission 10 0.002%
61212007 Panic disorder with agoraphobia, severe agoraphobic avoidance AND severe panic attacks 10 0.002%
8185002 Panic disorder with agoraphobia AND moderate panic attacks 10 0.002%
11941006 Panic disorder with agoraphobia, agoraphobic avoidance in full remission AND panic attacks in full remission 5 0.001%
82494000 Panic disorder without agoraphobia with panic attacks in full remission 5 0.001%
82738004 Panic disorder with agoraphobia, moderate agoraphobic avoidance AND moderate panic attacks 5 0.001%
83631006 Panic disorder with agoraphobia, moderate agoraphobic avoidance AND severe panic attacks 5 0.001%
Data scource: NHS England SNOMED Usage in Primary Care.
  • ICD-10 codes: F40.00 (Agoraphobia without panic disorder), F40.01 (Agoraphobia with panic disorder), F40.1 (Social phobias), and F40.2 (Specific (isolated) phobias), were combined into one category of phobia.
  • OpenCodelists: Phobia diagnostic codes
Show the code
phobia_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% phobia_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_phobia_cod_counts <- phobia_cod_counts |>
  create_table_sem_tag(
    title = md("Phobia diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_phobia_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_phobia_cod_usage.png")
  )

tab_phobia_cod_counts
Phobia diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
191722009 Agoraphobia with panic attacks 121,340 23.533%
386810004 Phobic disorder 114,790 22.262%
70691001 Agoraphobia 104,740 20.313%
25501002 Social phobia 82,920 16.081%
54587008 Simple phobia 20,330 3.943%
61569007 Agoraphobia without history of panic disorder 5,110 0.991%
191725006 Social phobia, fear of public speaking 3,250 0.630%
191724005 Social phobia, fear of eating in public 1,230 0.239%
191726007 Social phobia, fear of public washing 130 0.025%
89948007 Panic disorder with agoraphobia AND mild panic attacks 35 0.007%
35607004 Panic disorder with agoraphobia 25 0.005%
5509004 Panic disorder with agoraphobia AND severe panic attacks 15 0.003%
61212007 Panic disorder with agoraphobia, severe agoraphobic avoidance AND severe panic attacks 10 0.002%
8185002 Panic disorder with agoraphobia AND moderate panic attacks 10 0.002%
11941006 Panic disorder with agoraphobia, agoraphobic avoidance in full remission AND panic attacks in full remission 5 0.001%
238965007 Venereophobia 5 0.001%
82738004 Panic disorder with agoraphobia, moderate agoraphobic avoidance AND moderate panic attacks 5 0.001%
83631006 Panic disorder with agoraphobia, moderate agoraphobic avoidance AND severe panic attacks 5 0.001%
Finding
19887002 Claustrophobia 53,010 10.281%
54307006 Zoophobia 7,460 1.447%
58963008 Acrophobia 850 0.165%
280947008 Examination phobia 340 0.066%
102916005 Arachnophobia 10 0.002%
Data scource: NHS England SNOMED Usage in Primary Care.
  • ICD-10 codes: F43.1 (Post-traumatic stress disorder), assessed using DSM-IV symptoms of PTSD.
  • OpenCodelists: PTSD diagnostic codes
Show the code
ptsd_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% ptsd_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_ptsd_cod_counts <- ptsd_cod_counts |>
  create_table_sem_tag(
    title = md("Posttraumatic Stress Disorder (PTSD) diagnosis codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_ptsd_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_ptsd_cod_usage.png")
  )

tab_ptsd_cod_counts
Posttraumatic Stress Disorder (PTSD) diagnosis codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
47505003 Posttraumatic stress disorder 1,197,030 97.856%
192042008 Acute post-trauma stress state 9,290 0.759%
443919007 Complex posttraumatic stress disorder 8,810 0.720%
313182004 Chronic post-traumatic stress disorder 4,080 0.334%
699241002 Chronic post-traumatic stress disorder following military combat 2,500 0.204%
446180007 Delayed posttraumatic stress disorder following military combat 760 0.062%
446175003 Acute posttraumatic stress disorder following military combat 710 0.058%
620181000000106 Other post-traumatic stress disorder 50 0.004%
318784009 Posttraumatic stress disorder, delayed onset 25 0.002%
Data scource: NHS England SNOMED Usage in Primary Care.

Resolved

Analysis of codelists

Show the code
amps_res_cod_usage <- snomed_usage |> 
  mutate(
    anxiety_resolved = snomed_code %in% anxiety_resolved_cod$code,
    pd_resolved = snomed_code %in% pd_resolved_cod$code,
    depression_resolved = snomed_code %in% depression_resolved_cod$code,
    ) |> 
  pivot_longer(
    cols = c(
      anxiety_resolved,
      pd_resolved,
      depression_resolved
    ),
    names_to = "codelist") |> 
  filter(value == TRUE) |> 
  group_by(end_date, codelist) |> 
  summarise(count = sum(usage, na.rm = TRUE))

fig_amps_res_cod_trends <- amps_res_cod_usage |> 
  mutate(codelist = factor(
    codelist,
    levels = c(
      "anxiety_resolved",
      "pd_resolved",
      "depression_resolved"
    ),
    labels = c(
      "Anxiety disorder resolved",
      "Panic disorder resolved",
      "Depression resolved"
    ))) |> 
  ggplot(
      aes(
        y = count,
        x = end_date,
        colour = codelist,
        shape = codelist
      )
    ) +
    geom_line(alpha = 0.4) +
    geom_point(size = 2) +
    labs(
      title = "Yearly counts of resolved codes following AMPS methods",
      x = NULL,
      y = NULL,
      colour = NULL,
      shape = NULL,
      caption = "Data from NHS England SNOMED Code Usage in Primary Care."
    ) +
    scale_x_date(
      date_breaks = "1 year",
      labels = label_date_short()
    ) +
    scale_y_continuous(
      labels = label_number(accuracy = 1),
      limits = c(0, NA)
    ) +
    theme_bw() +
    theme(legend.position = "bottom") +
    scale_color_okabe_ito()

ggsave(
  filename = here("output", "figures", "cod_devel", "dx", "fig_amps_res_cod_trends.png"),
  fig_amps_res_cod_trends,
  height = 4,
  width = 8
)

fig_amps_res_cod_trends

Analysis of individual codes

Show the code
anxiety_res_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% anxiety_resolved_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_anxiety_res_cod_counts <- anxiety_res_cod_counts |>
  create_table_sem_tag(
    title = md("Anxiety disorder resolved codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_anxiety_res_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_anxiety_res_usage.png")
  )

tab_anxiety_res_cod_counts
Anxiety disorder resolved codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Finding
1037391000000102 Anxiety resolved 3,755 100.000%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
depression_res_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% depression_resolved_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_depression_res_cod_counts <- depression_res_cod_counts |>
  create_table_sem_tag(
    title = md("Depression dignosis resolved or full remission codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_depression_res_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_depression_res_cod_usage.png")
  )

tab_depression_res_cod_counts
Depression dignosis resolved or full remission codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Finding
196381000000100 Depression resolved 440,010 99.568%
Disorder
46244001 Recurrent major depression in full remission 800 0.181%
19527009 Single episode of major depression in full remission 760 0.172%
68019004 Recurrent major depression in remission 260 0.059%
16265061000119105 Recurrent major depressive disorder co-occurrent with anxiety in full remission 45 0.010%
63412003 Major depression in full remission 45 0.010%
Data scource: NHS England SNOMED Usage in Primary Care.
Show the code
pd_res_cod_counts <- snomed_usage |> 
  filter(snomed_code %in% pd_resolved_cod$code) |> 
  get_semantic_tag() |> 
  summarise_code_counts() |> 
  slice_max(n = 20, order_by = usage)

# Display formatted table
tab_pd_res_cod_counts <- pd_res_cod_counts |>
  create_table_sem_tag(
    title = md("Panic disorder resolved or full remission codes"),
    subtitle = "Timeframe: August 2011 to July 2024"
    )

gtsave(
  tab_pd_res_cod_counts,
  here("output", "tables", "cod_devel", "dx", "tab_pd_res_cod_usage.png")
  )

tab_pd_res_cod_counts
Panic disorder resolved or full remission codes
Timeframe: August 2011 to July 2024
SNOMED code Description Usage %
Disorder
11941006 Panic disorder with agoraphobia, agoraphobic avoidance in full remission AND panic attacks in full remission 5 50.000%
82494000 Panic disorder without agoraphobia with panic attacks in full remission 5 50.000%
Data scource: NHS England SNOMED Usage in Primary Care.