From 6f84fabff3cc7570b0d7f637dd1f3f538a947cbe Mon Sep 17 00:00:00 2001 From: Chris Beeley Date: Tue, 20 Feb 2024 19:10:52 +0000 Subject: [PATCH 1/2] Copy HTML to docs/ --- docs/QA-markdown.html | 8970 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 8970 insertions(+) create mode 100644 docs/QA-markdown.html diff --git a/docs/QA-markdown.html b/docs/QA-markdown.html new file mode 100644 index 0000000..ada2eaa --- /dev/null +++ b/docs/QA-markdown.html @@ -0,0 +1,8970 @@ + + + + + + + + + + + + + + + +Networked Data Lab long chart on children and young people’s mental health + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
#Subsample of metrics from MHSDS data
+CAMHS_data <- MHSDS_main_pooled_dashboard %>%
+  filter(PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("CYP01","MHS61a","CYP23","MHS30d","MHS32a","CYP32")) %>%
+  filter(.,!(MEASURE_ID=="MHS32a"&BREAKDOWN!="England")) %>% 
+  mutate(MEASURE_KEY=case_when(
+           MEASURE_ID=="MHS30d" ~ "Attended contacts (<18)",
+           MEASURE_ID=="CYP01" ~ "People in contact",
+           MEASURE_ID=="MHS61a" ~ "First contacts (<18)",
+           MEASURE_ID=="CYP23" ~ "Open referrals",
+           MEASURE_ID=="MHS32a" ~ "New referrals (<18)",
+           MEASURE_ID=="CYP32" ~ "New referrals to CYPMHS",
+           TRUE ~ "NA"
+         )) %>% 
+  select(.,start_date,end_date,month_year,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         timing=ifelse(start_date<ymd("2020-04-01"),"Pre-COVID","Post-COVID"),
+         month_num=lubridate::month(start_date)) %>%
+  mutate(.,timing=fct_relevel(timing, c("Pre-COVID","Post-COVID"))) %>% 
+  arrange(.,start_date) %>%
+  as_tibble()
+
+#Percentage change compared to a year ago
+#For example, for March 2020 show the % change between March 2019 and March 2020
+
+CAMHS_yearly_changes <- CAMHS_data %>%
+  select(.,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE,start_date,month_year,timing) %>%
+  mutate(start_date=lubridate::ymd(start_date)) %>%
+  mutate(.,start_date_l1=start_date-years(1)) #Adds a new column with the month a year before
+
+#Auxiliary dataset with data points from a year before
+CAMHS_data_l1 <- CAMHS_yearly_changes %>%
+  select(.,start_date,MEASURE_VALUE,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY) %>%
+  rename(.,MEASURE_VALUE_l1=MEASURE_VALUE,start_date_l1=start_date)
+
+#Merge auxiliary data back in
+CAMHS_yearly_changes <- left_join(CAMHS_yearly_changes,
+                                          CAMHS_data_l1,
+                                          by=c("start_date_l1","PRIMARY_LEVEL_DESCRIPTION","MEASURE_ID","MEASURE_KEY")) %>%
+  arrange(.,MEASURE_ID,start_date) %>%
+  mutate(pct_change_l1=(MEASURE_VALUE-MEASURE_VALUE_l1)/MEASURE_VALUE_l1*100) %>%
+  filter(.,!is.na(pct_change_l1))
+rm(CAMHS_data_l1)
+
flourish_data_mhsds <- CAMHS_data %>%
+  filter(.,MEASURE_ID %in% c("CYP01","MHS61a","CYP23","MHS32a")) %>%
+  select(.,start_date,end_date,month_year,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>%
+  mutate(.,month=lubridate::month(start_date, label = TRUE),
+         year=lubridate::year(start_date)) %>%
+  select(.,month,year,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>%
+  pivot_wider(.,
+    names_from = year,
+    names_sep = ".",
+    values_from = c(MEASURE_VALUE)
+  ) %>%
+  arrange(.,MEASURE_ID,month)
+
+#fwrite(flourish_data_mhsds,paste0(onedrive_charts_data,"Fig2alt.csv"))
+
+

Performance against 18 week target in Scottish CAMHS

+
    +
  • Measure code: TotalPatientsSeen and NumberOfPatientsSeen0To18Weeks
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_18wks <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("TotalPatientsSeen","NumberOfPatientsSeen0To18Weeks"),
+         HB=="S92000003") %>%
+  pivot_wider(names_from = Metric,
+              names_sep = ".",
+              values_from = c(Count)) %>%
+  mutate(.,pct_within_18wks=as.numeric(NumberOfPatientsSeen0To18Weeks)/
+           as.numeric(TotalPatientsSeen)*100,
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_18wks_chart <- CAMHS_Scotland_18wks %>% 
+  ggplot(., aes(x=year_month, y=pct_within_18wks)) +
+  geom_line(size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma, limits=c(0,100)) +
+  geom_hline(yintercept=90, linetype="dashed", color = "red") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_18wks_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_18wks %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ ++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthyearmonthyear_monthTotalPatientsSeenNumberOfPatientsSeen0To18Weekspct_within_18wks
S92000003201,2072,01272012-07-0175161181.35819
S92000003201,2082,01282012-08-0184065377.73810
S92000003201,2092,01292012-09-0180763378.43866
S92000003201,2102,012102012-10-01108385879.22438
S92000003201,2112,012112012-11-011236102382.76699
S92000003201,2122,012122012-12-0184770783.47107
S92000003201,3012,01312013-01-01119098682.85714
S92000003201,3022,01322013-02-011264107785.20570
S92000003201,3032,01332013-03-01105793388.26869
S92000003201,3042,01342013-04-01115399386.12316
S92000003201,3052,01352013-05-011273109385.86017
S92000003201,3062,01362013-06-01102488586.42578
S92000003201,3072,01372013-07-0199784784.95486
S92000003201,3082,01382013-08-0197678880.73770
S92000003201,3092,01392013-09-0198384085.45270
S92000003201,3102,013102013-10-01118099183.98305
S92000003201,3112,013112013-11-01124198379.21031
S92000003201,3122,013122013-12-0190977385.03850
S92000003201,4012,01412014-01-011342112683.90462
S92000003201,4022,01422014-02-011277105582.61551
S92000003201,4032,01432014-03-01111494985.18851
S92000003201,4042,01442014-04-01115396583.69471
S92000003201,4052,01452014-05-011359112983.07579
S92000003201,4062,01462014-06-01104883179.29389
S92000003201,4072,01472014-07-0199379580.06042
S92000003201,4082,01482014-08-0199776476.62989
S92000003201,4092,01492014-09-011333103677.71943
S92000003201,4102,014102014-10-011442111177.04577
S92000003201,4112,014112014-11-011464114077.86885
S92000003201,4122,014122014-12-011266104082.14850
S92000003201,5012,01512015-01-011466115578.78581
S92000003201,5022,01522015-02-011391106976.85119
S92000003201,5032,01532015-03-011412114581.09065
S92000003201,5042,01542015-04-011445113478.47751
S92000003201,5052,01552015-05-011476112075.88076
S92000003201,5062,01562015-06-011542117075.87549
S92000003201,5072,01572015-07-011415107275.75972
S92000003201,5082,01582015-08-01133596572.28464
S92000003201,5092,01592015-09-011489106071.18872
S92000003201,5102,015102015-10-011534111472.62060
S92000003201,5112,015112015-11-011680124373.98810
S92000003201,5122,015122015-12-011291107783.42370
S92000003201,6012,01612016-01-011416120084.74576
S92000003201,6022,01622016-02-011516128284.56464
S92000003201,6032,01632016-03-011564131383.95141
S92000003201,6042,01642016-04-011494121181.05756
S92000003201,6052,01652016-05-011636122474.81663
S92000003201,6062,01662016-06-011606124677.58406
S92000003201,6072,01672016-07-01120494678.57143
S92000003201,6082,01682016-08-011512117577.71164
S92000003201,6092,01692016-09-011444115079.63989
S92000003201,6102,016102016-10-011411117383.13253
S92000003201,6112,016112016-11-011665131979.21922
S92000003201,6122,016122016-12-011277109986.06108
S92000003201,7012,01712017-01-011307110284.31523
S92000003201,7022,01722017-02-011468121182.49319
S92000003201,7032,01732017-03-011558130883.95379
S92000003201,7042,01742017-04-01115793380.63959
S92000003201,7052,01752017-05-011550125681.03226
S92000003201,7062,01762017-06-011385111580.50542
S92000003201,7072,01772017-07-01100877777.08333
S92000003201,7082,01782017-08-01129993071.59353
S92000003201,7092,01792017-09-01110579171.58371
S92000003201,7102,017102017-10-01126389771.02138
S92000003201,7112,017112017-11-011656114369.02174
S92000003201,7122,017122017-12-01110882474.36823
S92000003201,8012,01812018-01-01136798972.34821
S92000003201,8022,01822018-02-01131893070.56146
S92000003201,8032,01832018-03-01131092170.30534
S92000003201,8042,01842018-04-01145195765.95451
S92000003201,8052,01852018-05-011712114666.93925
S92000003201,8062,01862018-06-011531106769.69301
S92000003201,8072,01872018-07-01131492370.24353
S92000003201,8082,01882018-08-011548102766.34367
S92000003201,8092,01892018-09-01137797370.66086
S92000003201,8102,018102018-10-011630118972.94479
S92000003201,8112,018112018-11-011662113568.29122
S92000003201,8122,018122018-12-01123196778.55402
S92000003201,9012,01912019-01-011493107672.06966
S92000003201,9022,01922019-02-011414103873.40877
S92000003201,9032,01932019-03-011330100675.63910
S92000003201,9042,01942019-04-01138495769.14740
S92000003201,9052,01952019-05-011453100969.44253
S92000003201,9062,01962019-06-01117583470.97872
S92000003201,9072,01972019-07-01126279262.75753
S92000003201,9082,01982019-08-01133385063.76594
S92000003201,9092,01992019-09-01130787566.94721
S92000003201,9102,019102019-10-01137489064.77438
S92000003201,9112,019112019-11-01143792264.16145
S92000003201,9122,019122019-12-01107376771.48183
S92000003202,0012,02012020-01-01139994567.54825
S92000003202,0022,02022020-02-01144895766.09116
S92000003202,0032,02032020-03-01128484866.04361
S92000003202,0042,02042020-04-0195572475.81152
S92000003202,0052,02052020-05-01123874660.25848
S92000003202,0062,02062020-06-01135572053.13653
S92000003202,0072,02072020-07-01129775157.90285
S92000003202,0082,02082020-08-01124971457.16573
S92000003202,0092,02092020-09-01148697965.88156
S92000003202,0102,020102020-10-01130996173.41482
S92000003202,0112,020112020-11-011511110272.93183
S92000003202,0122,020122020-12-01127192772.93470
S92000003202,1012,02112021-01-01127590170.66667
S92000003202,1022,02122021-02-01131598674.98099
S92000003202,1032,02132021-03-011506107971.64675
S92000003202,1042,02142021-04-011533109371.29811
S92000003202,1052,02152021-05-011530109971.83007
S92000003202,1062,02162021-06-011489111474.81531
S92000003202,1072,02172021-07-01120391375.89360
S92000003202,1082,02182021-08-01125296977.39617
S92000003202,1092,02192021-09-011337109882.12416
S92000003202,1102,021102021-10-011440102971.45833
S92000003202,1112,021112021-11-011749123370.49743
S92000003202,1122,021122021-12-01135593368.85609
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_18wks %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(year) %>%
+  summarise(average=mean(pct_within_18wks,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
yearaveragemonths_included
201384.5098112
201480.7704912
201576.3522412
201680.9213212
201777.3009512
201870.2366612
201968.7145412
202065.7600912
202173.4553012
+
+
+
+

People still receiving treatment in Scottish CAMHS

+
    +
  • Measure code: OpenCases
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_open <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("OpenCases"),
+         HB=="S92000003") %>%
+  mutate(.,Count=as.numeric(Count),
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_open_chart <- CAMHS_Scotland_open %>% 
+  ggplot(., aes(x=year_month, y=Count, group= Metric)) +
+  geom_line(aes(color= Metric),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_open_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_open %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthMetricCountyearmonthyear_month
S92000003201,901OpenCases27,9362,01912019-01-01
S92000003201,902OpenCases27,0772,01922019-02-01
S92000003201,903OpenCases27,3322,01932019-03-01
S92000003201,904OpenCases27,2172,01942019-04-01
S92000003201,905OpenCases26,0062,01952019-05-01
S92000003201,906OpenCases25,6752,01962019-06-01
S92000003201,907OpenCases25,4962,01972019-07-01
S92000003201,908OpenCases28,7022,01982019-08-01
S92000003201,909OpenCases29,3262,01992019-09-01
S92000003201,910OpenCases30,2332,019102019-10-01
S92000003201,911OpenCases30,7442,019112019-11-01
S92000003201,912OpenCases30,4312,019122019-12-01
S92000003202,001OpenCases31,2462,02012020-01-01
S92000003202,002OpenCases30,8362,02022020-02-01
S92000003202,003OpenCases29,5042,02032020-03-01
S92000003202,004OpenCases28,9852,02042020-04-01
S92000003202,005OpenCases28,8192,02052020-05-01
S92000003202,006OpenCases28,6622,02062020-06-01
S92000003202,007OpenCases27,9812,02072020-07-01
S92000003202,008OpenCases28,0562,02082020-08-01
S92000003202,009OpenCases28,3022,02092020-09-01
S92000003202,010OpenCases28,4252,020102020-10-01
S92000003202,011OpenCases29,0292,020112020-11-01
S92000003202,012OpenCases28,7712,020122020-12-01
S92000003202,101OpenCases28,7672,02112021-01-01
S92000003202,102OpenCases28,8832,02122021-02-01
S92000003202,103OpenCases28,9952,02132021-03-01
S92000003202,104OpenCases28,9272,02142021-04-01
S92000003202,105OpenCases29,7502,02152021-05-01
S92000003202,106OpenCases28,9882,02162021-06-01
S92000003202,107OpenCases28,2092,02172021-07-01
S92000003202,108OpenCases28,1562,02182021-08-01
S92000003202,109OpenCases28,3102,02192021-09-01
S92000003202,110OpenCases28,5362,021102021-10-01
S92000003202,111OpenCases29,1272,021112021-11-01
S92000003202,112OpenCases26,0322,021122021-12-01
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_open %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(Metric,year) %>%
+  summarise(average=mean(Count,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Metricyearaveragemonths_included
OpenCases201928014.5812
OpenCases202029051.3312
OpenCases202128556.6712
+
+
+
+

People waiting for treatment in Scottish CAMHS

+
    +
  • Measure code: TotalPatientsWaiting
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_waiting <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("TotalPatientsWaiting"),
+         HB=="S92000003") %>%
+  mutate(.,Count=as.numeric(Count),
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_waiting_chart <- CAMHS_Scotland_waiting %>% 
+  ggplot(., aes(x=year_month, y=Count, group= Metric)) +
+  geom_line(aes(color= Metric),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_waiting_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_waiting %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthMetricCountyearmonthyear_month
S92000003201,207TotalPatientsWaiting3,6382,01272012-07-01
S92000003201,208TotalPatientsWaiting3,1962,01282012-08-01
S92000003201,209TotalPatientsWaiting3,3692,01292012-09-01
S92000003201,210TotalPatientsWaiting3,8202,012102012-10-01
S92000003201,211TotalPatientsWaiting3,9662,012112012-11-01
S92000003201,212TotalPatientsWaiting4,1472,012122012-12-01
S92000003201,301TotalPatientsWaiting4,0552,01312013-01-01
S92000003201,302TotalPatientsWaiting4,1812,01322013-02-01
S92000003201,303TotalPatientsWaiting4,5842,01332013-03-01
S92000003201,304TotalPatientsWaiting4,3322,01342013-04-01
S92000003201,305TotalPatientsWaiting4,3932,01352013-05-01
S92000003201,306TotalPatientsWaiting4,7702,01362013-06-01
S92000003201,307TotalPatientsWaiting4,5462,01372013-07-01
S92000003201,308TotalPatientsWaiting4,3912,01382013-08-01
S92000003201,309TotalPatientsWaiting4,8182,01392013-09-01
S92000003201,310TotalPatientsWaiting5,6412,013102013-10-01
S92000003201,311TotalPatientsWaiting5,9002,013112013-11-01
S92000003201,312TotalPatientsWaiting6,4052,013122013-12-01
S92000003201,401TotalPatientsWaiting6,6062,01412014-01-01
S92000003201,402TotalPatientsWaiting6,9802,01422014-02-01
S92000003201,403TotalPatientsWaiting7,0862,01432014-03-01
S92000003201,404TotalPatientsWaiting6,8762,01442014-04-01
S92000003201,405TotalPatientsWaiting6,9722,01452014-05-01
S92000003201,406TotalPatientsWaiting5,2612,01462014-06-01
S92000003201,407TotalPatientsWaiting4,4532,01472014-07-01
S92000003201,408TotalPatientsWaiting5,9792,01482014-08-01
S92000003201,409TotalPatientsWaiting6,1462,01492014-09-01
S92000003201,410TotalPatientsWaiting6,2322,014102014-10-01
S92000003201,411TotalPatientsWaiting6,2052,014112014-11-01
S92000003201,412TotalPatientsWaiting6,5732,014122014-12-01
S92000003201,501TotalPatientsWaiting6,4092,01512015-01-01
S92000003201,502TotalPatientsWaiting6,5652,01522015-02-01
S92000003201,503TotalPatientsWaiting6,8672,01532015-03-01
S92000003201,504TotalPatientsWaiting6,6492,01542015-04-01
S92000003201,505TotalPatientsWaiting6,6042,01552015-05-01
S92000003201,506TotalPatientsWaiting6,5192,01562015-06-01
S92000003201,507TotalPatientsWaiting5,9902,01572015-07-01
S92000003201,508TotalPatientsWaiting5,8342,01582015-08-01
S92000003201,509TotalPatientsWaiting6,1412,01592015-09-01
S92000003201,510TotalPatientsWaiting6,1592,015102015-10-01
S92000003201,511TotalPatientsWaiting6,3552,015112015-11-01
S92000003201,512TotalPatientsWaiting6,5132,015122015-12-01
S92000003201,601TotalPatientsWaiting6,3372,01612016-01-01
S92000003201,602TotalPatientsWaiting6,6182,01622016-02-01
S92000003201,603TotalPatientsWaiting6,6242,01632016-03-01
S92000003201,604TotalPatientsWaiting6,7852,01642016-04-01
S92000003201,605TotalPatientsWaiting6,8192,01652016-05-01
S92000003201,606TotalPatientsWaiting6,5682,01662016-06-01
S92000003201,607TotalPatientsWaiting6,0402,01672016-07-01
S92000003201,608TotalPatientsWaiting5,5202,01682016-08-01
S92000003201,609TotalPatientsWaiting5,7022,01692016-09-01
S92000003201,610TotalPatientsWaiting5,7172,016102016-10-01
S92000003201,611TotalPatientsWaiting5,8842,016112016-11-01
S92000003201,612TotalPatientsWaiting6,2792,016122016-12-01
S92000003201,701TotalPatientsWaiting6,4222,01712017-01-01
S92000003201,702TotalPatientsWaiting6,4922,01722017-02-01
S92000003201,703TotalPatientsWaiting6,9322,01732017-03-01
S92000003201,704TotalPatientsWaiting6,6772,01742017-04-01
S92000003201,705TotalPatientsWaiting6,8732,01752017-05-01
S92000003201,706TotalPatientsWaiting6,9642,01762017-06-01
S92000003201,707TotalPatientsWaiting5,9022,01772017-07-01
S92000003201,708TotalPatientsWaiting5,5372,01782017-08-01
S92000003201,709TotalPatientsWaiting5,9392,01792017-09-01
S92000003201,710TotalPatientsWaiting6,0992,017102017-10-01
S92000003201,711TotalPatientsWaiting7,2712,017112017-11-01
S92000003201,712TotalPatientsWaiting7,6202,017122017-12-01
S92000003201,801TotalPatientsWaiting7,6842,01812018-01-01
S92000003201,802TotalPatientsWaiting7,9652,01822018-02-01
S92000003201,803TotalPatientsWaiting8,3702,01832018-03-01
S92000003201,804TotalPatientsWaiting8,2772,01842018-04-01
S92000003201,805TotalPatientsWaiting8,2402,01852018-05-01
S92000003201,806TotalPatientsWaiting8,5102,01862018-06-01
S92000003201,807TotalPatientsWaiting7,9082,01872018-07-01
S92000003201,808TotalPatientsWaiting7,6532,01882018-08-01
S92000003201,809TotalPatientsWaiting7,8602,01892018-09-01
S92000003201,810TotalPatientsWaiting8,2962,018102018-10-01
S92000003201,811TotalPatientsWaiting8,8272,018112018-11-01
S92000003201,812TotalPatientsWaiting9,3372,018122018-12-01
S92000003201,901TotalPatientsWaiting9,6612,01912019-01-01
S92000003201,902TotalPatientsWaiting9,8912,01922019-02-01
S92000003201,903TotalPatientsWaiting10,6092,01932019-03-01
S92000003201,904TotalPatientsWaiting9,9742,01942019-04-01
S92000003201,905TotalPatientsWaiting10,2632,01952019-05-01
S92000003201,906TotalPatientsWaiting10,4452,01962019-06-01
S92000003201,907TotalPatientsWaiting10,0592,01972019-07-01
S92000003201,908TotalPatientsWaiting9,9262,01982019-08-01
S92000003201,909TotalPatientsWaiting10,0342,01992019-09-01
S92000003201,910TotalPatientsWaiting10,0832,019102019-10-01
S92000003201,911TotalPatientsWaiting10,4752,019112019-11-01
S92000003201,912TotalPatientsWaiting10,8202,019122019-12-01
S92000003202,001TotalPatientsWaiting11,0302,02012020-01-01
S92000003202,002TotalPatientsWaiting11,4492,02022020-02-01
S92000003202,003TotalPatientsWaiting11,4552,02032020-03-01
S92000003202,004TotalPatientsWaiting10,5782,02042020-04-01
S92000003202,005TotalPatientsWaiting9,7342,02052020-05-01
S92000003202,006TotalPatientsWaiting9,3472,02062020-06-01
S92000003202,007TotalPatientsWaiting8,9962,02072020-07-01
S92000003202,008TotalPatientsWaiting9,1812,02082020-08-01
S92000003202,009TotalPatientsWaiting9,6992,02092020-09-01
S92000003202,010TotalPatientsWaiting10,1512,020102020-10-01
S92000003202,011TotalPatientsWaiting10,7562,020112020-11-01
S92000003202,012TotalPatientsWaiting11,1662,020122020-12-01
S92000003202,101TotalPatientsWaiting10,7112,02112021-01-01
S92000003202,102TotalPatientsWaiting10,7442,02122021-02-01
S92000003202,103TotalPatientsWaiting11,0082,02132021-03-01
S92000003202,104TotalPatientsWaiting10,9112,02142021-04-01
S92000003202,105TotalPatientsWaiting11,5312,02152021-05-01
S92000003202,106TotalPatientsWaiting11,7222,02162021-06-01
S92000003202,107TotalPatientsWaiting11,3232,02172021-07-01
S92000003202,108TotalPatientsWaiting11,3322,02182021-08-01
S92000003202,109TotalPatientsWaiting11,8162,02192021-09-01
S92000003202,110TotalPatientsWaiting12,0832,021102021-10-01
S92000003202,111TotalPatientsWaiting12,1072,021112021-11-01
S92000003202,112TotalPatientsWaiting10,4522,021122021-12-01
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_waiting %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(Metric,year) %>%
+  summarise(average=mean(Count,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Metricyearaveragemonths_included
TotalPatientsWaiting20134834.66712
TotalPatientsWaiting20146280.75012
TotalPatientsWaiting20156383.75012
TotalPatientsWaiting20166241.08312
TotalPatientsWaiting20176560.66712
TotalPatientsWaiting20188243.91712
TotalPatientsWaiting201910186.66712
TotalPatientsWaiting202010295.16712
TotalPatientsWaiting202111311.66712
+
+
+
+

People in contact with CAMHS

+
    +
  • Measure code: CYP01
  • +
  • Measure description: People in contact with children and young people’s mental health services at the end of the reporting period
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp01 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP01")
+CAMHS_reldata_cyp01 <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="CYP01")
+
+#Time series chart
+CAMHS_raw_chart_cyp01 <- CAMHS_data_cyp01 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp01)
+
+ +
#Underlying data
+CAMHS_data_cyp01 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2018-05-01People in contact222,156
2018-06-01People in contact225,407
2018-07-01People in contact218,557
2018-08-01People in contact213,702
2018-09-01People in contact218,764
2018-10-01People in contact227,845
2018-11-01People in contact223,744
2018-12-01People in contact227,679
2019-01-01People in contact229,217
2019-02-01People in contact233,831
2019-03-01People in contact241,926
2019-04-01People in contact218,678
2019-05-01People in contact230,443
2019-06-01People in contact225,480
2019-07-01People in contact226,647
2019-08-01People in contact218,826
2019-09-01People in contact221,428
2019-10-01People in contact225,507
2019-11-01People in contact230,739
2019-12-01People in contact231,056
2020-01-01People in contact236,396
2020-02-01People in contact240,401
2020-03-01People in contact237,088
2020-04-01People in contact281,199
2020-05-01People in contact273,706
2020-06-01People in contact272,529
2020-07-01People in contact275,439
2020-08-01People in contact271,462
2020-09-01People in contact286,880
2020-10-01People in contact296,414
2020-11-01People in contact309,311
2020-12-01People in contact311,119
2021-01-01People in contact307,335
2021-02-01People in contact306,997
2021-03-01People in contact317,845
2021-04-01People in contact323,240
2021-05-01People in contact337,426
2021-06-01People in contact340,694
2021-07-01People in contact342,565
2021-08-01People in contact331,912
2021-09-01People in contact337,080
2021-10-01People in contact349,449
2021-11-01People in contact357,802
2021-12-01People in contact355,807
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp01 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP01People in contact2019227814.812
CYP01People in contact2020274328.712
CYP01People in contact2021334012.712
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp01 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP01People in contact2019227386.29
CYP01People in contact2020263900.09
CYP01People in contact2021327232.79
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp01 <- CAMHS_reldata_cyp01 %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contactsn (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp01)
+
+ +
#Underlying data
+CAMHS_reldata_cyp01 %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2019-05-01People in contact3.7302616
2019-06-01People in contact0.0323859
2019-07-01People in contact3.7015515
2019-08-01People in contact2.3977314
2019-09-01People in contact1.2177506
2019-10-01People in contact-1.0261362
2019-11-01People in contact3.1263408
2019-12-01People in contact1.4832286
2020-01-01People in contact3.1319667
2020-02-01People in contact2.8097216
2020-03-01People in contact-1.9997851
2020-04-01People in contact28.5904389
2020-05-01People in contact18.7738400
2020-06-01People in contact20.8661522
2020-07-01People in contact21.5277502
2020-08-01People in contact24.0538144
2020-09-01People in contact29.5590440
2020-10-01People in contact31.4433698
2020-11-01People in contact34.0523275
2020-12-01People in contact34.6509071
2021-01-01People in contact30.0085450
2021-02-01People in contact27.7020478
2021-03-01People in contact34.0620360
2021-04-01People in contact14.9506222
2021-05-01People in contact23.2804542
2021-06-01People in contact25.0120171
2021-07-01People in contact24.3705503
2021-08-01People in contact22.2683101
2021-09-01People in contact17.4986057
2021-10-01People in contact17.8922048
2021-11-01People in contact15.6771017
2021-12-01People in contact14.3636358
+
+
+
+

New referrals (<18)

+
    +
  • Measure code: MHS32a
  • +
  • Measure description: Referrals starting in RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp32a <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS32a")
+CAMHS_reldata_cyp32a <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS32a")
+
+#Time series chart
+CAMHS_raw_chart_cyp32a <- CAMHS_data_cyp32a %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp32a)
+
+ +
#Underlying data
+CAMHS_data_cyp32a %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01New referrals (<18)64,095
2019-05-01New referrals (<18)71,119
2019-06-01New referrals (<18)67,449
2019-07-01New referrals (<18)71,743
2019-08-01New referrals (<18)46,403
2019-09-01New referrals (<18)64,284
2019-10-01New referrals (<18)83,290
2019-11-01New referrals (<18)79,100
2019-12-01New referrals (<18)65,547
2020-01-01New referrals (<18)84,624
2020-02-01New referrals (<18)80,555
2020-03-01New referrals (<18)72,532
2020-04-01New referrals (<18)41,411
2020-05-01New referrals (<18)46,262
2020-06-01New referrals (<18)60,370
2020-07-01New referrals (<18)67,967
2020-08-01New referrals (<18)51,357
2020-09-01New referrals (<18)75,222
2020-10-01New referrals (<18)88,523
2020-11-01New referrals (<18)92,228
2020-12-01New referrals (<18)75,841
2021-01-01New referrals (<18)68,149
2021-02-01New referrals (<18)70,169
2021-03-01New referrals (<18)98,112
2021-04-01New referrals (<18)85,598
2021-05-01New referrals (<18)101,421
2021-06-01New referrals (<18)98,037
2021-07-01New referrals (<18)85,801
2021-08-01New referrals (<18)57,289
2021-09-01New referrals (<18)84,264
2021-10-01New referrals (<18)89,264
2021-11-01New referrals (<18)103,865
2021-12-01New referrals (<18)82,908
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp32a %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS32aNew referrals (<18)202069741.0012
MHS32aNew referrals (<18)202185406.4212
+
+
+

Monthly average, per year (Apr to Dec)

+
#Average per calendar year
+CAMHS_data_cyp32a %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=4&month_num<=12) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS32aNew referrals (<18)201968114.449
MHS32aNew referrals (<18)202066575.679
MHS32aNew referrals (<18)202187605.229
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp32a <- CAMHS_reldata_cyp32a %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp32a)
+
+ +
#Underlying data
+CAMHS_reldata_cyp32a %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01New referrals (<18)-35.3912162
2020-05-01New referrals (<18)-34.9512788
2020-06-01New referrals (<18)-10.4953372
2020-07-01New referrals (<18)-5.2632313
2020-08-01New referrals (<18)10.6760339
2020-09-01New referrals (<18)17.0151204
2020-10-01New referrals (<18)6.2828671
2020-11-01New referrals (<18)16.5967130
2020-12-01New referrals (<18)15.7047615
2021-01-01New referrals (<18)-19.4684723
2021-02-01New referrals (<18)-12.8930544
2021-03-01New referrals (<18)35.2671924
2021-04-01New referrals (<18)106.7035329
2021-05-01New referrals (<18)119.2317669
2021-06-01New referrals (<18)62.3935730
2021-07-01New referrals (<18)26.2392043
2021-08-01New referrals (<18)11.5505189
2021-09-01New referrals (<18)12.0204196
2021-10-01New referrals (<18)0.8370706
2021-11-01New referrals (<18)12.6176432
2021-12-01New referrals (<18)9.3181788
+
+
+
+

New referrals to CYPMHS

+
    +
  • Measure code: CYP32
  • +
  • Measure description: Referrals to children and young people’s mental health services starting in RP
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp32 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP32")
+
+#Time series chart
+CAMHS_raw_chart_cyp32 <- CAMHS_data_cyp32 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_raw_chart_cyp32)
+
+ +
#Underlying data
+CAMHS_data_cyp32 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01New referrals to CYPMHS31,720
2019-05-01New referrals to CYPMHS35,911
2019-06-01New referrals to CYPMHS33,440
2019-07-01New referrals to CYPMHS36,383
2019-08-01New referrals to CYPMHS22,183
2019-09-01New referrals to CYPMHS31,203
2019-10-01New referrals to CYPMHS39,751
2019-11-01New referrals to CYPMHS37,604
2019-12-01New referrals to CYPMHS31,260
2020-01-01New referrals to CYPMHS38,604
2020-02-01New referrals to CYPMHS37,432
2020-03-01New referrals to CYPMHS32,784
2020-04-01New referrals to CYPMHS21,296
2020-05-01New referrals to CYPMHS25,712
2020-06-01New referrals to CYPMHS36,178
2020-07-01New referrals to CYPMHS43,268
2020-08-01New referrals to CYPMHS29,954
2020-09-01New referrals to CYPMHS52,857
2020-10-01New referrals to CYPMHS62,692
2020-11-01New referrals to CYPMHS65,453
2020-12-01New referrals to CYPMHS53,876
2021-01-01New referrals to CYPMHS45,639
2021-02-01New referrals to CYPMHS47,222
2021-03-01New referrals to CYPMHS67,551
2021-04-01New referrals to CYPMHS58,124
2021-05-01New referrals to CYPMHS70,991
2021-06-01New referrals to CYPMHS66,813
2021-07-01New referrals to CYPMHS59,115
2021-08-01New referrals to CYPMHS35,097
2021-09-01New referrals to CYPMHS57,092
2021-10-01New referrals to CYPMHS62,115
2021-11-01New referrals to CYPMHS72,526
2021-12-01New referrals to CYPMHS59,055
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp32 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP32New referrals to CYPMHS202041675.512
CYP32New referrals to CYPMHS202158445.012
+
+
+

Monthly average, per year (Apr to Dec)

+
#Average per calendar year
+CAMHS_data_cyp32 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=4&month_num<=12) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP32New referrals to CYPMHS201933272.789
CYP32New referrals to CYPMHS202043476.229
CYP32New referrals to CYPMHS202160103.119
+
+
+
+

First contacts (<18)

+
    +
  • Measure code: MHS61a
  • +
  • Measure description: First attended contacts for referrals open in the RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp61a <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS61a")
+CAMHS_reldata_cyp61a <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS61a")
+
+#Time series chart
+CAMHS_raw_chart_cyp61a <- CAMHS_data_cyp61a %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp61a)
+
+ +
#Underlying data
+CAMHS_data_cyp61a %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01First contacts (<18)51,694
2019-05-01First contacts (<18)49,335
2019-06-01First contacts (<18)47,035
2019-07-01First contacts (<18)48,293
2019-08-01First contacts (<18)36,352
2019-09-01First contacts (<18)45,982
2019-10-01First contacts (<18)54,568
2019-11-01First contacts (<18)54,309
2019-12-01First contacts (<18)41,945
2020-01-01First contacts (<18)56,823
2020-02-01First contacts (<18)52,305
2020-03-01First contacts (<18)51,555
2020-04-01First contacts (<18)43,246
2020-05-01First contacts (<18)38,816
2020-06-01First contacts (<18)46,559
2020-07-01First contacts (<18)47,685
2020-08-01First contacts (<18)39,035
2020-09-01First contacts (<18)49,839
2020-10-01First contacts (<18)56,951
2020-11-01First contacts (<18)60,651
2020-12-01First contacts (<18)49,468
2021-01-01First contacts (<18)50,832
2021-02-01First contacts (<18)48,337
2021-03-01First contacts (<18)59,245
2021-04-01First contacts (<18)57,734
2021-05-01First contacts (<18)62,337
2021-06-01First contacts (<18)63,397
2021-07-01First contacts (<18)55,473
2021-08-01First contacts (<18)43,083
2021-09-01First contacts (<18)56,285
2021-10-01First contacts (<18)59,256
2021-11-01First contacts (<18)64,298
2021-12-01First contacts (<18)51,273
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp61a %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS61aFirst contacts (<18)202049411.0812
MHS61aFirst contacts (<18)202155962.5012
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp61a %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS61aFirst contacts (<18)202047318.119
MHS61aFirst contacts (<18)202155191.449
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp61a <- CAMHS_reldata_cyp61a %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp61a)
+
+ +
#Underlying data
+CAMHS_reldata_cyp61a %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01First contacts (<18)-16.342322
2020-05-01First contacts (<18)-21.321577
2020-06-01First contacts (<18)-1.012012
2020-07-01First contacts (<18)-1.258982
2020-08-01First contacts (<18)7.380612
2020-09-01First contacts (<18)8.388065
2020-10-01First contacts (<18)4.367028
2020-11-01First contacts (<18)11.677623
2020-12-01First contacts (<18)17.935392
2021-01-01First contacts (<18)-10.543266
2021-02-01First contacts (<18)-7.586273
2021-03-01First contacts (<18)14.916109
2021-04-01First contacts (<18)33.501364
2021-05-01First contacts (<18)60.596146
2021-06-01First contacts (<18)36.164866
2021-07-01First contacts (<18)16.332180
2021-08-01First contacts (<18)10.370181
2021-09-01First contacts (<18)12.933646
2021-10-01First contacts (<18)4.047339
2021-11-01First contacts (<18)6.013091
2021-12-01First contacts (<18)3.648824
+
+
+
+

Attended contacts (<18)

+
    +
  • Measure code: MHS30d
  • +
  • Measure description: Attended contacts in the RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp30d <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS30d")
+CAMHS_reldata_cyp30d <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS30d")
+
+#Time series chart
+CAMHS_raw_chart_cyp30d <- CAMHS_data_cyp30d %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp30d)
+
+ +
#Underlying data
+CAMHS_data_cyp30d %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01Attended contacts (<18)307,328
2019-05-01Attended contacts (<18)346,997
2019-06-01Attended contacts (<18)337,476
2019-07-01Attended contacts (<18)363,594
2019-08-01Attended contacts (<18)274,323
2019-09-01Attended contacts (<18)335,775
2019-10-01Attended contacts (<18)388,130
2019-11-01Attended contacts (<18)383,387
2019-12-01Attended contacts (<18)305,574
2020-01-01Attended contacts (<18)402,520
2020-02-01Attended contacts (<18)361,178
2020-03-01Attended contacts (<18)384,011
2020-04-01Attended contacts (<18)365,212
2020-05-01Attended contacts (<18)360,525
2020-06-01Attended contacts (<18)424,827
2020-07-01Attended contacts (<18)425,810
2020-08-01Attended contacts (<18)336,675
2020-09-01Attended contacts (<18)419,474
2020-10-01Attended contacts (<18)435,613
2020-11-01Attended contacts (<18)473,103
2020-12-01Attended contacts (<18)397,443
2021-01-01Attended contacts (<18)426,820
2021-02-01Attended contacts (<18)412,003
2021-03-01Attended contacts (<18)488,234
2021-04-01Attended contacts (<18)437,736
2021-05-01Attended contacts (<18)463,893
2021-06-01Attended contacts (<18)469,830
2021-07-01Attended contacts (<18)443,801
2021-08-01Attended contacts (<18)350,766
2021-09-01Attended contacts (<18)437,555
2021-10-01Attended contacts (<18)419,382
2021-11-01Attended contacts (<18)479,458
2021-12-01Attended contacts (<18)382,887
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp30d %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS30dAttended contacts (<18)2020398865.912
MHS30dAttended contacts (<18)2021434363.812
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp30d %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS30dAttended contacts (<18)2020386692.49
MHS30dAttended contacts (<18)2021436737.69
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp30d <- CAMHS_reldata_cyp30d %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp30d)
+
+ +
#Underlying data
+CAMHS_reldata_cyp30d %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01Attended contacts (<18)18.834600
2020-05-01Attended contacts (<18)3.898593
2020-06-01Attended contacts (<18)25.883618
2020-07-01Attended contacts (<18)17.111393
2020-08-01Attended contacts (<18)22.729410
2020-09-01Attended contacts (<18)24.927109
2020-10-01Attended contacts (<18)12.233788
2020-11-01Attended contacts (<18)23.400898
2020-12-01Attended contacts (<18)30.064403
2021-01-01Attended contacts (<18)6.036967
2021-02-01Attended contacts (<18)14.072009
2021-03-01Attended contacts (<18)27.140629
2021-04-01Attended contacts (<18)19.858055
2021-05-01Attended contacts (<18)28.671521
2021-06-01Attended contacts (<18)10.593253
2021-07-01Attended contacts (<18)4.225124
2021-08-01Attended contacts (<18)4.185342
2021-09-01Attended contacts (<18)4.310398
2021-10-01Attended contacts (<18)-3.726014
2021-11-01Attended contacts (<18)1.343259
2021-12-01Attended contacts (<18)-3.662412
+
+
+
+

