Mapping the quality of adult social care

A key element for a health system is the quality of their services. Knowing how good (or bad) health centres are doing may be useful for policy makers to assess their performance and propose improvements. For other services such as residential and nursing care homes, quality is an important aspect to motivate the choice of certain premises over others.

In this post I look at the quality of care homes. Every month, the CQC releases information relative to the quality inspections carried out in care homes. Care homes may obtain 4 ratings: Outstanding, Good, Requires Improvement and Inadequate. I compile a data.frame that contains information on all registered care homes up to October 2018. A simplified version of this data.frame

care_homes = read_csv("data/care-homes-2018-clean.csv")  %>% 
  filter(location_status == "active") %>%
  select(location_id, location_name, 
         location_latest_overall_rating, 
         location_longitude, 
         location_latitude, 
         location_region) 

glimpse(care_homes)
## Observations: 16,076
## Variables: 6
## $ location_id                    <chr> "1-1000210669", "1-1000401911", "…
## $ location_name                  <chr> "Kingswood House Nursing Home", "…
## $ location_latest_overall_rating <chr> "Requires improvement", "Good", "…
## $ location_longitude             <dbl> 0.561998, 0.002335, -3.508053, -1…
## $ location_latitude              <dbl> 50.85724, 51.44110, 50.72154, 54.…
## $ location_region                <chr> "South East", "London", "South We…

How is the quality of care homes per region?

Are some regions having relatively better (or worse) care homes than others? Using grouped operations with dplyr::group_by() and janitor::tabyl() it is possible to create the following frequency table.

care_homes %>%
  filter(location_region != "Unspecified", !is.na(location_latest_overall_rating)) %>%
  rename(Region = location_region, Rating = location_latest_overall_rating) %>%
  group_by(Region) %>%
  tabyl(Region, Rating) %>%
  adorn_totals("row") %>%
  adorn_percentages("row") %>%
  adorn_pct_formatting() %>%
  adorn_ns() %>%
  adorn_title("combined") %>%
  kable()
Region/Rating Outstanding Good Requires improvement Inadequate
East Midlands 1.7% (25) 80.6% (1162) 16.4% (236) 1.3% (19)
East of England 1.5% (25) 81.1% (1329) 14.8% (243) 2.6% (42)
London 1.1% (15) 81.3% (1106) 16.9% (230) 0.7% (10)
North East 1.8% (13) 79.3% (585) 17.8% (131) 1.2% (9)
North West 1.5% (27) 70.6% (1276) 23.9% (432) 4.0% (72)
South East 2.6% (75) 77.1% (2239) 18.6% (541) 1.7% (49)
South West 3.4% (68) 76.4% (1541) 18.7% (378) 1.5% (31)
West Midlands 1.8% (29) 76.0% (1217) 19.9% (318) 2.4% (38)
Yorkshire and The Humber 1.7% (24) 71.8% (1025) 24.0% (343) 2.5% (35)
Total 2.0% (301) 76.9% (11480) 19.1% (2852) 2.0% (305)

Most care homes are good - although only a 2% are classified as “Outstanding”. More worringly, about a 20% are “Inadequate”" or “Require improvements”. The South West is the region with a higher proportion of excellent care homes whereas the North West registers the greatest proportion of inadequate care homes. London is the region with less proportion of care homes in both quality extremes.

Where are the care homes?

A nice option is to create an interactive map with leaflet() that enables to select each category. To do that there are two previous steps:

  • Define the colour palette.
  • Create data frames considering each category.
# Define  palette
pal <- colorFactor(palette = c("dodgerblue3", "aquamarine4", "darkorange1", "firebrick2"), 
                   levels = c("Outstanding", "Good", "Requires improvement", "Inadequate"))


# Define datasets according to their quality
outstanding = care_homes %>% filter(location_latest_overall_rating == "Outstanding")
good = care_homes %>% filter(location_latest_overall_rating == "Good")
improvement = care_homes %>% filter(location_latest_overall_rating == "Requires improvement")
inadequate = care_homes %>% filter(location_latest_overall_rating == "Inadequate")

The map uses to main functions leaflet::addCircleMarkers() and leaflet::addLayersControl() that control the characteristics of the points and the layers that are displayed.

leaflet() %>% 
        addProviderTiles("CartoDB", group = "Carto") %>% 
        addCircleMarkers(data = outstanding,
                         radius = 0.2,
                         weight = 0.75,
                         lng = ~location_longitude, lat = ~location_latitude, 
                         label = ~htmlEscape(location_name),
                         color = ~pal(location_latest_overall_rating),  group = "Outstanding") %>% 
        addCircleMarkers(data = good,
                         radius = 0.2,
                         weight = 0.75,
                         lng = ~location_longitude, lat = ~location_latitude, 
                         label = ~htmlEscape(location_name),
                           color = ~pal(location_latest_overall_rating), group = "Good")  %>% 
        addCircleMarkers(data = improvement, 
                         radius = 0.2,
                         weight = 0.75,
                        lng = ~location_longitude, lat = ~location_latitude, 
                         label = ~htmlEscape(location_name),
                         color = ~pal(location_latest_overall_rating), group = "Requires improvement")  %>% 
        addCircleMarkers(data = inadequate, 
                         radius = 0.2,
                         weight = 0.75,
                        lng = ~location_longitude, lat = ~location_latitude, 
                         label = ~htmlEscape(location_name),
                         color = ~pal(location_latest_overall_rating), group = "Inadequate") %>% 
          addLayersControl(overlayGroups = c("Outstanding", "Good", "Requires improvement", "Inadequate")) %>% 
           setView(lng = 1, lat = 53, zoom = 5.85)

Et voilà. I hope this post helps to have a clearer idea about the current quality of care homes that provide adult social care.

The whole code is on Github