Skip to content

Commit

Permalink
Add active_cumul death dataset for AB (#116)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
jeanpaulrsoucy committed Oct 6, 2023
1 parent 334ebda commit 1df71f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions R/dl_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion R/update_raw_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 1df71f8

Please sign in to comment.