Open referrals

+
    +
  • Measure code: CYP23
  • +
  • Measure description: Open referrals (children’s and young people’s mental health services) at end of the reporting period
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp23 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP23")
+CAMHS_reldata_cyp23 <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="CYP23")
+
+#Time series chart
+CAMHS_raw_chart_cyp23 <- CAMHS_data_cyp23 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp23)
+
+ +
#Underlying data
+CAMHS_data_cyp23 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2018-05-01Open referrals247,499
2018-06-01Open referrals251,573
2018-07-01Open referrals243,916
2018-08-01Open referrals238,803
2018-09-01Open referrals245,003
2018-10-01Open referrals255,855
2018-11-01Open referrals252,726
2018-12-01Open referrals256,644
2019-01-01Open referrals258,525
2019-02-01Open referrals264,305
2019-03-01Open referrals272,605
2019-04-01Open referrals248,038
2019-05-01Open referrals260,485
2019-06-01Open referrals255,950
2019-07-01Open referrals257,152
2019-08-01Open referrals248,313
2019-09-01Open referrals251,483
2019-10-01Open referrals256,252
2019-11-01Open referrals262,299
2019-12-01Open referrals261,939
2020-01-01Open referrals268,184
2020-02-01Open referrals272,482
2020-03-01Open referrals267,871
2020-04-01Open referrals307,837
2020-05-01Open referrals302,241
2020-06-01Open referrals301,012
2020-07-01Open referrals304,491
2020-08-01Open referrals300,469
2020-09-01Open referrals318,375
2020-10-01Open referrals329,392
2020-11-01Open referrals344,178
2020-12-01Open referrals345,569
2021-01-01Open referrals340,421
2021-02-01Open referrals340,218
2021-03-01Open referrals352,551
2021-04-01Open referrals358,282
2021-05-01Open referrals374,401
2021-06-01Open referrals379,079
2021-07-01Open referrals380,738
2021-08-01Open referrals368,610
2021-09-01Open referrals374,946
2021-10-01Open referrals388,237
2021-11-01Open referrals397,857
2021-12-01Open referrals397,147
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp23 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP23Open referrals2019258112.212
CYP23Open referrals2020305175.112
CYP23Open referrals2021371040.612
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp23 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP23Open referrals2019257428.49
CYP23Open referrals2020293662.49
CYP23Open referrals2021363249.69
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp23 <- CAMHS_reldata_cyp23 %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp23)
+
+ +
#Underlying data
+CAMHS_reldata_cyp23 %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2019-05-01Open referrals5.246890
2019-06-01Open referrals1.739853
2019-07-01Open referrals5.426458
2019-08-01Open referrals3.982362
2019-09-01Open referrals2.644866
2019-10-01Open referrals0.155166
2019-11-01Open referrals3.787897
2019-12-01Open referrals2.063169
2020-01-01Open referrals3.736196
2020-02-01Open referrals3.093774
2020-03-01Open referrals-1.736579
2020-04-01Open referrals24.108806
2020-05-01Open referrals16.030098
2020-06-01Open referrals17.605782
2020-07-01Open referrals18.408957
2020-08-01Open referrals21.004136
2020-09-01Open referrals26.599015
2020-10-01Open referrals28.542216
2020-11-01Open referrals31.215902
2020-12-01Open referrals31.927281
2021-01-01Open referrals26.935611
2021-02-01Open referrals24.858890
2021-03-01Open referrals31.612231
2021-04-01Open referrals16.386919
2021-05-01Open referrals23.874987
2021-06-01Open referrals25.934846
2021-07-01Open referrals25.040806
2021-08-01Open referrals22.678213
2021-09-01Open referrals17.768669
2021-10-01Open referrals17.864733
2021-11-01Open referrals15.596290
2021-12-01Open referrals14.925529
+
+
+
+

