Skip to content

Commit

Permalink
Update hosp/ICU occupancy data for BC, NB, NS
Browse files Browse the repository at this point in the history
- ccodwg/CovidTimelineCanada#82
- BC: Partial replacement of covid19tracker dataset for hosp occupancy before 2020-03-17 (first date where covid19tracker dataset has unique data; news releases are less frequent than the unarchived dashboard dataset covid19tracker was pulling after this date as well)
- NB: Partial replacement of covid19tracker dataset before 2020-06-30, when NB transitioned to more frequent updates using its unarchived dashboard (which covid19tracker was pulling from)
- NS: Complete replacement of covid19tracker dataset using daily news releases
  • Loading branch information
jeanpaulrsoucy committed Oct 31, 2023
1 parent 0168780 commit d51b72b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 20 additions & 8 deletions R/assemble_final_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,10 @@ assemble_final_datasets <- function() {

## bc
hospitalizations_bc <- dplyr::bind_rows(
get_covid19tracker_d("hospitalizations", "BC") |>
dplyr::filter(.data$date <= as.Date("2021-03-12")),
read_d("raw_data/reports/bc/bc_daily_news_release.csv") |>
report_pluck("hospitalizations", "active_hospitalizations", "value", "pt") |>
dplyr::filter(.data$date <= as.Date("2020-03-12")),
get_covid19tracker_d("hospitalizations", "BC", from = "2020-03-16", to = "2021-03-12"),
read_d("raw_data/static/bc/bc_hospitalizations_hr_ts.csv") |>
agg2pt(raw = TRUE),
read_d("raw_data/reports/bc/bc_monthly_report.csv") |>
Expand All @@ -490,7 +492,10 @@ assemble_final_datasets <- function() {

## nb
hospitalizations_nb <- dplyr::bind_rows(
get_covid19tracker_d("hospitalizations", "NB", to = "2021-03-07"),
read_d("raw_data/reports/nb/nb_daily_news_release.csv") |>
report_pluck("hospitalizations", "active_hospitalizations", "value", "pt") |>
dplyr::filter(.data$date <= as.Date("2020-06-29")),
get_covid19tracker_d("hospitalizations", "NB", from = "2020-06-30", to = "2021-03-07"),
read_d("raw_data/static/nb/nb_hospitalizations_pt_ts_1.csv"),
read_d("raw_data/static/nb/nb_hospitalizations_pt_ts_2.csv") |>
dplyr::filter(.data$date <= as.Date("2022-01-20")),
Expand All @@ -506,7 +511,9 @@ assemble_final_datasets <- function() {

## ns
hospitalizations_ns <- dplyr::bind_rows(
get_covid19tracker_d("hospitalizations", "NS", to = "2021-01-18"),
read_d("raw_data/reports/ns/ns_daily_news_release.csv") |>
report_pluck("hospitalizations", "active_hospitalizations", "value", "pt") |>
dplyr::filter(.data$date <= as.Date("2021-01-18")),
read_d("raw_data/static/ns/ns_hospitalizations_pt_ts_1.csv"),
read_d("raw_data/static/ns/ns_hospitalizations_pt_ts_2.csv"),
read_d("raw_data/reports/ns/ns_weekly_report.csv") |>
Expand Down Expand Up @@ -568,8 +575,8 @@ assemble_final_datasets <- function() {

## bc
icu_bc <- dplyr::bind_rows(
get_covid19tracker_d("icu", "BC") |>
dplyr::filter(.data$date <= as.Date("2021-03-12")),
# daily news release has an ICU case on 2020-03-10, but this value is not regularly reported until later
get_covid19tracker_d("icu", "BC", from = "2020-03-17", to = "2021-03-12"),
read_d("raw_data/static/bc/bc_icu_hr_ts.csv") |>
agg2pt(raw = TRUE),
read_d("raw_data/reports/bc/bc_monthly_report.csv") |>
Expand All @@ -585,7 +592,10 @@ assemble_final_datasets <- function() {

## nb
icu_nb <- dplyr::bind_rows(
get_covid19tracker_d("icu", "NB", to = "2021-03-07"),
read_d("raw_data/reports/nb/nb_daily_news_release.csv") |>
report_pluck("icu", "active_icu", "value", "pt") |>
dplyr::filter(.data$date <= as.Date("2020-06-29")),
get_covid19tracker_d("icu", "NB", from = "2020-06-30", to = "2021-03-07"),
read_d("raw_data/static/nb/nb_icu_pt_ts_1.csv"),
read_d("raw_data/static/nb/nb_icu_pt_ts_2.csv") |>
dplyr::filter(.data$date <= as.Date("2022-01-20")),
Expand All @@ -602,7 +612,9 @@ assemble_final_datasets <- function() {

## ns
icu_ns <- dplyr::bind_rows(
get_covid19tracker_d("icu", "NS", to = "2021-01-18"),
read_d("raw_data/reports/ns/ns_daily_news_release.csv") |>
report_pluck("icu", "active_icu", "value", "pt") |>
dplyr::filter(.data$date <= as.Date("2021-01-18")),
read_d("raw_data/static/ns/ns_icu_pt_ts_1.csv"),
read_d("raw_data/static/ns/ns_icu_pt_ts_2.csv"),
read_d("raw_data/reports/ns/ns_weekly_report.csv") |>
Expand Down
2 changes: 2 additions & 0 deletions R/update_raw_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ update_reports <- function() {
sync_report("on_pho_vaccine_coverage", "on", "hr")

# no longer updated reports
# sync_report("bc_daily_news_release", "bc", "hr")
# sync_report("mb_weekly_report", "mb", "hr")
# sync_report("nb_daily_news_release", "nb", "hr")
# sync_report("nb_weekly_report", "nb", "hr")
# sync_report("nb_weekly_report_2", "nb", "hr")
# sync_report("ns_daily_news_release", "ns", "hr")
Expand Down

0 comments on commit d51b72b

Please sign in to comment.