-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload_data.R
More file actions
77 lines (52 loc) · 2.75 KB
/
load_data.R
File metadata and controls
77 lines (52 loc) · 2.75 KB
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
### Load Data
#' @author Lauren White
#' @date '2024-12-31'
#' Load data sets needed to run `calculate_forecastability.Rmd`
# Setup -------------------------------------------------------------------
# Load libraries
library(data.table)
library(jsonlite)
#pak::pkg_install("cmu-delphi/epipredict@main")
library(epipredict)
library(httr)
#devtools::install_github("Chicago/RSocrata")
library(RSocrata)
library(dplyr)
library(tidyr)
library(readr)
library(covidcast)
library(ggplot2)
library(tsibble)
library(MMWRweek)
library(geojsonsf)
# Load California county FIPS and population size info --------------------
spdf <- geojsonsf::geojson_sf("data/counties.geojson")
county_fips<-data.frame(county= spdf$NAME_1, county_fips= spdf$COUNTYFI_1) %>% mutate(county_fips=as.numeric(county_fips))
counties <- fread( "data/county_pop_dof.csv") %>% na.omit()
ca_pop<-sum(counties$dof_pop_county)
ca_pop<-data.frame(county="California", dof_pop_county=as.numeric(ca_pop))
counties<-counties %>% bind_rows(ca_pop)
# Load US demographic info ------------------------------------------------
# Load combined US demographic 2021 Census data from `/data/demog.csv`
demog<-read_csv("data/demog.csv") #contains 2021 US census population size, density, and state abbreviations (lowercase)
# Load hospital capacity --------------------------------------------------
# Load hospital capacity data sourced from HHS/NHSN data.
hosp_capacity<-read_csv("data/hosp_capacity.csv")
# Load number of facilities -----------------------------------------------
num_facilities<-read_csv("data/num_facilities.csv")
# Load predominant flu subtpye data ---------------------------------------
# This data set was generated manually from reviewing California Department of Public Health historical influenza reports: https://www.cdph.ca.gov/Programs/CID/DCDC/pages/immunization/flu-reports.aspx
flu_subtypes<-read_csv("data/CDPH_flu_subtypes.csv") %>% rename(season=Season)
# State & National COVID & Influenza Hospital Admission Data --------------
# Pull in state and national hospitalization admissions data for COVID-19 and influenza using Delphi's API.
# https://cmu-delphi.github.io/delphi-epidata/
covid_hosp_full<-read_csv("data/covid_hosp.csv")
flu_hosp_full<- read_csv("data/flu_hosp.csv")
# Total seasonal burden ---------------------------------------------------
seasonal_burden<-read_csv("data/seasonal_burden.csv")
# County level NHSN hospitalizations --------------------------------------
hosp_epi_df_county<-read_csv("data/covid_hosp_county.csv")
hosp_epi_df_county_flu<- read_csv("data/flu_hosp_county.csv")
# Load forecast actuals for scoring ---------------------------------------
CDC_actuals_raw<- read_csv("data/CDC_actuals_raw.csv")
COVID_actuals_weekly<-read_csv("data/COVID_actuals_weekly.csv")