People with eating disorders being seen within target times (<18)

+
    +
  • Measure code: ED86e

  • +
  • Measure description: Proportion of referrals with eating disorders categorized as urgent cases entering treatment within one week in RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED87e

  • +
  • Measure description: Proportion of referrals with eating disorders categorized as routine cases entering treatment within four weeks in RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
+
#Eating disorders data
+target_time_ed_data_new <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED86e","ED87e")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE)
+
+target_time_ed_data <- MHSDS_ED_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED86e","ED87e")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>%
+  plyr::rbind.fill(.,target_time_ed_data_new) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="ED86e" ~ "Urgent",
+                        MEASURE_ID=="ED87e" ~ "Routine",
+                        TRUE ~ "NA"),
+         Metric="Starting within target time",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart
+target_time_ed_chart <- target_time_ed_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  scale_colour_manual(values=
+                        c("Urgent" = "brown", "Routine" = "darkseagreen4")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(target_time_ed_chart)
+
+ +
target_time_ed_data %>%
+  arrange(.,end_date) %>% 
+  select(.,MEASURE_ID,Type,start_date,end_date,time_window,MEASURE_VALUE) %>%
+  filter(.,start_date %in% ymd(c("2021-01-01","2021-04-01","2021-07-01","2021-10-01"))) %>%
+  group_by(MEASURE_ID,Type) %>%
+  summarise(.,MEASURE_VALUE=mean(MEASURE_VALUE)) %>% 
+  ungroup() %>%
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + +
MEASURE_IDTypeMEASURE_VALUE
ED86eUrgent39.05812
ED87eRoutine48.96245
+
+
+

New referrals into eating disorder services (<18)

+
    +
  • Measure code: ED32

  • +
  • Measure description: Referrals into a service with a primary reason of referral of Eating Disorder received in the reporting period, among those aged 0-18.

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED88

  • +
  • Measure description: The number of referrals to eating disorder services for eating disorder issues for people aged 0 - 18 waiting for treatment at the end of the reporting period

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED89

  • +
  • Measure description: Referrals with eating disorder issues categorized as urgent waiting for treatment end RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED90

  • +
  • Measure description: Referrals with eating disorder issues categorized as routine waiting for treatment end RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
+
#Eating disorders data
+ref_ed_data_new <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED89","ED90")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE)
+
+ref_ed_data_new <- MHSDS_ED_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED89","ED90")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>%
+  plyr::rbind.fill(.,ref_ed_data_new) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="ED89" ~ "Urgent",
+                        MEASURE_ID=="ED90" ~ "Routine",
+                        TRUE ~ "NA"),
+         Metric="Waiting for treatment",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 2
+ref_ed_chart <- ref_ed_data_new %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(ref_ed_chart)
+
+ +
#Crisis referrals
+crisis_referrals_data <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("CCR70b","CCR71b")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="CCR71b" ~ "Urgent",
+                        MEASURE_ID=="CCR70b" ~ "Emergency",
+                        TRUE ~ "NA"),
+         Metric="New referrals",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 2
+crisis_referrals_chart <- crisis_referrals_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(crisis_referrals_chart)
+
+ +
crisis_referrals_data_flourish <- crisis_referrals_data %>% 
+  select(.,end_date,time_window,MEASURE_VALUE,Metric,Type) %>%
+  pivot_wider(
+    names_from = "Type",
+    names_sep = ".",
+    values_from = c(MEASURE_VALUE)
+  ) %>%
+  arrange(.,end_date)
+
+#fwrite(crisis_referrals_data_flourish,paste0(onedrive_charts_data,"crisis_charts.csv"))
+
#ED referrals
+ED_referrals_data <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED32")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Metric="New referrals",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 3
+ED_referrals_chart <- ED_referrals_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE)) +
+  geom_line() +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.y = element_text(size = 8))
+
+#ggplotly(ED_referrals_chart)
+
+ED_referrals_data_flourish <- ED_referrals_data %>% 
+  select(.,end_date,time_window,MEASURE_VALUE,Metric) %>%
+  arrange(.,end_date)
+
+#fwrite(ED_referrals_data_flourish,paste0(onedrive_charts_data,"EDref_charts.csv"))
+
+
+

