Child and Adolescent Mental Health Service (CAMHS) Referrals Open Data for Scotland

A summary analysis of trends 2015-2021 with specific focus on NHS Grampian

William Patrick Ball https://wpball.com (Aberdeen Centre for Health Data Science, University of Aberdeen, Scotland)https://www.abdn.ac.uk/achds/
2022-06-10

Summary

This work provides a basic summary of trends in open data relating to CAMHS referrals in NHS Grampian and wider Scotland.

Note about code

If you want to replicate or expand on anything I’ve done on this page you can copy the code snippets below.

Show code
library(tidyverse)
library(janitor) # clean_names
library(tidylog) # logging of tidyverse functions
library(vroom) # loading data
library(lubridate) # for easy date manipulation
library(lemon) # for facet_rep_wrap
library(scales)
library(gt)

CAMHS Referral Data

We are looking at monthly counts of referrals to CAMHS by Health Board. Data comes from the Public Health Scotland Open Data portal. This goes back to 2012, but we are looking specifically at the period between January 2015 and the end of 2021.

Show code
lookup <- vroom("https://www.opendata.nhs.scot/dataset/9f942fdb-e59e-44f5-b534-d6e17229cc7b/resource/652ff726-e676-4a20-abda-435b98dd7bdc/download/hb14_hb19.csv") %>% 
  clean_names() %>% 
  select(hb, hb_name)

refs <- vroom("https://www.opendata.nhs.scot/dataset/f9bab568-501e-49d3-a0a4-0b9a7578b0de/resource/d31d8e7c-fbcb-4e4b-a6a1-3b9c4f3b14a0/download/camhs-referrals.csv") %>% 
  clean_names() %>% 
  left_join(lookup, by = "hb") %>% 
  mutate(month = ym(month),
         year = year(month),
         hb_name = replace_na(hb_name, "Scotland")) %>% 
  filter(year >= "2015")

rm(lookup)

Referral counts

Here we see that annual CAMHS referrals in NHS Grampian have been reasonably stable until 2020 which was impacted by the first UK COVID-19 Lockdown when referrals dropped dramatically. The annual totals for the whole of Scotland increased each year until 2020. The monthly picture highlights where the drop in 2020 came (the dashed line indicates the start of lockdown) and how much of an increase there has been since.

Show code
# Set theme
theme_set(theme_classic())
theme_update(panel.grid.major.y = element_line(),
             plot.title.position = "plot",
             plot.caption.position = "plot",
             strip.background = element_blank(),
             legend.box.background = element_rect(fill = "transparent", colour = NA),
             legend.background = element_rect(fill = "transparent", colour = NA))

# By year for Scotland and NHS Grampian
refs %>% 
  filter(hb_name %in% c("NHS Grampian", "Scotland")) %>% 
  group_by(year, hb_name) %>% 
  summarise(referrals = sum(referrals_received)) %>% 
  ggplot(aes(x = year, y = referrals)) +
  geom_bar(fill = "firebrick", stat = "identity") +
  scale_x_continuous(breaks = seq(2015,2021,1), guide = guide_axis(angle = 45)) +
  scale_y_continuous(limits = c(0,NA), breaks = pretty_breaks(6), label = comma_format(accuracy = 1)) +
  labs(x = "", y = "Referrals\n") +
  facet_rep_wrap(~ hb_name, scales = "free_y", repeat.tick.labels = F)+
  theme(text = element_text(size = 8))
Show code
refs %>% 
  filter(hb_name %in% c("NHS Grampian", "Scotland")) %>% 
  group_by(month, hb_name) %>% 
  summarise(referrals = sum(referrals_received)) %>% 
  ggplot(aes(x = month, y = referrals)) +
  geom_vline(xintercept = as.numeric(as_date("2020-03-26")), colour = "black", linetype = "dashed") +
  geom_point(size = .7, color = "firebrick") +
  scale_x_date(date_breaks = "year", date_labels = "%Y", guide = guide_axis(angle = 45)) +
  scale_y_continuous(limits = c(0,NA), breaks = pretty_breaks(6), label = comma_format(accuracy = 1)) +
  labs(x = "", y = "Referrals\n") +
  facet_rep_wrap(~ hb_name, scales = "free_y", repeat.tick.labels = F)+
  theme(text = element_text(size = 8))

