forked from britishredcrosssociety/covid-19-vulnerability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathward-vulnerability.Rmd
93 lines (76 loc) · 3.95 KB
/
ward-vulnerability.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
output:
html_document:
theme: null
highlight: null
css: styles.css
---
```{r knitr_init, echo=FALSE, cache=FALSE}
library(knitr)
## Global options
opts_chunk$set(echo=FALSE,
cache=FALSE,
prompt=FALSE,
tidy=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
#opts_knit$set(width=75)
```
```{r load_packages, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(tidyverse)
library(sf)
library(leaflet)
```
```{r load_bounds, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
# source("prep vulnerability index.r")
wards_vulnerability = read_sf("output/most-vulnerable-wards.geojson")
pal_vuln = colorFactor("Reds", 1:5)
```
<!--html_preserve-->
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;border:none;}
.tg td{padding:1px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;}
.tg .tg-us36{border-color:inherit;vertical-align:top}
</style>
<div style="z-index: 1; position: absolute; top: 0px; left: 50px; background-color: rgba(255, 255, 255, 0.6); padding: 5px 5px 5px 5px; font-size: 12px; width: 350px">
<h3>COVID-19 Vulnerability Index</h3>
<p>This map shows wards in the UK where people might be highly vulnerable to COVID-19 and/or experiencing unmet needs. There is also a <a href="lad.html">map showing vulnerability in Local Authorities</a>.</p>
<p>The COVID-19 vulnerability index is composed of <b>clinical vulnerability</b> and <b>social vulnerability</b>. Clinical vulnerability will help identify who is likely to transition from 'social distancing' to 'self-isolating/quarantining' and back, allowing us to account for the potential differing needs of those two groups. Social vulnerability will identify whether someone has unmet needs by modelling their existing social support and isolation.</p>
<p>Wards coloured in darker shades of red are more vulnerable. Note that clinical data doesn't exist for every ward. Click on wards for more information.</p>
</div>
<!--/html_preserve-->
```{r map}
leaflet(wards_vulnerability,
width = "100%", height = "100%", padding = 0,
options = leafletOptions(minZoom = 5, maxZoom = 12, attributionControl = T)) %>%
# centre map on Whitendale Hanging Stones, the centre of GB: https://en.wikipedia.org/wiki/Centre_points_of_the_United_Kingdom
setView(lat = 54.00366, lng = -2.547855, zoom = 7) %>%
addProviderTiles(providers$CartoDB.Positron) %>%
# wards
addPolygons(weight = 1, smoothFactor = 0.5, fillOpacity = 0.7,
color = "grey", fillColor = ~pal_vuln(Vulnerability_q),
highlightOptions = highlightOptions(color = "grey", weight = 2, bringToFront = T),
label = ~wd17nm,
popup = ~paste0(
"<b>", wd17nm, "</b><br/><br/>",
"<b>Overall vulnerability: ", Vulnerability_q, " (5 is worst)</b><br/><br/>",
"<b>Clinical vulnerability: ", Clinical_Risk_q, " (5 is worst)</b><br/>",
"COPD prevalence: ", round(COPD_mean, 1), "%<br/>",
"Coronary heart disease prevalence: ", round(CHD_mean, 1), "%<br/>",
"Heart failure prevalance: ", round(HF_mean, 1), "%<br/>",
"Peripheral arterial disease prevalence: ", round(PAD_mean, 1), "%<br/><br/>",
"<b>Social vulnerability:</b><br/>",
"COVID-19 deprivation score: ", Deprivation_q, " (5 is worst)</b><br/>",
"Neighbourhoods in 20% most-deprived: ", round(Prop_top20 * 100, 1), "%<br/>",
"Neighbourhoods with high risk of loneliness", round(Prop_loneliest * 100, 1), "%"
)
) %>%
addLegend("bottomright",
pal = pal_vuln,
values = ~Vulnerability_q,
title = "Vulnerability index\n(5 is most vulnerable)",
opacity = 1
# group = "LRFs, EPGs & LRPs"
)
```