Health Education England data on workforce (compared to activity levels from NHS England)

+
    +
  • Source of staff numbers is Health Education England report
  • +
+
#NHS Digital on people in contact with CAMHS service
+CAMHS_contacts <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID=="CYP01") %>%
+  select(.,start_date,MEASURE_VALUE) %>%
+  mutate(.,date_ymd=lubridate::ymd(start_date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="People in contact CAMHS",
+         MEASURE_VALUE=as.numeric(MEASURE_VALUE)) %>%
+  select(.,-"start_date") %>%
+  arrange(.,date_ymd)
+
+#Turn into indexed data
+CAMHS_contacts_index <- CAMHS_contacts %>%
+  mutate(.,MEASURE_VALUE_MA=zoo::rollmean(MEASURE_VALUE,k=7,fill=NA)) %>% #Use a moving average to compute the mean
+  mutate(.,Jan2019=filter(.,date_ymd=="2019-01-01")$MEASURE_VALUE_MA) %>%
+  filter(.,date_ymd>=ymd("2019-01-01"),!is.na(MEASURE_VALUE_MA)) %>%
+  mutate(.,index=MEASURE_VALUE_MA/Jan2019*100)
+
+#HEE data (copied over from report)
+HEE_staff_index <- data.frame(measure="CYP MH staff",
+  date_ymd=as.Date(c("2019-01-01","2021-04-01")),
+  MEASURE_VALUE=as.numeric(c("14857","20626"))) %>%
+  mutate(.,Jan2019=filter(.,date_ymd=="2019-01-01")$MEASURE_VALUE) %>%
+  mutate(.,index=MEASURE_VALUE/Jan2019*100)
+
+#Append two sources together
+CAMHS_and_HEE_staff <- plyr::rbind.fill(CAMHS_contacts_index,HEE_staff_index)
+
+#Show data
+CAMHS_and_HEE_staff %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_VALUEdate_ymdmeasureMEASURE_VALUE_MAJan2019index
2292172019-01-01People in contact CAMHS228988.6228988.6100.00000
2338312019-02-01People in contact CAMHS229359.7228988.6100.16208
2419262019-03-01People in contact CAMHS229607.7228988.6100.27038
2186782019-04-01People in contact CAMHS229460.3228988.6100.20600
2304432019-05-01People in contact CAMHS227975.9228988.699.55774
2254802019-06-01People in contact CAMHS226204.0228988.698.78397
2266472019-07-01People in contact CAMHS223858.4228988.697.75965
2188262019-08-01People in contact CAMHS225581.4228988.698.51209
2214282019-09-01People in contact CAMHS225669.0228988.698.55033
2255072019-10-01People in contact CAMHS227228.4228988.699.23134
2307392019-11-01People in contact CAMHS229193.3228988.6100.08940
2310562019-12-01People in contact CAMHS231802.1228988.6101.22870
2363962020-01-01People in contact CAMHS240340.9228988.6104.95758
2404012020-02-01People in contact CAMHS247226.4228988.6107.96453
2370882020-03-01People in contact CAMHS253196.4228988.6110.57164
2811992020-04-01People in contact CAMHS259536.9228988.6113.34053
2737062020-05-01People in contact CAMHS264546.3228988.6115.52816
2725292020-06-01People in contact CAMHS271186.1228988.6118.42781
2754392020-07-01People in contact CAMHS279661.3228988.6122.12893
2714622020-08-01People in contact CAMHS283677.3228988.6123.88273
2868802020-09-01People in contact CAMHS289022.0228988.6126.21678
2964142020-10-01People in contact CAMHS293994.3228988.6128.38819
3093112020-11-01People in contact CAMHS298502.6228988.6130.35697
3111192020-12-01People in contact CAMHS305128.7228988.6133.25063
3073352021-01-01People in contact CAMHS310323.0228988.6135.51899
3069972021-02-01People in contact CAMHS316181.9228988.6138.07757
3178452021-03-01People in contact CAMHS320665.1228988.6140.03544
3232402021-04-01People in contact CAMHS325157.4228988.6141.99723
3374262021-05-01People in contact CAMHS328668.4228988.6143.53049
3406942021-06-01People in contact CAMHS332966.0228988.6145.40726
3425652021-07-01People in contact CAMHS337480.9228988.6147.37891
3319122021-08-01People in contact CAMHS342418.3228988.6149.53510
3370802021-09-01People in contact CAMHS345044.1228988.6150.68182
148572019-01-01CYP MH staffNA14857.0100.00000
206262021-04-01CYP MH staffNA14857.0138.83018
+
+
+

NHS England data on workforce (child and adolescent psychiatry only)

+
#NHS data
+NHS_workforce_doctors %>%
+  mutate(.,date_ymd=lubridate::ymd(Date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="FTE doctors") %>%
+  rename(.,MEASURE_VALUE=FTE) %>%
+  filter(Specialty %in% c("Child and adolescent psychiatry")) %>%
+  group_by(date_ymd,measure,Specialty) %>%
+  summarise(MEASURE_VALUE=sum(MEASURE_VALUE,na.rm=TRUE)) %>% #Aggregate over categories
+  ungroup() %>%
+  filter(., date_ymd %in% c(ymd("2019-01-01"),ymd("2021-04-01"))) %>%
+  pivot_wider(
+    names_from = date_ymd,
+    names_sep = ".",
+    values_from = MEASURE_VALUE
+  ) %>%
+  mutate(.,pct_change=(`2021-04-01`-`2019-01-01`)/`2019-01-01`*100) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + +
measureSpecialty2019-01-012021-04-01pct_change
FTE doctorsChild and adolescent psychiatry981.68231064.2568.411452
+
#Latest data on consultants
+NHS_workforce_doctors %>%
+  mutate(.,date_ymd=lubridate::ymd(Date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="FTE doctors") %>%
+  rename(.,MEASURE_VALUE=FTE) %>%
+  filter(., date_ymd %in% c(ymd("2021-05-01"))) %>%
+  filter(Specialty %in% c("Child and adolescent psychiatry"))  %>%
+  select(.,-"Date") %>% 
+  knitr::kable(., align = "lccrr")
+ +++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GradeGrade Order CodeSpecialty GroupSpecialtyMEASURE_VALUEdate_ymdmeasure
Consultant1Psychiatry groupChild and adolescent psychiatry626.54702021-05-01FTE doctors
Associate Specialist2Psychiatry groupChild and adolescent psychiatry13.37252021-05-01FTE doctors
Specialty Doctor3Psychiatry groupChild and adolescent psychiatry100.92102021-05-01FTE doctors
Staff Grade4Psychiatry groupChild and adolescent psychiatry3.50002021-05-01FTE doctors
Specialty Registrar5Psychiatry groupChild and adolescent psychiatry144.86882021-05-01FTE doctors
Core Training6Psychiatry groupChild and adolescent psychiatry142.10622021-05-01FTE doctors
Foundation Doctor Year 27Psychiatry groupChild and adolescent psychiatry10.00002021-05-01FTE doctors
Foundation Doctor Year 18Psychiatry groupChild and adolescent psychiatry10.00002021-05-01FTE doctors
+
+ + + + +
+ + + + + + + + + + + + + + + From 4b70ff429c043c8c242c05818ad4f0e98b0676f2 Mon Sep 17 00:00:00 2001 From: Chris Beeley Date: Tue, 20 Feb 2024 19:12:56 +0000 Subject: [PATCH 2/2] Rename HTML -> index.html --- docs/index.html | 8970 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 8970 insertions(+) create mode 100644 docs/index.html diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..ada2eaa --- /dev/null +++ b/docs/index.html @@ -0,0 +1,8970 @@ + + + + + + + + + + + + + + + +Networked Data Lab long chart on children and young people’s mental health + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
#Subsample of metrics from MHSDS data
+CAMHS_data <- MHSDS_main_pooled_dashboard %>%
+  filter(PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("CYP01","MHS61a","CYP23","MHS30d","MHS32a","CYP32")) %>%
+  filter(.,!(MEASURE_ID=="MHS32a"&BREAKDOWN!="England")) %>% 
+  mutate(MEASURE_KEY=case_when(
+           MEASURE_ID=="MHS30d" ~ "Attended contacts (<18)",
+           MEASURE_ID=="CYP01" ~ "People in contact",
+           MEASURE_ID=="MHS61a" ~ "First contacts (<18)",
+           MEASURE_ID=="CYP23" ~ "Open referrals",
+           MEASURE_ID=="MHS32a" ~ "New referrals (<18)",
+           MEASURE_ID=="CYP32" ~ "New referrals to CYPMHS",
+           TRUE ~ "NA"
+         )) %>% 
+  select(.,start_date,end_date,month_year,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         timing=ifelse(start_date<ymd("2020-04-01"),"Pre-COVID","Post-COVID"),
+         month_num=lubridate::month(start_date)) %>%
+  mutate(.,timing=fct_relevel(timing, c("Pre-COVID","Post-COVID"))) %>% 
+  arrange(.,start_date) %>%
+  as_tibble()
+
+#Percentage change compared to a year ago
+#For example, for March 2020 show the % change between March 2019 and March 2020
+
+CAMHS_yearly_changes <- CAMHS_data %>%
+  select(.,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE,start_date,month_year,timing) %>%
+  mutate(start_date=lubridate::ymd(start_date)) %>%
+  mutate(.,start_date_l1=start_date-years(1)) #Adds a new column with the month a year before
+
+#Auxiliary dataset with data points from a year before
+CAMHS_data_l1 <- CAMHS_yearly_changes %>%
+  select(.,start_date,MEASURE_VALUE,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY) %>%
+  rename(.,MEASURE_VALUE_l1=MEASURE_VALUE,start_date_l1=start_date)
+
+#Merge auxiliary data back in
+CAMHS_yearly_changes <- left_join(CAMHS_yearly_changes,
+                                          CAMHS_data_l1,
+                                          by=c("start_date_l1","PRIMARY_LEVEL_DESCRIPTION","MEASURE_ID","MEASURE_KEY")) %>%
+  arrange(.,MEASURE_ID,start_date) %>%
+  mutate(pct_change_l1=(MEASURE_VALUE-MEASURE_VALUE_l1)/MEASURE_VALUE_l1*100) %>%
+  filter(.,!is.na(pct_change_l1))
+rm(CAMHS_data_l1)
+
flourish_data_mhsds <- CAMHS_data %>%
+  filter(.,MEASURE_ID %in% c("CYP01","MHS61a","CYP23","MHS32a")) %>%
+  select(.,start_date,end_date,month_year,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>%
+  mutate(.,month=lubridate::month(start_date, label = TRUE),
+         year=lubridate::year(start_date)) %>%
+  select(.,month,year,MEASURE_ID,MEASURE_KEY,MEASURE_VALUE) %>%
+  pivot_wider(.,
+    names_from = year,
+    names_sep = ".",
+    values_from = c(MEASURE_VALUE)
+  ) %>%
+  arrange(.,MEASURE_ID,month)
+
+#fwrite(flourish_data_mhsds,paste0(onedrive_charts_data,"Fig2alt.csv"))
+
+

Performance against 18 week target in Scottish CAMHS

+
    +
  • Measure code: TotalPatientsSeen and NumberOfPatientsSeen0To18Weeks
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_18wks <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("TotalPatientsSeen","NumberOfPatientsSeen0To18Weeks"),
+         HB=="S92000003") %>%
+  pivot_wider(names_from = Metric,
+              names_sep = ".",
+              values_from = c(Count)) %>%
+  mutate(.,pct_within_18wks=as.numeric(NumberOfPatientsSeen0To18Weeks)/
+           as.numeric(TotalPatientsSeen)*100,
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_18wks_chart <- CAMHS_Scotland_18wks %>% 
+  ggplot(., aes(x=year_month, y=pct_within_18wks)) +
+  geom_line(size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma, limits=c(0,100)) +
+  geom_hline(yintercept=90, linetype="dashed", color = "red") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_18wks_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_18wks %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ ++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthyearmonthyear_monthTotalPatientsSeenNumberOfPatientsSeen0To18Weekspct_within_18wks
S92000003201,2072,01272012-07-0175161181.35819
S92000003201,2082,01282012-08-0184065377.73810
S92000003201,2092,01292012-09-0180763378.43866
S92000003201,2102,012102012-10-01108385879.22438
S92000003201,2112,012112012-11-011236102382.76699
S92000003201,2122,012122012-12-0184770783.47107
S92000003201,3012,01312013-01-01119098682.85714
S92000003201,3022,01322013-02-011264107785.20570
S92000003201,3032,01332013-03-01105793388.26869
S92000003201,3042,01342013-04-01115399386.12316
S92000003201,3052,01352013-05-011273109385.86017
S92000003201,3062,01362013-06-01102488586.42578
S92000003201,3072,01372013-07-0199784784.95486
S92000003201,3082,01382013-08-0197678880.73770
S92000003201,3092,01392013-09-0198384085.45270
S92000003201,3102,013102013-10-01118099183.98305
S92000003201,3112,013112013-11-01124198379.21031
S92000003201,3122,013122013-12-0190977385.03850
S92000003201,4012,01412014-01-011342112683.90462
S92000003201,4022,01422014-02-011277105582.61551
S92000003201,4032,01432014-03-01111494985.18851
S92000003201,4042,01442014-04-01115396583.69471
S92000003201,4052,01452014-05-011359112983.07579
S92000003201,4062,01462014-06-01104883179.29389
S92000003201,4072,01472014-07-0199379580.06042
S92000003201,4082,01482014-08-0199776476.62989
S92000003201,4092,01492014-09-011333103677.71943
S92000003201,4102,014102014-10-011442111177.04577
S92000003201,4112,014112014-11-011464114077.86885
S92000003201,4122,014122014-12-011266104082.14850
S92000003201,5012,01512015-01-011466115578.78581
S92000003201,5022,01522015-02-011391106976.85119
S92000003201,5032,01532015-03-011412114581.09065
S92000003201,5042,01542015-04-011445113478.47751
S92000003201,5052,01552015-05-011476112075.88076
S92000003201,5062,01562015-06-011542117075.87549
S92000003201,5072,01572015-07-011415107275.75972
S92000003201,5082,01582015-08-01133596572.28464
S92000003201,5092,01592015-09-011489106071.18872
S92000003201,5102,015102015-10-011534111472.62060
S92000003201,5112,015112015-11-011680124373.98810
S92000003201,5122,015122015-12-011291107783.42370
S92000003201,6012,01612016-01-011416120084.74576
S92000003201,6022,01622016-02-011516128284.56464
S92000003201,6032,01632016-03-011564131383.95141
S92000003201,6042,01642016-04-011494121181.05756
S92000003201,6052,01652016-05-011636122474.81663
S92000003201,6062,01662016-06-011606124677.58406
S92000003201,6072,01672016-07-01120494678.57143
S92000003201,6082,01682016-08-011512117577.71164
S92000003201,6092,01692016-09-011444115079.63989
S92000003201,6102,016102016-10-011411117383.13253
S92000003201,6112,016112016-11-011665131979.21922
S92000003201,6122,016122016-12-011277109986.06108
S92000003201,7012,01712017-01-011307110284.31523
S92000003201,7022,01722017-02-011468121182.49319
S92000003201,7032,01732017-03-011558130883.95379
S92000003201,7042,01742017-04-01115793380.63959
S92000003201,7052,01752017-05-011550125681.03226
S92000003201,7062,01762017-06-011385111580.50542
S92000003201,7072,01772017-07-01100877777.08333
S92000003201,7082,01782017-08-01129993071.59353
S92000003201,7092,01792017-09-01110579171.58371
S92000003201,7102,017102017-10-01126389771.02138
S92000003201,7112,017112017-11-011656114369.02174
S92000003201,7122,017122017-12-01110882474.36823
S92000003201,8012,01812018-01-01136798972.34821
S92000003201,8022,01822018-02-01131893070.56146
S92000003201,8032,01832018-03-01131092170.30534
S92000003201,8042,01842018-04-01145195765.95451
S92000003201,8052,01852018-05-011712114666.93925
S92000003201,8062,01862018-06-011531106769.69301
S92000003201,8072,01872018-07-01131492370.24353
S92000003201,8082,01882018-08-011548102766.34367
S92000003201,8092,01892018-09-01137797370.66086
S92000003201,8102,018102018-10-011630118972.94479
S92000003201,8112,018112018-11-011662113568.29122
S92000003201,8122,018122018-12-01123196778.55402
S92000003201,9012,01912019-01-011493107672.06966
S92000003201,9022,01922019-02-011414103873.40877
S92000003201,9032,01932019-03-011330100675.63910
S92000003201,9042,01942019-04-01138495769.14740
S92000003201,9052,01952019-05-011453100969.44253
S92000003201,9062,01962019-06-01117583470.97872
S92000003201,9072,01972019-07-01126279262.75753
S92000003201,9082,01982019-08-01133385063.76594
S92000003201,9092,01992019-09-01130787566.94721
S92000003201,9102,019102019-10-01137489064.77438
S92000003201,9112,019112019-11-01143792264.16145
S92000003201,9122,019122019-12-01107376771.48183
S92000003202,0012,02012020-01-01139994567.54825
S92000003202,0022,02022020-02-01144895766.09116
S92000003202,0032,02032020-03-01128484866.04361
S92000003202,0042,02042020-04-0195572475.81152
S92000003202,0052,02052020-05-01123874660.25848
S92000003202,0062,02062020-06-01135572053.13653
S92000003202,0072,02072020-07-01129775157.90285
S92000003202,0082,02082020-08-01124971457.16573
S92000003202,0092,02092020-09-01148697965.88156
S92000003202,0102,020102020-10-01130996173.41482
S92000003202,0112,020112020-11-011511110272.93183
S92000003202,0122,020122020-12-01127192772.93470
S92000003202,1012,02112021-01-01127590170.66667
S92000003202,1022,02122021-02-01131598674.98099
S92000003202,1032,02132021-03-011506107971.64675
S92000003202,1042,02142021-04-011533109371.29811
S92000003202,1052,02152021-05-011530109971.83007
S92000003202,1062,02162021-06-011489111474.81531
S92000003202,1072,02172021-07-01120391375.89360
S92000003202,1082,02182021-08-01125296977.39617
S92000003202,1092,02192021-09-011337109882.12416
S92000003202,1102,021102021-10-011440102971.45833
S92000003202,1112,021112021-11-011749123370.49743
S92000003202,1122,021122021-12-01135593368.85609
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_18wks %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(year) %>%
+  summarise(average=mean(pct_within_18wks,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
yearaveragemonths_included
201384.5098112
201480.7704912
201576.3522412
201680.9213212
201777.3009512
201870.2366612
201968.7145412
202065.7600912
202173.4553012
+
+
+
+

People still receiving treatment in Scottish CAMHS

+
    +
  • Measure code: OpenCases
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_open <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("OpenCases"),
+         HB=="S92000003") %>%
+  mutate(.,Count=as.numeric(Count),
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_open_chart <- CAMHS_Scotland_open %>% 
+  ggplot(., aes(x=year_month, y=Count, group= Metric)) +
+  geom_line(aes(color= Metric),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_open_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_open %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthMetricCountyearmonthyear_month
S92000003201,901OpenCases27,9362,01912019-01-01
S92000003201,902OpenCases27,0772,01922019-02-01
S92000003201,903OpenCases27,3322,01932019-03-01
S92000003201,904OpenCases27,2172,01942019-04-01
S92000003201,905OpenCases26,0062,01952019-05-01
S92000003201,906OpenCases25,6752,01962019-06-01
S92000003201,907OpenCases25,4962,01972019-07-01
S92000003201,908OpenCases28,7022,01982019-08-01
S92000003201,909OpenCases29,3262,01992019-09-01
S92000003201,910OpenCases30,2332,019102019-10-01
S92000003201,911OpenCases30,7442,019112019-11-01
S92000003201,912OpenCases30,4312,019122019-12-01
S92000003202,001OpenCases31,2462,02012020-01-01
S92000003202,002OpenCases30,8362,02022020-02-01
S92000003202,003OpenCases29,5042,02032020-03-01
S92000003202,004OpenCases28,9852,02042020-04-01
S92000003202,005OpenCases28,8192,02052020-05-01
S92000003202,006OpenCases28,6622,02062020-06-01
S92000003202,007OpenCases27,9812,02072020-07-01
S92000003202,008OpenCases28,0562,02082020-08-01
S92000003202,009OpenCases28,3022,02092020-09-01
S92000003202,010OpenCases28,4252,020102020-10-01
S92000003202,011OpenCases29,0292,020112020-11-01
S92000003202,012OpenCases28,7712,020122020-12-01
S92000003202,101OpenCases28,7672,02112021-01-01
S92000003202,102OpenCases28,8832,02122021-02-01
S92000003202,103OpenCases28,9952,02132021-03-01
S92000003202,104OpenCases28,9272,02142021-04-01
S92000003202,105OpenCases29,7502,02152021-05-01
S92000003202,106OpenCases28,9882,02162021-06-01
S92000003202,107OpenCases28,2092,02172021-07-01
S92000003202,108OpenCases28,1562,02182021-08-01
S92000003202,109OpenCases28,3102,02192021-09-01
S92000003202,110OpenCases28,5362,021102021-10-01
S92000003202,111OpenCases29,1272,021112021-11-01
S92000003202,112OpenCases26,0322,021122021-12-01
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_open %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(Metric,year) %>%
+  summarise(average=mean(Count,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Metricyearaveragemonths_included
OpenCases201928014.5812
OpenCases202029051.3312
OpenCases202128556.6712
+
+
+
+

People waiting for treatment in Scottish CAMHS

+
    +
  • Measure code: TotalPatientsWaiting
  • +
  • Measure description:
  • +
  • Source: NHS Scotland Open Data
  • +
+
+

Raw time series

+
#Data
+CAMHS_Scotland_waiting <- scotland_camhs_appended %>%
+  filter(.,Metric %in% c("TotalPatientsWaiting"),
+         HB=="S92000003") %>%
+  mutate(.,Count=as.numeric(Count),
+         year_month=ymd(year_month))
+
+#Time series chart
+CAMHS_Scotland_waiting_chart <- CAMHS_Scotland_waiting %>% 
+  ggplot(., aes(x=year_month, y=Count, group= Metric)) +
+  geom_line(aes(color= Metric),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_Scotland_waiting_chart)
+
+ +
#Underlying data
+CAMHS_Scotland_waiting %>%
+  arrange(.,year_month) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HBMonthMetricCountyearmonthyear_month
S92000003201,207TotalPatientsWaiting3,6382,01272012-07-01
S92000003201,208TotalPatientsWaiting3,1962,01282012-08-01
S92000003201,209TotalPatientsWaiting3,3692,01292012-09-01
S92000003201,210TotalPatientsWaiting3,8202,012102012-10-01
S92000003201,211TotalPatientsWaiting3,9662,012112012-11-01
S92000003201,212TotalPatientsWaiting4,1472,012122012-12-01
S92000003201,301TotalPatientsWaiting4,0552,01312013-01-01
S92000003201,302TotalPatientsWaiting4,1812,01322013-02-01
S92000003201,303TotalPatientsWaiting4,5842,01332013-03-01
S92000003201,304TotalPatientsWaiting4,3322,01342013-04-01
S92000003201,305TotalPatientsWaiting4,3932,01352013-05-01
S92000003201,306TotalPatientsWaiting4,7702,01362013-06-01
S92000003201,307TotalPatientsWaiting4,5462,01372013-07-01
S92000003201,308TotalPatientsWaiting4,3912,01382013-08-01
S92000003201,309TotalPatientsWaiting4,8182,01392013-09-01
S92000003201,310TotalPatientsWaiting5,6412,013102013-10-01
S92000003201,311TotalPatientsWaiting5,9002,013112013-11-01
S92000003201,312TotalPatientsWaiting6,4052,013122013-12-01
S92000003201,401TotalPatientsWaiting6,6062,01412014-01-01
S92000003201,402TotalPatientsWaiting6,9802,01422014-02-01
S92000003201,403TotalPatientsWaiting7,0862,01432014-03-01
S92000003201,404TotalPatientsWaiting6,8762,01442014-04-01
S92000003201,405TotalPatientsWaiting6,9722,01452014-05-01
S92000003201,406TotalPatientsWaiting5,2612,01462014-06-01
S92000003201,407TotalPatientsWaiting4,4532,01472014-07-01
S92000003201,408TotalPatientsWaiting5,9792,01482014-08-01
S92000003201,409TotalPatientsWaiting6,1462,01492014-09-01
S92000003201,410TotalPatientsWaiting6,2322,014102014-10-01
S92000003201,411TotalPatientsWaiting6,2052,014112014-11-01
S92000003201,412TotalPatientsWaiting6,5732,014122014-12-01
S92000003201,501TotalPatientsWaiting6,4092,01512015-01-01
S92000003201,502TotalPatientsWaiting6,5652,01522015-02-01
S92000003201,503TotalPatientsWaiting6,8672,01532015-03-01
S92000003201,504TotalPatientsWaiting6,6492,01542015-04-01
S92000003201,505TotalPatientsWaiting6,6042,01552015-05-01
S92000003201,506TotalPatientsWaiting6,5192,01562015-06-01
S92000003201,507TotalPatientsWaiting5,9902,01572015-07-01
S92000003201,508TotalPatientsWaiting5,8342,01582015-08-01
S92000003201,509TotalPatientsWaiting6,1412,01592015-09-01
S92000003201,510TotalPatientsWaiting6,1592,015102015-10-01
S92000003201,511TotalPatientsWaiting6,3552,015112015-11-01
S92000003201,512TotalPatientsWaiting6,5132,015122015-12-01
S92000003201,601TotalPatientsWaiting6,3372,01612016-01-01
S92000003201,602TotalPatientsWaiting6,6182,01622016-02-01
S92000003201,603TotalPatientsWaiting6,6242,01632016-03-01
S92000003201,604TotalPatientsWaiting6,7852,01642016-04-01
S92000003201,605TotalPatientsWaiting6,8192,01652016-05-01
S92000003201,606TotalPatientsWaiting6,5682,01662016-06-01
S92000003201,607TotalPatientsWaiting6,0402,01672016-07-01
S92000003201,608TotalPatientsWaiting5,5202,01682016-08-01
S92000003201,609TotalPatientsWaiting5,7022,01692016-09-01
S92000003201,610TotalPatientsWaiting5,7172,016102016-10-01
S92000003201,611TotalPatientsWaiting5,8842,016112016-11-01
S92000003201,612TotalPatientsWaiting6,2792,016122016-12-01
S92000003201,701TotalPatientsWaiting6,4222,01712017-01-01
S92000003201,702TotalPatientsWaiting6,4922,01722017-02-01
S92000003201,703TotalPatientsWaiting6,9322,01732017-03-01
S92000003201,704TotalPatientsWaiting6,6772,01742017-04-01
S92000003201,705TotalPatientsWaiting6,8732,01752017-05-01
S92000003201,706TotalPatientsWaiting6,9642,01762017-06-01
S92000003201,707TotalPatientsWaiting5,9022,01772017-07-01
S92000003201,708TotalPatientsWaiting5,5372,01782017-08-01
S92000003201,709TotalPatientsWaiting5,9392,01792017-09-01
S92000003201,710TotalPatientsWaiting6,0992,017102017-10-01
S92000003201,711TotalPatientsWaiting7,2712,017112017-11-01
S92000003201,712TotalPatientsWaiting7,6202,017122017-12-01
S92000003201,801TotalPatientsWaiting7,6842,01812018-01-01
S92000003201,802TotalPatientsWaiting7,9652,01822018-02-01
S92000003201,803TotalPatientsWaiting8,3702,01832018-03-01
S92000003201,804TotalPatientsWaiting8,2772,01842018-04-01
S92000003201,805TotalPatientsWaiting8,2402,01852018-05-01
S92000003201,806TotalPatientsWaiting8,5102,01862018-06-01
S92000003201,807TotalPatientsWaiting7,9082,01872018-07-01
S92000003201,808TotalPatientsWaiting7,6532,01882018-08-01
S92000003201,809TotalPatientsWaiting7,8602,01892018-09-01
S92000003201,810TotalPatientsWaiting8,2962,018102018-10-01
S92000003201,811TotalPatientsWaiting8,8272,018112018-11-01
S92000003201,812TotalPatientsWaiting9,3372,018122018-12-01
S92000003201,901TotalPatientsWaiting9,6612,01912019-01-01
S92000003201,902TotalPatientsWaiting9,8912,01922019-02-01
S92000003201,903TotalPatientsWaiting10,6092,01932019-03-01
S92000003201,904TotalPatientsWaiting9,9742,01942019-04-01
S92000003201,905TotalPatientsWaiting10,2632,01952019-05-01
S92000003201,906TotalPatientsWaiting10,4452,01962019-06-01
S92000003201,907TotalPatientsWaiting10,0592,01972019-07-01
S92000003201,908TotalPatientsWaiting9,9262,01982019-08-01
S92000003201,909TotalPatientsWaiting10,0342,01992019-09-01
S92000003201,910TotalPatientsWaiting10,0832,019102019-10-01
S92000003201,911TotalPatientsWaiting10,4752,019112019-11-01
S92000003201,912TotalPatientsWaiting10,8202,019122019-12-01
S92000003202,001TotalPatientsWaiting11,0302,02012020-01-01
S92000003202,002TotalPatientsWaiting11,4492,02022020-02-01
S92000003202,003TotalPatientsWaiting11,4552,02032020-03-01
S92000003202,004TotalPatientsWaiting10,5782,02042020-04-01
S92000003202,005TotalPatientsWaiting9,7342,02052020-05-01
S92000003202,006TotalPatientsWaiting9,3472,02062020-06-01
S92000003202,007TotalPatientsWaiting8,9962,02072020-07-01
S92000003202,008TotalPatientsWaiting9,1812,02082020-08-01
S92000003202,009TotalPatientsWaiting9,6992,02092020-09-01
S92000003202,010TotalPatientsWaiting10,1512,020102020-10-01
S92000003202,011TotalPatientsWaiting10,7562,020112020-11-01
S92000003202,012TotalPatientsWaiting11,1662,020122020-12-01
S92000003202,101TotalPatientsWaiting10,7112,02112021-01-01
S92000003202,102TotalPatientsWaiting10,7442,02122021-02-01
S92000003202,103TotalPatientsWaiting11,0082,02132021-03-01
S92000003202,104TotalPatientsWaiting10,9112,02142021-04-01
S92000003202,105TotalPatientsWaiting11,5312,02152021-05-01
S92000003202,106TotalPatientsWaiting11,7222,02162021-06-01
S92000003202,107TotalPatientsWaiting11,3232,02172021-07-01
S92000003202,108TotalPatientsWaiting11,3322,02182021-08-01
S92000003202,109TotalPatientsWaiting11,8162,02192021-09-01
S92000003202,110TotalPatientsWaiting12,0832,021102021-10-01
S92000003202,111TotalPatientsWaiting12,1072,021112021-11-01
S92000003202,112TotalPatientsWaiting10,4522,021122021-12-01
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_Scotland_waiting %>%
+  mutate(.,year=lubridate::year(year_month)) %>% 
+  group_by(Metric,year) %>%
+  summarise(average=mean(Count,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Metricyearaveragemonths_included
TotalPatientsWaiting20134834.66712
TotalPatientsWaiting20146280.75012
TotalPatientsWaiting20156383.75012
TotalPatientsWaiting20166241.08312
TotalPatientsWaiting20176560.66712
TotalPatientsWaiting20188243.91712
TotalPatientsWaiting201910186.66712
TotalPatientsWaiting202010295.16712
TotalPatientsWaiting202111311.66712
+
+
+
+

People in contact with CAMHS

+
    +
  • Measure code: CYP01
  • +
  • Measure description: People in contact with children and young people’s mental health services at the end of the reporting period
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp01 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP01")
+CAMHS_reldata_cyp01 <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="CYP01")
+
+#Time series chart
+CAMHS_raw_chart_cyp01 <- CAMHS_data_cyp01 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp01)
+
+ +
#Underlying data
+CAMHS_data_cyp01 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2018-05-01People in contact222,156
2018-06-01People in contact225,407
2018-07-01People in contact218,557
2018-08-01People in contact213,702
2018-09-01People in contact218,764
2018-10-01People in contact227,845
2018-11-01People in contact223,744
2018-12-01People in contact227,679
2019-01-01People in contact229,217
2019-02-01People in contact233,831
2019-03-01People in contact241,926
2019-04-01People in contact218,678
2019-05-01People in contact230,443
2019-06-01People in contact225,480
2019-07-01People in contact226,647
2019-08-01People in contact218,826
2019-09-01People in contact221,428
2019-10-01People in contact225,507
2019-11-01People in contact230,739
2019-12-01People in contact231,056
2020-01-01People in contact236,396
2020-02-01People in contact240,401
2020-03-01People in contact237,088
2020-04-01People in contact281,199
2020-05-01People in contact273,706
2020-06-01People in contact272,529
2020-07-01People in contact275,439
2020-08-01People in contact271,462
2020-09-01People in contact286,880
2020-10-01People in contact296,414
2020-11-01People in contact309,311
2020-12-01People in contact311,119
2021-01-01People in contact307,335
2021-02-01People in contact306,997
2021-03-01People in contact317,845
2021-04-01People in contact323,240
2021-05-01People in contact337,426
2021-06-01People in contact340,694
2021-07-01People in contact342,565
2021-08-01People in contact331,912
2021-09-01People in contact337,080
2021-10-01People in contact349,449
2021-11-01People in contact357,802
2021-12-01People in contact355,807
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp01 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP01People in contact2019227814.812
CYP01People in contact2020274328.712
CYP01People in contact2021334012.712
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp01 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP01People in contact2019227386.29
CYP01People in contact2020263900.09
CYP01People in contact2021327232.79
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp01 <- CAMHS_reldata_cyp01 %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contactsn (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp01)
+
+ +
#Underlying data
+CAMHS_reldata_cyp01 %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2019-05-01People in contact3.7302616
2019-06-01People in contact0.0323859
2019-07-01People in contact3.7015515
2019-08-01People in contact2.3977314
2019-09-01People in contact1.2177506
2019-10-01People in contact-1.0261362
2019-11-01People in contact3.1263408
2019-12-01People in contact1.4832286
2020-01-01People in contact3.1319667
2020-02-01People in contact2.8097216
2020-03-01People in contact-1.9997851
2020-04-01People in contact28.5904389
2020-05-01People in contact18.7738400
2020-06-01People in contact20.8661522
2020-07-01People in contact21.5277502
2020-08-01People in contact24.0538144
2020-09-01People in contact29.5590440
2020-10-01People in contact31.4433698
2020-11-01People in contact34.0523275
2020-12-01People in contact34.6509071
2021-01-01People in contact30.0085450
2021-02-01People in contact27.7020478
2021-03-01People in contact34.0620360
2021-04-01People in contact14.9506222
2021-05-01People in contact23.2804542
2021-06-01People in contact25.0120171
2021-07-01People in contact24.3705503
2021-08-01People in contact22.2683101
2021-09-01People in contact17.4986057
2021-10-01People in contact17.8922048
2021-11-01People in contact15.6771017
2021-12-01People in contact14.3636358
+
+
+
+

New referrals (<18)

+
    +
  • Measure code: MHS32a
  • +
  • Measure description: Referrals starting in RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp32a <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS32a")
+CAMHS_reldata_cyp32a <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS32a")
+
+#Time series chart
+CAMHS_raw_chart_cyp32a <- CAMHS_data_cyp32a %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp32a)
+
+ +
#Underlying data
+CAMHS_data_cyp32a %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01New referrals (<18)64,095
2019-05-01New referrals (<18)71,119
2019-06-01New referrals (<18)67,449
2019-07-01New referrals (<18)71,743
2019-08-01New referrals (<18)46,403
2019-09-01New referrals (<18)64,284
2019-10-01New referrals (<18)83,290
2019-11-01New referrals (<18)79,100
2019-12-01New referrals (<18)65,547
2020-01-01New referrals (<18)84,624
2020-02-01New referrals (<18)80,555
2020-03-01New referrals (<18)72,532
2020-04-01New referrals (<18)41,411
2020-05-01New referrals (<18)46,262
2020-06-01New referrals (<18)60,370
2020-07-01New referrals (<18)67,967
2020-08-01New referrals (<18)51,357
2020-09-01New referrals (<18)75,222
2020-10-01New referrals (<18)88,523
2020-11-01New referrals (<18)92,228
2020-12-01New referrals (<18)75,841
2021-01-01New referrals (<18)68,149
2021-02-01New referrals (<18)70,169
2021-03-01New referrals (<18)98,112
2021-04-01New referrals (<18)85,598
2021-05-01New referrals (<18)101,421
2021-06-01New referrals (<18)98,037
2021-07-01New referrals (<18)85,801
2021-08-01New referrals (<18)57,289
2021-09-01New referrals (<18)84,264
2021-10-01New referrals (<18)89,264
2021-11-01New referrals (<18)103,865
2021-12-01New referrals (<18)82,908
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp32a %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS32aNew referrals (<18)202069741.0012
MHS32aNew referrals (<18)202185406.4212
+
+
+

Monthly average, per year (Apr to Dec)

+
#Average per calendar year
+CAMHS_data_cyp32a %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=4&month_num<=12) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS32aNew referrals (<18)201968114.449
MHS32aNew referrals (<18)202066575.679
MHS32aNew referrals (<18)202187605.229
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp32a <- CAMHS_reldata_cyp32a %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp32a)
+
+ +
#Underlying data
+CAMHS_reldata_cyp32a %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01New referrals (<18)-35.3912162
2020-05-01New referrals (<18)-34.9512788
2020-06-01New referrals (<18)-10.4953372
2020-07-01New referrals (<18)-5.2632313
2020-08-01New referrals (<18)10.6760339
2020-09-01New referrals (<18)17.0151204
2020-10-01New referrals (<18)6.2828671
2020-11-01New referrals (<18)16.5967130
2020-12-01New referrals (<18)15.7047615
2021-01-01New referrals (<18)-19.4684723
2021-02-01New referrals (<18)-12.8930544
2021-03-01New referrals (<18)35.2671924
2021-04-01New referrals (<18)106.7035329
2021-05-01New referrals (<18)119.2317669
2021-06-01New referrals (<18)62.3935730
2021-07-01New referrals (<18)26.2392043
2021-08-01New referrals (<18)11.5505189
2021-09-01New referrals (<18)12.0204196
2021-10-01New referrals (<18)0.8370706
2021-11-01New referrals (<18)12.6176432
2021-12-01New referrals (<18)9.3181788
+
+
+
+

New referrals to CYPMHS

+
    +
  • Measure code: CYP32
  • +
  • Measure description: Referrals to children and young people’s mental health services starting in RP
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp32 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP32")
+
+#Time series chart
+CAMHS_raw_chart_cyp32 <- CAMHS_data_cyp32 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_raw_chart_cyp32)
+
+ +
#Underlying data
+CAMHS_data_cyp32 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01New referrals to CYPMHS31,720
2019-05-01New referrals to CYPMHS35,911
2019-06-01New referrals to CYPMHS33,440
2019-07-01New referrals to CYPMHS36,383
2019-08-01New referrals to CYPMHS22,183
2019-09-01New referrals to CYPMHS31,203
2019-10-01New referrals to CYPMHS39,751
2019-11-01New referrals to CYPMHS37,604
2019-12-01New referrals to CYPMHS31,260
2020-01-01New referrals to CYPMHS38,604
2020-02-01New referrals to CYPMHS37,432
2020-03-01New referrals to CYPMHS32,784
2020-04-01New referrals to CYPMHS21,296
2020-05-01New referrals to CYPMHS25,712
2020-06-01New referrals to CYPMHS36,178
2020-07-01New referrals to CYPMHS43,268
2020-08-01New referrals to CYPMHS29,954
2020-09-01New referrals to CYPMHS52,857
2020-10-01New referrals to CYPMHS62,692
2020-11-01New referrals to CYPMHS65,453
2020-12-01New referrals to CYPMHS53,876
2021-01-01New referrals to CYPMHS45,639
2021-02-01New referrals to CYPMHS47,222
2021-03-01New referrals to CYPMHS67,551
2021-04-01New referrals to CYPMHS58,124
2021-05-01New referrals to CYPMHS70,991
2021-06-01New referrals to CYPMHS66,813
2021-07-01New referrals to CYPMHS59,115
2021-08-01New referrals to CYPMHS35,097
2021-09-01New referrals to CYPMHS57,092
2021-10-01New referrals to CYPMHS62,115
2021-11-01New referrals to CYPMHS72,526
2021-12-01New referrals to CYPMHS59,055
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp32 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP32New referrals to CYPMHS202041675.512
CYP32New referrals to CYPMHS202158445.012
+
+
+

Monthly average, per year (Apr to Dec)

+
#Average per calendar year
+CAMHS_data_cyp32 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=4&month_num<=12) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP32New referrals to CYPMHS201933272.789
CYP32New referrals to CYPMHS202043476.229
CYP32New referrals to CYPMHS202160103.119
+
+
+
+

First contacts (<18)

+
    +
  • Measure code: MHS61a
  • +
  • Measure description: First attended contacts for referrals open in the RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp61a <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS61a")
+CAMHS_reldata_cyp61a <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS61a")
+
+#Time series chart
+CAMHS_raw_chart_cyp61a <- CAMHS_data_cyp61a %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp61a)
+
+ +
#Underlying data
+CAMHS_data_cyp61a %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01First contacts (<18)51,694
2019-05-01First contacts (<18)49,335
2019-06-01First contacts (<18)47,035
2019-07-01First contacts (<18)48,293
2019-08-01First contacts (<18)36,352
2019-09-01First contacts (<18)45,982
2019-10-01First contacts (<18)54,568
2019-11-01First contacts (<18)54,309
2019-12-01First contacts (<18)41,945
2020-01-01First contacts (<18)56,823
2020-02-01First contacts (<18)52,305
2020-03-01First contacts (<18)51,555
2020-04-01First contacts (<18)43,246
2020-05-01First contacts (<18)38,816
2020-06-01First contacts (<18)46,559
2020-07-01First contacts (<18)47,685
2020-08-01First contacts (<18)39,035
2020-09-01First contacts (<18)49,839
2020-10-01First contacts (<18)56,951
2020-11-01First contacts (<18)60,651
2020-12-01First contacts (<18)49,468
2021-01-01First contacts (<18)50,832
2021-02-01First contacts (<18)48,337
2021-03-01First contacts (<18)59,245
2021-04-01First contacts (<18)57,734
2021-05-01First contacts (<18)62,337
2021-06-01First contacts (<18)63,397
2021-07-01First contacts (<18)55,473
2021-08-01First contacts (<18)43,083
2021-09-01First contacts (<18)56,285
2021-10-01First contacts (<18)59,256
2021-11-01First contacts (<18)64,298
2021-12-01First contacts (<18)51,273
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp61a %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS61aFirst contacts (<18)202049411.0812
MHS61aFirst contacts (<18)202155962.5012
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp61a %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS61aFirst contacts (<18)202047318.119
MHS61aFirst contacts (<18)202155191.449
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp61a <- CAMHS_reldata_cyp61a %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp61a)
+
+ +
#Underlying data
+CAMHS_reldata_cyp61a %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01First contacts (<18)-16.342322
2020-05-01First contacts (<18)-21.321577
2020-06-01First contacts (<18)-1.012012
2020-07-01First contacts (<18)-1.258982
2020-08-01First contacts (<18)7.380612
2020-09-01First contacts (<18)8.388065
2020-10-01First contacts (<18)4.367028
2020-11-01First contacts (<18)11.677623
2020-12-01First contacts (<18)17.935392
2021-01-01First contacts (<18)-10.543266
2021-02-01First contacts (<18)-7.586273
2021-03-01First contacts (<18)14.916109
2021-04-01First contacts (<18)33.501364
2021-05-01First contacts (<18)60.596146
2021-06-01First contacts (<18)36.164866
2021-07-01First contacts (<18)16.332180
2021-08-01First contacts (<18)10.370181
2021-09-01First contacts (<18)12.933646
2021-10-01First contacts (<18)4.047339
2021-11-01First contacts (<18)6.013091
2021-12-01First contacts (<18)3.648824
+
+
+
+

Attended contacts (<18)

+
    +
  • Measure code: MHS30d
  • +
  • Measure description: Attended contacts in the RP, aged 0-18
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp30d <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="MHS30d")
+CAMHS_reldata_cyp30d <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="MHS30d")
+
+#Time series chart
+CAMHS_raw_chart_cyp30d <- CAMHS_data_cyp30d %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp30d)
+
+ +
#Underlying data
+CAMHS_data_cyp30d %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2019-04-01Attended contacts (<18)307,328
2019-05-01Attended contacts (<18)346,997
2019-06-01Attended contacts (<18)337,476
2019-07-01Attended contacts (<18)363,594
2019-08-01Attended contacts (<18)274,323
2019-09-01Attended contacts (<18)335,775
2019-10-01Attended contacts (<18)388,130
2019-11-01Attended contacts (<18)383,387
2019-12-01Attended contacts (<18)305,574
2020-01-01Attended contacts (<18)402,520
2020-02-01Attended contacts (<18)361,178
2020-03-01Attended contacts (<18)384,011
2020-04-01Attended contacts (<18)365,212
2020-05-01Attended contacts (<18)360,525
2020-06-01Attended contacts (<18)424,827
2020-07-01Attended contacts (<18)425,810
2020-08-01Attended contacts (<18)336,675
2020-09-01Attended contacts (<18)419,474
2020-10-01Attended contacts (<18)435,613
2020-11-01Attended contacts (<18)473,103
2020-12-01Attended contacts (<18)397,443
2021-01-01Attended contacts (<18)426,820
2021-02-01Attended contacts (<18)412,003
2021-03-01Attended contacts (<18)488,234
2021-04-01Attended contacts (<18)437,736
2021-05-01Attended contacts (<18)463,893
2021-06-01Attended contacts (<18)469,830
2021-07-01Attended contacts (<18)443,801
2021-08-01Attended contacts (<18)350,766
2021-09-01Attended contacts (<18)437,555
2021-10-01Attended contacts (<18)419,382
2021-11-01Attended contacts (<18)479,458
2021-12-01Attended contacts (<18)382,887
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp30d %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS30dAttended contacts (<18)2020398865.912
MHS30dAttended contacts (<18)2021434363.812
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp30d %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
MHS30dAttended contacts (<18)2020386692.49
MHS30dAttended contacts (<18)2021436737.69
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp30d <- CAMHS_reldata_cyp30d %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp30d)
+
+ +
#Underlying data
+CAMHS_reldata_cyp30d %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2020-04-01Attended contacts (<18)18.834600
2020-05-01Attended contacts (<18)3.898593
2020-06-01Attended contacts (<18)25.883618
2020-07-01Attended contacts (<18)17.111393
2020-08-01Attended contacts (<18)22.729410
2020-09-01Attended contacts (<18)24.927109
2020-10-01Attended contacts (<18)12.233788
2020-11-01Attended contacts (<18)23.400898
2020-12-01Attended contacts (<18)30.064403
2021-01-01Attended contacts (<18)6.036967
2021-02-01Attended contacts (<18)14.072009
2021-03-01Attended contacts (<18)27.140629
2021-04-01Attended contacts (<18)19.858055
2021-05-01Attended contacts (<18)28.671521
2021-06-01Attended contacts (<18)10.593253
2021-07-01Attended contacts (<18)4.225124
2021-08-01Attended contacts (<18)4.185342
2021-09-01Attended contacts (<18)4.310398
2021-10-01Attended contacts (<18)-3.726014
2021-11-01Attended contacts (<18)1.343259
2021-12-01Attended contacts (<18)-3.662412
+
+
+
+

