|
| 1 | +--- |
| 2 | +title: "Quidel dashboard" |
| 3 | +author: "Delphi Lab" |
| 4 | +date: "`r format(Sys.time(), '%B %d, %Y')`" |
| 5 | +output: |
| 6 | + html_document: |
| 7 | + code_folding: hide |
| 8 | +--- |
| 9 | + |
| 10 | +```{r, include = FALSE} |
| 11 | +knitr::opts_chunk$set(message = FALSE, warning = FALSE) |
| 12 | +``` |
| 13 | + |
| 14 | +### Response Volume |
| 15 | + |
| 16 | +This is a check on overall volume of raw results. There may be weekly effects but we would not expect to see any big systematic changes. |
| 17 | + |
| 18 | +```{r, fig.width = 7, fig.height = 5} |
| 19 | +library(covidcast) |
| 20 | +library(dplyr) |
| 21 | +library(ggplot2) |
| 22 | +
|
| 23 | +date_scale <- |
| 24 | + scale_x_date( |
| 25 | + date_breaks = "1 month", |
| 26 | + date_minor_breaks = "1 week", |
| 27 | + date_labels = "%b %Y" |
| 28 | + ) |
| 29 | +
|
| 30 | +twenty_eight_days_ago = Sys.Date() - 28 |
| 31 | +
|
| 32 | +# Sampling volume |
| 33 | +df_quidel_states = covidcast_signal("quidel", |
| 34 | + "covid_ag_raw_pct_positive", |
| 35 | + start_day = twenty_eight_days_ago, |
| 36 | + geo_type = "state") |
| 37 | +n_per_day = df_quidel_states %>% |
| 38 | + group_by(time_value) %>% |
| 39 | + summarize(n = sum(sample_size)) |
| 40 | +
|
| 41 | +ggplot(n_per_day, aes(x = time_value, y = n)) + |
| 42 | + geom_line() + geom_point() + theme_bw() + |
| 43 | + labs( |
| 44 | + x = "Date", |
| 45 | + y = "Number of Responses", |
| 46 | + title = sprintf("Total responses: %i, mean per day: %i", |
| 47 | + round(sum(n_per_day$n)), round(mean(n_per_day$n))) |
| 48 | + ) + |
| 49 | + date_scale |
| 50 | +``` |
| 51 | + |
| 52 | +### Coverage |
| 53 | + |
| 54 | +This measures how much state coverage we have in the samples (i.e., how many unique states are present each day), and how it has recently changed over time. |
| 55 | + |
| 56 | +```{r, fig.width = 7, fig.height = 5} |
| 57 | +# Sampling coverage |
| 58 | +df_quidel_states = covidcast_signal("quidel", |
| 59 | + "covid_ag_raw_pct_positive", |
| 60 | + start_day = twenty_eight_days_ago, |
| 61 | + geo_type = "state") |
| 62 | +states_per_day = df_quidel_states %>% |
| 63 | + group_by(time_value) %>% |
| 64 | + summarize(n = n()) |
| 65 | +
|
| 66 | +ggplot(states_per_day, aes(x = time_value, y = n)) + |
| 67 | + geom_line() + geom_point() + theme_bw() + |
| 68 | + labs( |
| 69 | + x = "Date", |
| 70 | + y = "Number of States", |
| 71 | + title = sprintf( |
| 72 | + "Unique States: %i, mean per day: %i", |
| 73 | + length(unique(df_quidel_states$geo_value)), |
| 74 | + round(mean(states_per_day$n)) |
| 75 | + ) |
| 76 | + ) + |
| 77 | + date_scale |
| 78 | +``` |
| 79 | + |
| 80 | +## State Coverage Map |
| 81 | + |
| 82 | +This visualizes the state coverage -- how frequently does each state show up in the data over the last 28 days? |
| 83 | + |
| 84 | +```{r, fig.width = 10, fig.height = 8} |
| 85 | +
|
| 86 | +source("dashboard_functions.R") |
| 87 | +plot_28_day_frequency_state(df_quidel_states) |
| 88 | +``` |
0 commit comments