Change over time

The table below quantifies change in referrals from 2015 to 2021 for each health board in Scotland. We can see that most saw an increase, although not all and the scale of that increase varies. NHS Grampian saw the 3rd largest increase in Scotland which was above the average of all health boards.

Show code
# Change
refs %>% 
  group_by(year, hb_name) %>% 
  summarise(referrals = sum(referrals_received)) %>% 
  ungroup() %>% 
  filter(year %in% c("2015", "2021")) %>% 
  group_by(hb_name) %>% 
  summarise(refs_2015 = referrals[year == 2015],
            refs_2021 = referrals[year == 2021],
            change = (refs_2021 - refs_2015) / refs_2015) %>% 
  arrange(desc(change)) %>% 
  filter(!is.na(change)) %>%
  mutate(change = percent(change, accuracy = .1)) %>% 
  gt() %>%  
  tab_spanner(
    label = "Referrals",
    columns = c(refs_2015, refs_2021)) %>% 
  cols_label(
    hb_name = "Health Board",
    refs_2015 = "2015",
    refs_2021 = "2021",
    change = "Change"
  ) %>% 
  fmt_number(
    columns = c(refs_2015, refs_2021),
    decimals = 0,
    sep_mark = ","
  ) %>%
  cols_width(
    c(refs_2015, refs_2021, change) ~ px(150)) %>% 
  cols_align(
    align = "right",
    columns = change
  )
Health Board Referrals Change
2015 2021
NHS Fife 2,203 3,178 44.3%
NHS Lanarkshire 3,129 3,826 22.3%
NHS Grampian 3,083 3,738 21.2%
NHS Western Isles 139 164 18.0%
Scotland 30,531 35,978 17.8%
NHS Dumfries and Galloway 1,084 1,261 16.3%
NHS Lothian 6,138 6,989 13.9%
NHS Ayrshire and Arran 1,951 2,131 9.2%
NHS Greater Glasgow and Clyde 7,618 8,299 8.9%
NHS Borders 664 696 4.8%
NHS Forth Valley 1,672 1,649 -1.4%
NHS Tayside 2,368 2,076 -12.3%

The rest of Scotland

As you can see from the table above, there is a mixed picture in other health boards around the country. Nearly all of the health boards saw increases in referrals but these ranged from just under 5% to nearly 45%. Looking just at these annual totals hides part of what has happened. There are various patterns around Scotland both before and after the impact of COVID. Worryingly there appears to have been a background trend for growing numbers of referrals which in many places has accelerated after the impacts of early 2020 COVID-19 lockdown.

Show code
# Monthly by HB
refs %>%
  ggplot(aes(x = month, y = referrals_received)) +
  geom_vline(xintercept = as.numeric(as_date("2020-03-26")), colour = "black", linetype = "dashed") +
  geom_point(size = .5, color = "firebrick") +
  scale_x_date(date_breaks = "year", date_labels = "%Y", guide = guide_axis(angle = 45)) +
  scale_y_continuous(limits = c(0,NA), breaks = pretty_breaks(6), label = comma_format(accuracy = 1)) +
  labs(x = "", y = "Referrals\n") +
  facet_rep_wrap(~ hb_name, scales = "free_y", repeat.tick.labels = T, nrow = 5, labeller = labeller(hb_name = label_wrap_gen(20)))+
  theme(strip.text.x = element_text(size = 6),
        text = element_text(size = 6))

Acknowledgments

The data used for this analysis was provided as Open Data by Public Health Scotland under the UK Open Government License. The code was written in R using Distill for R Markdown in RStudio.

Licensing

This code is licensed under a CC-BY-NC-ND 4.0 License

Citation

For attribution, please cite this work as

Ball (2022, June 10). Child and Adolescent Mental Health Service (CAMHS) Referrals Open Data for Scotland. Retrieved from https://will-ball.github.io/camhs_summary/

BibTeX citation

@misc{ball2022child,
  author = {Ball, William Patrick},
  title = {Child and Adolescent Mental Health Service (CAMHS) Referrals Open Data for Scotland},
  url = {https://will-ball.github.io/camhs_summary/},
  year = {2022}
}