Open referrals

+
    +
  • Measure code: CYP23
  • +
  • Measure description: Open referrals (children’s and young people’s mental health services) at end of the reporting period
  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata
  • +
+
+

Raw time series

+
#Data
+CAMHS_data_cyp23 <- CAMHS_data %>%
+  filter(.,MEASURE_ID=="CYP23")
+CAMHS_reldata_cyp23 <- CAMHS_yearly_changes %>%
+  filter(.,MEASURE_ID=="CYP23")
+
+#Time series chart
+CAMHS_raw_chart_cyp23 <- CAMHS_data_cyp23 %>% 
+  ggplot(., aes(x=start_date, y=MEASURE_VALUE, group= MEASURE_KEY)) +
+  geom_line(aes(color= MEASURE_KEY),
+            size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "3 months") +
+  scale_y_continuous(labels = scales::comma) +
+  facet_wrap(~timing, scales = "free_x") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="") +
+  scale_color_brewer(palette = "Set1") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+  
+ggplotly(CAMHS_raw_chart_cyp23)
+
+ +
#Underlying data
+CAMHS_data_cyp23 %>%
+  select(.,start_date,MEASURE_KEY,MEASURE_VALUE) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYMEASURE_VALUE
2018-05-01Open referrals247,499
2018-06-01Open referrals251,573
2018-07-01Open referrals243,916
2018-08-01Open referrals238,803
2018-09-01Open referrals245,003
2018-10-01Open referrals255,855
2018-11-01Open referrals252,726
2018-12-01Open referrals256,644
2019-01-01Open referrals258,525
2019-02-01Open referrals264,305
2019-03-01Open referrals272,605
2019-04-01Open referrals248,038
2019-05-01Open referrals260,485
2019-06-01Open referrals255,950
2019-07-01Open referrals257,152
2019-08-01Open referrals248,313
2019-09-01Open referrals251,483
2019-10-01Open referrals256,252
2019-11-01Open referrals262,299
2019-12-01Open referrals261,939
2020-01-01Open referrals268,184
2020-02-01Open referrals272,482
2020-03-01Open referrals267,871
2020-04-01Open referrals307,837
2020-05-01Open referrals302,241
2020-06-01Open referrals301,012
2020-07-01Open referrals304,491
2020-08-01Open referrals300,469
2020-09-01Open referrals318,375
2020-10-01Open referrals329,392
2020-11-01Open referrals344,178
2020-12-01Open referrals345,569
2021-01-01Open referrals340,421
2021-02-01Open referrals340,218
2021-03-01Open referrals352,551
2021-04-01Open referrals358,282
2021-05-01Open referrals374,401
2021-06-01Open referrals379,079
2021-07-01Open referrals380,738
2021-08-01Open referrals368,610
2021-09-01Open referrals374,946
2021-10-01Open referrals388,237
2021-11-01Open referrals397,857
2021-12-01Open referrals397,147
+
+
+

