An open API service indexing awesome lists of open source software.

https://github.com/ijlyttle/covidiowa

County-level COVID-19 Data for Iowa
https://github.com/ijlyttle/covidiowa

Last synced: 5 months ago
JSON representation

County-level COVID-19 Data for Iowa

Awesome Lists containing this project

README

          

---
output: github_document
date: "Compiled at `r format(Sys.time(), '%Y-%m-%d %H:%M:%S', tz = 'UTC')` UTC"
params:
publish: "workflow/data/99-publish"
---

```{r, include = FALSE}
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# covidIowa

```{r}
library("conflicted")
library("readr")
library("glue")
library("dplyr")
library("scales")
library("lubridate")
library("purrr")

conflict_prefer("filter", "dplyr")
```

The goal of this repository is to give a county-level summary of COVID-19 cases in Iowa.
The data is taken from a series of daily snapshots of the [accessibility page](https://coronavirus.iowa.gov/pages/access) provided by the Iowa Department of Public Health.

If you want to work with the data yourself, all the code I use is published this repository, check out the [`workflow`](workflow) directory.
Processed datasets are also available here:

- [`iowa_county_meta.csv`](https://raw.githubusercontent.com/ijlyttle/covidIowa/master/workflow/data/99-publish/iowa_county_meta.csv): county metadata, things like estimated 2019 population from [ICIP](https://www.icip.iastate.edu/tables/population/counties-estimates) at Iowa State University.

- [`iowa_county_data.csv`](https://raw.githubusercontent.com/ijlyttle/covidIowa/master/workflow/data/99-publish/iowa_county_data.csv): daily numbers by county from IDPH, going back to 2020-05-25.

- [`iowa_county_cases_week.csv`](https://raw.githubusercontent.com/ijlyttle/covidIowa/master/workflow/data/99-publish/iowa_county_data.csv): In addition to county metadata, total positive-tests (and per 100k), one week average of daily positive-tests (and per 100k), and week-over-week change in positive tests (as a ratio).

- [`iowa_cases_week.csv`](https://raw.githubusercontent.com/ijlyttle/covidIowa/master/workflow/data/99-publish/iowa_cases_week.csv): Similar to `iowa_county_cases_week.csv`, but aggregated for the entire state.

## Plots

![](workflow/data/99-publish/iowa_cases.png)

![](workflow/data/99-publish/iowa_change.png)
```{r}
iowa_county_cases_week_current <-
read_csv(
fs::path(params$publish, "iowa_county_cases_week.csv"),
col_types = cols(
date = col_date(format = ""),
fips = col_double(),
county = col_character(),
population = col_double(),
population_group = col_character(),
cases_total = col_double(),
cases_total_per100k = col_double(),
cases_avg_week = col_double(),
cases_avg_week_per100k = col_double(),
cases_week_growth = col_double()
)
) %>%
filter(date == max(date))
```

```{r}
iowa_cases_week <-
read_csv(fs::path(params$publish, "iowa_cases_week.csv")) %>%
mutate(county = "")
```

```{r}
make_table <- function(.data, arr, n = 10, by = county) {

.data %>%
dplyr::arrange({{ arr }}) %>%
head(n) %>%
dplyr::transmute(
{{ by }},
`daily pos. (week avg.)` = round(cases_avg_week, 1),
`daily pos. per 100k (week avg.)` = round(cases_avg_week_per100k, 1),
`week-over-week change` = scales::label_percent(0.1)(cases_week_growth)
) %>%
knitr::kable(align = "r")
}
```

```{r}
date_latest <- unique(iowa_county_cases_week_current$date)
```

## Tables as of `r date_latest`

```{r}
iowa_since_yesterday <-
iowa_cases_week %>%
arrange(date) %>%
tail(2) %>%
transmute(
cases_new = cases_total - dplyr::lag(cases_total)
) %>%
pluck("cases_new") %>%
pluck(2)
```

As of `r date_latest`, IPDH is reporting `r iowa_since_yesterday` new cases since the previous day.

For the entire state, over the past week:

```{r}
make_table(iowa_cases_week, desc(date), n = 7, by = date)
```

For the most-populated counties:

```{r}
make_table(iowa_county_cases_week_current, desc(population))
```

Most positive-cases, per-capita:

```{r}
make_table(iowa_county_cases_week_current, desc(cases_avg_week_per100k))
```

Most growth in positive cases, week-over-week:

```{r}
make_table(iowa_county_cases_week_current, desc(cases_week_growth))
```

Biggest decline in positive cases, week-over-week:

```{r}
make_table(iowa_county_cases_week_current, cases_week_growth)
```