From 1df71f86775b7a9554cb7e106ee94bf818359f0e Mon Sep 17 00:00:00 2001 From: "Jean-Paul R. Soucy" Date: Fri, 6 Oct 2023 13:09:41 -0400 Subject: [PATCH] Add active_cumul death dataset for AB (#116) - Have not integrated it into the time series yet, as I will still have to deal with the missing deaths from the end of the previous season. --- R/dl_datasets.R | 1 + R/update_raw_datasets.R | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/R/dl_datasets.R b/R/dl_datasets.R index 1f0a61e..7bb07cf 100644 --- a/R/dl_datasets.R +++ b/R/dl_datasets.R @@ -20,6 +20,7 @@ dl_datasets <- function() { covid_datasets <- matrix( c( # ab + "2a11bbcc-7b43-47d1-952d-437cdc9b2ffb", NA, NA, # d # bc # can "314c507d-7e48-476e-937b-965499f51e8e", NA, NA, # c, d diff --git a/R/update_raw_datasets.R b/R/update_raw_datasets.R index edba2b2..bd8bcb2 100644 --- a/R/update_raw_datasets.R +++ b/R/update_raw_datasets.R @@ -231,6 +231,23 @@ update_active_cumul <- function(ds) { # active_cumul - death data cat("Updating active_cumul: death data", fill = TRUE) + + # active_cumul - death data - ab + ac_deaths_hr_ab <- Covid19CanadaDataProcess::process_dataset( + uuid = "2a11bbcc-7b43-47d1-952d-437cdc9b2ffb", + val = "mortality", + fmt = "hr_cum_current", + ds = load_ds(ds, "2a11bbcc-7b43-47d1-952d-437cdc9b2ffb")) %>% + convert_hr_names() %>% + add_as_of_date( + as_of_date = load_ds(ds, "2a11bbcc-7b43-47d1-952d-437cdc9b2ffb") |> + rvest::html_elements(".goa-callout") %>% + .[2] %>% + rvest::html_text2() |> + stringr::str_extract("(?<=up-to-date as(?: of)? )((January|February|March|April|May|June|July|August|September|October|November|December) \\d{1,2}, \\d{4})") |> + as.Date(format = "%B %d, %Y")) + upload_active_cumul(ac_deaths_hr_ab, files, "covid19_cumul", "deaths_hr_ab_2") + sync_active_cumul("deaths_hr_ab", "deaths", "AB", as_of_date = TRUE) } #' Update raw datasets for CovidTimelineCanada @@ -267,7 +284,7 @@ update_raw_datasets <- function() { update_covid19tracker() # update active_cumul datasets - # update_active_cumul(ds) + update_active_cumul(ds) # close sink sink(NULL, type = "message")