Monthly average, per year

+
#Average per calendar year
+CAMHS_data_cyp23 %>%
+  mutate(.,year=lubridate::year(start_date)) %>% 
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==12) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP23Open referrals2019258112.212
CYP23Open referrals2020305175.112
CYP23Open referrals2021371040.612
+
+
+

Monthly average, per year (Jan to Sep)

+
#Average per calendar year
+CAMHS_data_cyp23 %>%
+  mutate(.,year=lubridate::year(start_date)) %>%
+  filter(.,month_num>=1&month_num<=9) %>%
+  group_by(MEASURE_ID,MEASURE_KEY,year) %>%
+  summarise(average=mean(MEASURE_VALUE,na.rm = TRUE),
+            months_included= n()) %>% 
+  ungroup() %>%
+  filter(.,months_included==9) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_IDMEASURE_KEYyearaveragemonths_included
CYP23Open referrals2019257428.49
CYP23Open referrals2020293662.49
CYP23Open referrals2021363249.69
+
+
+

Relative changes compared to last year

+
#Relative changes chart
+CAMHS_changes_chart_cyp23 <- CAMHS_reldata_cyp23 %>%
+  ggplot(., aes(x=start_date, y=pct_change_l1, group= MEASURE_KEY)) +
+  facet_wrap(~timing, scales = "free_x") +
+  geom_line(aes(color= MEASURE_KEY),size=1) +
+  geom_hline(yintercept=0, linetype="dashed", color = "red") +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  theme_ipsum() +
+  xlab("") +
+  ylab("% change") +
+  labs(col="") +
+  scale_color_manual(values=c("Open referrals" = "aquamarine4",
+                              "People in contact" = "tomato3",
+                              "First contacts (<18)" = "olivedrab4",
+                              "Attended contacts (<18)" = "violetred",
+                              "New referrals (<18)" = "magenta1")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(CAMHS_changes_chart_cyp23)
+
+ +
#Underlying data
+CAMHS_reldata_cyp23 %>%
+  select(.,start_date,MEASURE_KEY,pct_change_l1) %>%
+  arrange(.,start_date) %>% 
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
start_dateMEASURE_KEYpct_change_l1
2019-05-01Open referrals5.246890
2019-06-01Open referrals1.739853
2019-07-01Open referrals5.426458
2019-08-01Open referrals3.982362
2019-09-01Open referrals2.644866
2019-10-01Open referrals0.155166
2019-11-01Open referrals3.787897
2019-12-01Open referrals2.063169
2020-01-01Open referrals3.736196
2020-02-01Open referrals3.093774
2020-03-01Open referrals-1.736579
2020-04-01Open referrals24.108806
2020-05-01Open referrals16.030098
2020-06-01Open referrals17.605782
2020-07-01Open referrals18.408957
2020-08-01Open referrals21.004136
2020-09-01Open referrals26.599015
2020-10-01Open referrals28.542216
2020-11-01Open referrals31.215902
2020-12-01Open referrals31.927281
2021-01-01Open referrals26.935611
2021-02-01Open referrals24.858890
2021-03-01Open referrals31.612231
2021-04-01Open referrals16.386919
2021-05-01Open referrals23.874987
2021-06-01Open referrals25.934846
2021-07-01Open referrals25.040806
2021-08-01Open referrals22.678213
2021-09-01Open referrals17.768669
2021-10-01Open referrals17.864733
2021-11-01Open referrals15.596290
2021-12-01Open referrals14.925529
+
+
+
+

People with eating disorders being seen within target times (<18)

+
    +
  • Measure code: ED86e

  • +
  • Measure description: Proportion of referrals with eating disorders categorized as urgent cases entering treatment within one week in RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED87e

  • +
  • Measure description: Proportion of referrals with eating disorders categorized as routine cases entering treatment within four weeks in RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
+
#Eating disorders data
+target_time_ed_data_new <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED86e","ED87e")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE)
+
+target_time_ed_data <- MHSDS_ED_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED86e","ED87e")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>%
+  plyr::rbind.fill(.,target_time_ed_data_new) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="ED86e" ~ "Urgent",
+                        MEASURE_ID=="ED87e" ~ "Routine",
+                        TRUE ~ "NA"),
+         Metric="Starting within target time",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart
+target_time_ed_chart <- target_time_ed_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  scale_colour_manual(values=
+                        c("Urgent" = "brown", "Routine" = "darkseagreen4")) +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(target_time_ed_chart)
+
+ +
target_time_ed_data %>%
+  arrange(.,end_date) %>% 
+  select(.,MEASURE_ID,Type,start_date,end_date,time_window,MEASURE_VALUE) %>%
+  filter(.,start_date %in% ymd(c("2021-01-01","2021-04-01","2021-07-01","2021-10-01"))) %>%
+  group_by(MEASURE_ID,Type) %>%
+  summarise(.,MEASURE_VALUE=mean(MEASURE_VALUE)) %>% 
+  ungroup() %>%
+  knitr::kable(., align = "lccrr",format.args = list(big.mark = ","))
+ + + + + + + + + + + + + + + + + + + + +
MEASURE_IDTypeMEASURE_VALUE
ED86eUrgent39.05812
ED87eRoutine48.96245
+
+
+

