From 90904b73ea8b471a27f012a45f06d7561670305b Mon Sep 17 00:00:00 2001 From: "Jean-Paul R. Soucy" Date: Tue, 3 Oct 2023 14:45:30 -0400 Subject: [PATCH] Update AB case data - Use geospatial data/summary data after 2020-04-01, because these datasets end 2023-08-28 rather than 2023-07-24 like the final version of the COVID-19 statistics app (ccodwg/CovidTimelineCanada#116) --- R/assemble_final_datasets.R | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/R/assemble_final_datasets.R b/R/assemble_final_datasets.R index 33034ec..e2d4b91 100644 --- a/R/assemble_final_datasets.R +++ b/R/assemble_final_datasets.R @@ -11,8 +11,23 @@ assemble_final_datasets <- function() { # case dataset ## ab - cases_ab <- read_d("raw_data/static/ab/ab_cases_hr_ts.csv") %>% + ab1 <- read_d("raw_data/static/ab/ab_cases_hr_ts_1.csv") %>% + convert_hr_names() %>% + dplyr::filter(.data$date <= as.Date("2020-03-31")) + ab2 <- read_d("raw_data/static/ab/ab_cases_hr_ts_2.csv") %>% convert_hr_names() + ab3 <- read_d("raw_data/static/ab/ab_cases_pt_ts.csv") %>% + dplyr::filter(.data$date >= as.Date("2020-04-01")) + # calculate time series for "unknown" health region based on diff between PT and agg HR + ab4 <- ab2 %>% + dplyr::select(-.data$sub_region_1) %>% + dplyr::group_by(.data$name, .data$region, .data$date) %>% + dplyr::summarize(value = sum(.data$value), .groups = "drop") + ab5 <- ab3 %>% + add_hr_col("Unknown") + ab5$value <- ab5$value - ab4$value + cases_ab <- dplyr::bind_rows(ab1, ab2, ab5) + rm(ab1, ab2, ab3, ab4, ab5) # clean up ## bc bc1 <- read_d("raw_data/static/bc/bc_cases_hr_ts.csv") %>%