The covid19sf package provides two datasets focusing on the overall hospital capacity and patients status in San Francisco hospitals:
covid19sf_hospital
- a daily snapshot of the hospital capacitycovid19sf_hospitalizations
- a daily snapshot of the patients statusThe covid19sf_hospital
dataset provides a daily snapshot of the San Francisco hospital capacity by bed type and status with the following variables:
bed_type
- number of hospital beds available by department type:
status
- the department corresponding bed status:
data(covid19sf_hospital)
head(covid19sf_hospital)
#> hospital date bed_type status count
#> 1 All SF Acute Hospitals 2020-07-22 Intensive Care Surge Available 309
#> 2 All SF Acute Hospitals 2021-07-18 Intensive Care Surge Available 298
#> 3 All SF Acute Hospitals 2020-07-22 Acute Care Surge Available 406
#> 4 All SF Acute Hospitals 2021-07-18 Acute Care Available 487
#> 5 All SF Acute Hospitals 2021-07-18 Acute Care Surge Available 247
#> 6 All SF Acute Hospitals 2021-07-18 Intensive Care Available 123
Let’s summarise the hospital status as of the most recent date available on the dataset:
library(dplyr)
covid19sf_hospital %>%
filter(date == max(date)) %>%
group_by(bed_type, status) %>%
summarise(total = sum(count))
#> # A tibble: 10 × 3
#> # Groups: bed_type [4]
#> bed_type status total
#> <chr> <chr> <int>
#> 1 Acute Care Available 487
#> 2 Acute Care COVID-19 (Confirmed & Suspected) 31
#> 3 Acute Care Other Patients 1098
#> 4 Acute Care Surge Available 247
#> 5 Acute Care Surge Occupied Surge 0
#> 6 Intensive Care Available 123
#> 7 Intensive Care COVID-19 (Confirmed & Suspected) 15
#> 8 Intensive Care Other Patients 148
#> 9 Intensive Care Surge Available 298
#> 10 Intensive Care Surge Occupied Surge 0
library(plotly)
covid19sf_hospital %>%
filter(bed_type == "Acute Care") %>%
mutate(status = factor(status, levels = c("Other Patients", "COVID-19 (Confirmed & Suspected)", "Available"))) %>%
plot_ly(x = ~ date,
y = ~ count,
type = 'scatter',
mode = 'none',
color = ~status,
stackgroup = 'one') %>%
layout(title = "SF Acute Hospitals - Acute Care Bed Count",
legend = list(x = 0.05, y = 0.95),
yaxis = list(title = "Number of Beds", tickformat = ".0f"),
xaxis = list(title = "Source: San Francisco Department of Public Health"),
hovermode = "compare")
covid19sf_hospital %>%
filter(bed_type == "Intensive Care") %>%
mutate(status = factor(status, levels = c("Other Patients", "COVID-19 (Confirmed & Suspected)", "Available"))) %>%
plot_ly(x = ~ date,
y = ~ count,
type = 'scatter',
mode = 'none',
color = ~status,
stackgroup = 'one') %>%
layout(title = "SF Acute Hospitals - Intensive Care Bed Count",
legend = list(x = 0.05, y = 1),
yaxis = list(title = "Number of Beds", tickformat = ".0f"),
xaxis = list(title = "Source: San Francisco Department of Public Health"),
hovermode = "compare")
The covid19sf_hospitalizations
provides daily snapshot of the number of patients in San Francisco hospitals by hospitalization unit and Covid19 status using the following variables:
dphcategory
- the hospital unit type, either ICU
(intensive care unit) or Med/Surg
(acute care).covidstatus
- the Covid19 status, either COVID+
(confirmed cases) or PUI
(patient under investigation)The below example summarised the hospitalizations status as of the most recent date in the data:
data(covid19sf_hospitalizations)
covid19sf_hospitalizations %>%
filter(reportdate == max(reportdate)) %>%
group_by(dphcategory, covidstatus) %>%
summarise(total = sum(patientcount))
#> # A tibble: 4 × 3
#> # Groups: dphcategory [2]
#> dphcategory covidstatus total
#> <chr> <chr> <int>
#> 1 ICU COVID+ 9
#> 2 ICU PUI 0
#> 3 Med/Surg COVID+ 23
#> 4 Med/Surg PUI 2