New referrals into eating disorder services (<18)

+
    +
  • Measure code: ED32

  • +
  • Measure description: Referrals into a service with a primary reason of referral of Eating Disorder received in the reporting period, among those aged 0-18.

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED88

  • +
  • Measure description: The number of referrals to eating disorder services for eating disorder issues for people aged 0 - 18 waiting for treatment at the end of the reporting period

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED89

  • +
  • Measure description: Referrals with eating disorder issues categorized as urgent waiting for treatment end RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
  • Measure code: ED90

  • +
  • Measure description: Referrals with eating disorder issues categorized as routine waiting for treatment end RP, aged 0-18

  • +
  • Source: NHS England, Monthly MHSDS Statistics, Metadata

  • +
+
#Eating disorders data
+ref_ed_data_new <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED89","ED90")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE)
+
+ref_ed_data_new <- MHSDS_ED_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED89","ED90")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>%
+  plyr::rbind.fill(.,ref_ed_data_new) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="ED89" ~ "Urgent",
+                        MEASURE_ID=="ED90" ~ "Routine",
+                        TRUE ~ "NA"),
+         Metric="Waiting for treatment",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 2
+ref_ed_chart <- ref_ed_data_new %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(ref_ed_chart)
+
+ +
#Crisis referrals
+crisis_referrals_data <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("CCR70b","CCR71b")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Type=case_when(MEASURE_ID=="CCR71b" ~ "Urgent",
+                        MEASURE_ID=="CCR70b" ~ "Emergency",
+                        TRUE ~ "NA"),
+         Metric="New referrals",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 2
+crisis_referrals_chart <- crisis_referrals_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE, group=Type)) +
+  geom_line(aes(color=Type),size=1) +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm"),size = 8),
+        axis.title.y = element_text(size = 8))
+
+ggplotly(crisis_referrals_chart)
+
+ +
crisis_referrals_data_flourish <- crisis_referrals_data %>% 
+  select(.,end_date,time_window,MEASURE_VALUE,Metric,Type) %>%
+  pivot_wider(
+    names_from = "Type",
+    names_sep = ".",
+    values_from = c(MEASURE_VALUE)
+  ) %>%
+  arrange(.,end_date)
+
+#fwrite(crisis_referrals_data_flourish,paste0(onedrive_charts_data,"crisis_charts.csv"))
+
#ED referrals
+ED_referrals_data <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID %in% c("ED32")) %>%
+  select(.,start_date,end_date,PRIMARY_LEVEL_DESCRIPTION,MEASURE_ID,MEASURE_VALUE) %>% 
+  mutate(.,MEASURE_VALUE=as.numeric(MEASURE_VALUE),
+         Metric="New referrals",
+         time_window=ymd(end_date)-ymd(start_date))
+
+#Eating disorders chart 3
+ED_referrals_chart <- ED_referrals_data %>%
+  ggplot(., aes(x=end_date, y=MEASURE_VALUE)) +
+  geom_line() +
+  scale_x_date(date_labels = "%b %Y",date_breaks = "1 month") +
+  scale_y_continuous(labels = scales::comma) +
+  theme_ipsum() +
+  xlab("") +
+  ylab("") +
+  labs(col="", title="") +
+  theme(legend.position="bottom",
+        panel.border = element_blank(),
+        strip.text = element_text(size=8),
+        text = element_text(size = 8),
+        legend.title=element_text(size=8),
+        legend.text=element_text(size=8),
+        axis.text = element_text(size = 8),
+        axis.text.y = element_text(size = 8),
+        axis.text.x = element_text(angle = 45, hjust = 1,size = 8),
+        axis.title.y = element_text(size = 8))
+
+#ggplotly(ED_referrals_chart)
+
+ED_referrals_data_flourish <- ED_referrals_data %>% 
+  select(.,end_date,time_window,MEASURE_VALUE,Metric) %>%
+  arrange(.,end_date)
+
+#fwrite(ED_referrals_data_flourish,paste0(onedrive_charts_data,"EDref_charts.csv"))
+
+
+

