40250 patients recorded as having died over a 5 year period.
169 deaths per week over 9 clinical systems.
WHERE DO YOU START?
Start by looking at the patterns in a public health context…
October 2019
40250 patients recorded as having died over a 5 year period.
169 deaths per week over 9 clinical systems.
WHERE DO YOU START?
Start by looking at the patterns in a public health context…
Introduce seasonality effects in deaths.
Difference in gender and longevity.
Key data issues:
date | Total deaths, all ages |
---|---|
2018-01-05 | 12723 |
2018-01-12 | 15050 |
2018-01-19 | 14256 |
2018-01-26 | 13935 |
2018-02-02 | 13285 |
amongst other packages, Janitor commands:
df <- DeathsImport %>% clean_names %>% remove_empty(c("rows","cols"))
All the steps to transform the data:
https://nhsrcommunity.com/blog/format-ons-spreadsheet/
I used lots of steps, perhaps could be smarter
https://nhsrcommunity.com/blog/dygraphs/
How to create the interactive dygraph chart using the ONS data and generating some random data for comparison.
Using qicharts2 c chart (Poisson distribution)
#qicharts2 code Suic_Plot <- qic(WeekRnd, n, data = Suic, chart = "c", title = "Suspected Suicide Deaths", subtitle = "SPC c Chart by week", caption = "As recorded on Ulysses", ylab = "Number", xlab = "Time", x.angle = 45) + scale_y_continuous(breaks = pretty_breaks(3))
Patients who died who are outside of the upper control limit from the previous chart.
#Get the dates where the points are outside of the control limits Suic_Sigma <- Suic_Plot$data %>% filter(sigma.signal == TRUE) %>% mutate(WeekRnd = as.Date(x)) #mutate(Week = as.Date(x) %m-% weeks(1)) #for mR charts (Gaussian) #Taking these dates join back to the data set to get patient details Suicide_Pseudo <- Deaths_Services %>% filter(!is.na(Suicide)) %>% inner_join(Suic_Sigma) %>% select(MergedID, SI, CoronersVerdict, Suicide) %>% group_by(MergedID, CoronersVerdict, Suicide) %>% slice(1) %>% ungroup() %>% mutate(ID = row_number(MergedID)) %>% select(ID, SI, CoronersVerdict, IncidentCategory = Suicide) %>% arrange(ID)
ID | SI | CoronersVerdict | IncidentCategory |
---|---|---|---|
1 | Y | Narrative | Suicide - Apparent |
2 | Y | Narrative | Suicide - Apparent |
3 | N | Drug Related | Suicide - Apparent |
4 | Y | NA | Suicide - Apparent |
5 | Y | Open | Suicide - Apparent |
6 | Y | Suicide | Suicide - Apparent |
7 | Y | NA | Suicide - Apparent |
8 | N | NA | Suicide - Confirmed |
T charts are used for rare events (exponential distribution)
Using ggplotly the charts can be made interactive.
Downsides: - caption and subtitle doesn't work
ggplotly(tChart_Suicide)
@IantheBee - the Public Health Consultant who built this report in R before he retired and I took it on
@_JohnMackintosh - who blogged about how to access the data behind the qicharts2 charts
@ChrisBeeley - leading open use of R in the NHS through example
https://improvement.nhs.uk/resources/making-data-count/ - SPC campaign #plotthedots
Find me: @AppliedInfoNott and @Letxuga007