-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.Rmd
283 lines (231 loc) · 8.14 KB
/
index.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
---
title: "Texas COVID-19 Vaccine Tracker"
image: "lbj_logo.png"
color1: "#5A59A3"
color2: "#C66060"
angle: 130
links:
# - label: Providers
# url: "providers.html"
- label: Pace
url: "pace.html"
- label: Equity
url: "equity.html"
# - label: Access
# url: "providers.html"
# - label: Blog
# url: "blog.html"
site: distill::distill_website
output:
postcards::onofre
---
```{r message=FALSE, warning=FALSE, include=FALSE}
library(metathis)
meta() %>%
meta_social(
title = "The Texas COVID-19 Vaccine Tracker",
description = "Tracking the rollout of COVID-19 Vaccines in Texas",
url = "https://texasvaccinetracker.com",
image = "https://texasvaccinetracker.com/cover_image.png",
image_alt = "Distribution of Doses by Race, Age, and Gender.",
og_type = "website",
og_author = "The LBJ School",
twitter_card_type = "summary",
twitter_creator = "@TheLBJSchool"
)
```
```{r message=FALSE, warning=FALSE, include=FALSE}
knitr::opts_chunk$set()
library(gt)
library(tidyverse)
library(ggforce)
library(highcharter)
library(readxl)
library(janitor)
library(reactable)
library(htmltools)
library(tippy)
library(lbjdata)
library(zoo)
today <- Sys.Date()
today_lbl <- format(Sys.Date(), format = "%b %d, %Y")
time_lbl <- format(Sys.time(), format = "%I:%M %p")
src <- "https://dshs.texas.gov/immunize/covid19/COVID-19-Vaccine-Data-by-County.xls" # URL For Daily COVID Data
lcl <- basename(src)
filepath <- paste0("raw_data/", today,"_",lcl,"x")
download.file(url = src, destfile = filepath) # Downloads The Data
vaccine_summ <- read_excel(filepath, sheet = 4, skip=0, col_types = c("text",
"date", "numeric")) %>%
clean_names() %>%
group_by(date=vaccination_date) %>%
summarise(daily_doses = sum(doses_administered)) %>%
mutate(date=as.Date(date)) %>%
mutate(new_doses_7_day_avg= rollmean(daily_doses, 7, fill =0,
align = "right")) %>%
mutate(date = as.Date(date, format("%b %d %Y"))) %>%
ungroup()
latest_date <- vaccine_summ %>% drop_na(date) %>% filter(date==max(as.Date(date))) %>% select(date)
date_text <- format(latest_date$date, format="%b %d, %Y")
pop_16_num <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(population_12)
pop_16_text <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(population_12) %>%
mutate(population_12 = scales::comma(as.numeric(population_12)))
full_vax_text <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(people_fully_vaccinated) %>%
mutate(people_fully_vaccinated = scales::comma(as.numeric(people_fully_vaccinated)))
full_vax_pct_text <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(people_fully_vaccinated, population_12) %>%
mutate(pct_fully_vax = as.numeric(people_fully_vaccinated)/as.numeric(population_12)) %>%
mutate(pct_fully_vax = scales::percent(round(pct_fully_vax, digits=3))) %>%
select(pct_fully_vax)
partial_vax_text <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(people_vaccinated_with_at_least_one_dose) %>%
mutate(people_vaccinated_with_at_least_one_dose = scales::comma(as.numeric(people_vaccinated_with_at_least_one_dose)))
partial_vax_pct_text <- read_excel(filepath, sheet = 2, skip=0) %>%
clean_names() %>%
filter(county_name=="Texas") %>%
select(people_vaccinated_with_at_least_one_dose) %>%
mutate(population_12 = pop_16_num) %>%
mutate(at_least_one_pct = as.numeric(people_vaccinated_with_at_least_one_dose)/as.numeric(population_12)) %>%
mutate(at_least_one_pct = scales::percent(round(at_least_one_pct, digits=4))) %>%
select(at_least_one_pct)
yesterday_vax_text <- vaccine_summ %>%
drop_na(date) %>%
filter(date==max(as.Date(date))) %>%
select(daily_doses) %>%
mutate(daily_doses = scales::comma(as.numeric(daily_doses)))
yesterday_vax_pct_text <- vaccine_summ %>%
drop_na(date) %>%
filter(date==max(as.Date(date))) %>%
select(daily_doses) %>%
mutate(population_12 = pop_16_num) %>%
mutate(daily_doses_oct = as.numeric(daily_doses)/as.numeric(population_12)) %>%
mutate(daily_doses_oct = scales::percent(round(daily_doses_oct, digits=4), accuracy = .01)) %>%
select(daily_doses_oct)
avg7day_vax_text <- vaccine_summ %>%
drop_na(date) %>%
filter(date==max(as.Date(date))) %>%
select(new_doses_7_day_avg) %>%
mutate(new_doses_7_day_avg = scales::comma(as.numeric(new_doses_7_day_avg)))
avg7day_vax_pct_text <- vaccine_summ %>%
drop_na(date) %>%
filter(date==max(as.Date(date))) %>%
select(new_doses_7_day_avg) %>%
mutate(population_12 = pop_16_num) %>%
mutate(avg7_day_pct = as.numeric(new_doses_7_day_avg)/as.numeric(population_12)) %>%
mutate(avg7_day_pct = scales::percent(round(avg7_day_pct, digits=4), accuracy = .01)) %>%
select(avg7_day_pct)
```
The reach of COVID-19 on Texas and the world has been devastating. As our state joins a global effort to put coronavirus into our past, we are tracking the Texas vaccine roll-out as it unfolds in real-time.
Texas has <u>`r pop_16_text`</u> people aged 12 and older who are currently eligible for the vaccine. As of <u>`r date_text`</u>, the state has:
:::{line-height="1.4px"}
> <i class="fad fa-battery-full fa-fw fa-lg" style="color:#f8971f"></i> | **Fully Vaccinated:** <u>`r full_vax_text`</u> people or <u>`r full_vax_pct_text`</u> of the population 12+</br>
> <i class="fad fa-battery-half fa-fw fa-lg" style="color:#f8971f"></i> | **Vaccinated w/ At Least One Dose:** <u>`r partial_vax_text`</u> people or <u>`r partial_vax_pct_text`</u> of the population 12+</br>
> <i class="fad fa-calendar fa-fw fa-lg" style="color:#f8971f"></i> | **Administered**: <u>`r yesterday_vax_text`</u> doses in one day on `r date_text` or <u>`r yesterday_vax_pct_text`</u> of the population 12+</br>
> <i class="fad fa-tachometer-alt-average fa-fw fa-lg" style="color:#f8971f"></i> | **A 7-Day Average** of <u>`r avg7day_vax_text`</u> administered per day or <u>`r avg7day_vax_pct_text`</u> of the population 12+</br>
:::
### Explore More Texas Vaccine Data:
```{css, echo=FALSE}
body {
background: transparent !important;
background: linear-gradient(120deg, rgba(51, 63, 72, .8) 50%,
rgba(191, 87, 0, 0.35) 150%),
/* bottom, image */
url(textures_ut_thick_panels.jpg) no-repeat center center fixed !important;
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size:cover !important;
}
.pl-5 img{
margin-top: 3rem !important;
}
.col-lg-6 {
-ms-flex: 0 0 50%;
flex: 0 0 60%;
max-width: 60%;
}
.rounded-circle {
border-radius: 0%!important;
}
h3 {
font-weight:700;
}
img {
height: 3rem !important;
}
h1 {
font-weight:900;
font-size: 2.7rem !important;
}
p {
font-size: 1.05rem !important;
}
@media only screen and (max-width: 600px) {
body {
background: transparent !important;
background: linear-gradient(120deg, rgba(51, 63, 72, .8) 50%,
rgba(191, 87, 0, 0.35) 150%),
/* bottom, image */
url(textures_ut_thick_panels.jpg) no-repeat center center fixed !important;
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size:cover !important;
}
.col-lg-6 {
-ms-flex: 0 0 50%;
flex: 0 0 100%;
max-width: 100%;
}
.rounded-circle {
border-radius: 0%!important;
}
img {
height: 1.5rem !important;
display: block;
margin-left: auto;
margin-right: auto;
}
h1 {
font-weight:900;
font-size: 2.5rem !important;
text-align:center !important;
}
h3 {
font-weight:700;
text-align:center !important;
}
button {
background-color: rgba(191, 87, 0, 0.85) !important;
color: white !important;
font-weight: 600 !important;
border-color: rgba(191, 87, 0, 0.85) !important;
}
p {
font-size: 1.05rem !important;
text-align:center !important;
}
.pl-5, .px-5 {
padding-left: 0rem!important;
}
.pb-1, .py-1 {
padding-bottom: 0rem!important;
}
}
.p-2 {
padding: .5rem!important;
color: #fff;
}
```