Health Education England data on workforce (compared to activity levels from NHS England)

+
    +
  • Source of staff numbers is Health Education England report
  • +
+
#NHS Digital on people in contact with CAMHS service
+CAMHS_contacts <- MHSDS_main_pooled_dashboard %>%
+  filter(.,PRIMARY_LEVEL_DESCRIPTION=="England",
+         MEASURE_ID=="CYP01") %>%
+  select(.,start_date,MEASURE_VALUE) %>%
+  mutate(.,date_ymd=lubridate::ymd(start_date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="People in contact CAMHS",
+         MEASURE_VALUE=as.numeric(MEASURE_VALUE)) %>%
+  select(.,-"start_date") %>%
+  arrange(.,date_ymd)
+
+#Turn into indexed data
+CAMHS_contacts_index <- CAMHS_contacts %>%
+  mutate(.,MEASURE_VALUE_MA=zoo::rollmean(MEASURE_VALUE,k=7,fill=NA)) %>% #Use a moving average to compute the mean
+  mutate(.,Jan2019=filter(.,date_ymd=="2019-01-01")$MEASURE_VALUE_MA) %>%
+  filter(.,date_ymd>=ymd("2019-01-01"),!is.na(MEASURE_VALUE_MA)) %>%
+  mutate(.,index=MEASURE_VALUE_MA/Jan2019*100)
+
+#HEE data (copied over from report)
+HEE_staff_index <- data.frame(measure="CYP MH staff",
+  date_ymd=as.Date(c("2019-01-01","2021-04-01")),
+  MEASURE_VALUE=as.numeric(c("14857","20626"))) %>%
+  mutate(.,Jan2019=filter(.,date_ymd=="2019-01-01")$MEASURE_VALUE) %>%
+  mutate(.,index=MEASURE_VALUE/Jan2019*100)
+
+#Append two sources together
+CAMHS_and_HEE_staff <- plyr::rbind.fill(CAMHS_contacts_index,HEE_staff_index)
+
+#Show data
+CAMHS_and_HEE_staff %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MEASURE_VALUEdate_ymdmeasureMEASURE_VALUE_MAJan2019index
2292172019-01-01People in contact CAMHS228988.6228988.6100.00000
2338312019-02-01People in contact CAMHS229359.7228988.6100.16208
2419262019-03-01People in contact CAMHS229607.7228988.6100.27038
2186782019-04-01People in contact CAMHS229460.3228988.6100.20600
2304432019-05-01People in contact CAMHS227975.9228988.699.55774
2254802019-06-01People in contact CAMHS226204.0228988.698.78397
2266472019-07-01People in contact CAMHS223858.4228988.697.75965
2188262019-08-01People in contact CAMHS225581.4228988.698.51209
2214282019-09-01People in contact CAMHS225669.0228988.698.55033
2255072019-10-01People in contact CAMHS227228.4228988.699.23134
2307392019-11-01People in contact CAMHS229193.3228988.6100.08940
2310562019-12-01People in contact CAMHS231802.1228988.6101.22870
2363962020-01-01People in contact CAMHS240340.9228988.6104.95758
2404012020-02-01People in contact CAMHS247226.4228988.6107.96453
2370882020-03-01People in contact CAMHS253196.4228988.6110.57164
2811992020-04-01People in contact CAMHS259536.9228988.6113.34053
2737062020-05-01People in contact CAMHS264546.3228988.6115.52816
2725292020-06-01People in contact CAMHS271186.1228988.6118.42781
2754392020-07-01People in contact CAMHS279661.3228988.6122.12893
2714622020-08-01People in contact CAMHS283677.3228988.6123.88273
2868802020-09-01People in contact CAMHS289022.0228988.6126.21678
2964142020-10-01People in contact CAMHS293994.3228988.6128.38819
3093112020-11-01People in contact CAMHS298502.6228988.6130.35697
3111192020-12-01People in contact CAMHS305128.7228988.6133.25063
3073352021-01-01People in contact CAMHS310323.0228988.6135.51899
3069972021-02-01People in contact CAMHS316181.9228988.6138.07757
3178452021-03-01People in contact CAMHS320665.1228988.6140.03544
3232402021-04-01People in contact CAMHS325157.4228988.6141.99723
3374262021-05-01People in contact CAMHS328668.4228988.6143.53049
3406942021-06-01People in contact CAMHS332966.0228988.6145.40726
3425652021-07-01People in contact CAMHS337480.9228988.6147.37891
3319122021-08-01People in contact CAMHS342418.3228988.6149.53510
3370802021-09-01People in contact CAMHS345044.1228988.6150.68182
148572019-01-01CYP MH staffNA14857.0100.00000
206262021-04-01CYP MH staffNA14857.0138.83018
+
+
+

NHS England data on workforce (child and adolescent psychiatry only)

+
#NHS data
+NHS_workforce_doctors %>%
+  mutate(.,date_ymd=lubridate::ymd(Date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="FTE doctors") %>%
+  rename(.,MEASURE_VALUE=FTE) %>%
+  filter(Specialty %in% c("Child and adolescent psychiatry")) %>%
+  group_by(date_ymd,measure,Specialty) %>%
+  summarise(MEASURE_VALUE=sum(MEASURE_VALUE,na.rm=TRUE)) %>% #Aggregate over categories
+  ungroup() %>%
+  filter(., date_ymd %in% c(ymd("2019-01-01"),ymd("2021-04-01"))) %>%
+  pivot_wider(
+    names_from = date_ymd,
+    names_sep = ".",
+    values_from = MEASURE_VALUE
+  ) %>%
+  mutate(.,pct_change=(`2021-04-01`-`2019-01-01`)/`2019-01-01`*100) %>%
+  knitr::kable(., align = "lccrr")
+ + + + + + + + + + + + + + + + + + + +
measureSpecialty2019-01-012021-04-01pct_change
FTE doctorsChild and adolescent psychiatry981.68231064.2568.411452
+
#Latest data on consultants
+NHS_workforce_doctors %>%
+  mutate(.,date_ymd=lubridate::ymd(Date)) %>%
+  mutate(.,date_ymd=floor_date(date_ymd, "month"),
+         measure="FTE doctors") %>%
+  rename(.,MEASURE_VALUE=FTE) %>%
+  filter(., date_ymd %in% c(ymd("2021-05-01"))) %>%
+  filter(Specialty %in% c("Child and adolescent psychiatry"))  %>%
+  select(.,-"Date") %>% 
+  knitr::kable(., align = "lccrr")
+ +++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GradeGrade Order CodeSpecialty GroupSpecialtyMEASURE_VALUEdate_ymdmeasure
Consultant1Psychiatry groupChild and adolescent psychiatry626.54702021-05-01FTE doctors
Associate Specialist2Psychiatry groupChild and adolescent psychiatry13.37252021-05-01FTE doctors
Specialty Doctor3Psychiatry groupChild and adolescent psychiatry100.92102021-05-01FTE doctors
Staff Grade4Psychiatry groupChild and adolescent psychiatry3.50002021-05-01FTE doctors
Specialty Registrar5Psychiatry groupChild and adolescent psychiatry144.86882021-05-01FTE doctors
Core Training6Psychiatry groupChild and adolescent psychiatry142.10622021-05-01FTE doctors
Foundation Doctor Year 27Psychiatry groupChild and adolescent psychiatry10.00002021-05-01FTE doctors
Foundation Doctor Year 18Psychiatry groupChild and adolescent psychiatry10.00002021-05-01FTE doctors
+
+ + + + +
+ + + + + + + + + + + + + + +