Leveraging data to support local government and nonprofit partners in COVID-19 response
Future Bay Initiative
[Content omitted]
R techniques (stanfordfuturebay.github.io/covid19)
scc_blockgroups <-� block_groups("CA","Santa Clara") %>% � st_transform('+proj=longlat +datum=WGS84') |
sj_percenthome_bg <-� sj_socialdistancing %>%� mutate(� `% Leaving Home` = � ((1-completely_home_device_count/device_count)*100) %>% round(1),� date = date_range_start %>% substr(1,10) %>% as.Date()� ) %>%� dplyr::select(� origin_census_block_group,� `% Leaving Home`,� date� ) %>% � left_join(� sj_blockgroups %>% st_set_geometry(NULL), � by ="origin_census_block_group"� ) |
R techniques (stanfordfuturebay.github.io/covid19)
Inputs {.sidebar}�---------------------------------------------------------------��```{r}�sliderInput(� "date", � label = "Date:",� min = min(sj_percenthome_bg$date),� max = max(sj_percenthome_bg$date),� value = max(sj_percenthome_bg$date),� timeFormat = "%m/%d"�)�``` |
R techniques (stanfordfuturebay.github.io/covid19)
```{r, context="server"}�observeEvent(input$date,{� leafletProxy("map") %>% � addPolygons(� data = sj_percenthome_bg %>% � filter(date == input$date) %>% � left_join(sj_blockgroups) %>%� st_as_sf(),� layerId = block_Ids,� fillColor = ~teal_pal(`% Leaving Home`),� color = "white",� weight = 0.5,� opacity = 0.5,� fillOpacity = 0.7,� label = ~paste0(`% Leaving Home`,"% leaving home"),� highlightOptions = highlightOptions(weight=2.25, opacity=1),� options = pathOptions(pane = "blocks")� ) }) ``` |
R techniques (stanfordfuturebay.github.io/covid19)
data <-� unique(sj_percenthome_bg$date) %>% � map_dfr(function(specificdate){� sj_percenthome_bg_altered <-� sj_percenthome_bg %>% � filter(date == specificdate)� � data.frame(� date = specificdate,� mean_percenthome = round(mean(sj_percenthome_bg_altered$`� sd_percenthome = round(sd(sj_percenthome_bg_altered$`� )� }) %>% � arrange(date) |
[Content omitted]
Normalization approach
Basic procedure:
# Safegraph devices
Census population
# Safegraph visitors
# Safegraph visits
x
x
Estimated true visits
=
# Safegraph visitors
Total for a single POI
Total for a single POI
Total for a single POI
Normalization approach
Basic procedure:
Macro approach
# Safegraph devices
Census population
# Safegraph visitors
# Safegraph visits
x
x
Estimated true visits
=
# Safegraph visitors
Total for a single POI
Total for a single POI
Total for a single POI
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
Normalization approach
Basic procedure:
Macro approach
Micro approach
# Safegraph devices
Census population
# Safegraph visitors
# Safegraph visits
x
x
Estimated true visits
=
# Safegraph visitors
# Safegraph devices
Census population
x
# Safegraph visitors
For a single recorded origin
For a single recorded origin
For a single recorded origin
# visitors from unrecorded origins x ratio for sum of recorded origins
Total for a single POI
Total for a single POI
Total for a single POI
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
# Safegraph devices
Census population
x
# Safegraph visitors
For a single recorded origin
For a single recorded origin
For a single recorded origin
# visitors from unrecorded origins x ratio for sum of recorded origins
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
# Safegraph devices
Census population
x
# Safegraph visitors
For a single recorded origin
For a single recorded origin
For a single recorded origin
# visitors from unrecorded origins x ratio for sum of recorded origins
Single ratio is 35.5
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
“Tidying” by recorded origins; last NA row is for remaining “unrecorded” origins
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
Per Safegraph schema, a raw visitor count of “4” could mean 2, 3, or 4. We propagate upper and lower bounds to results
Macro approach
Micro approach
# Safegraph devices
Census population
x
# Safegraph visitors
Sum for all Bay Area block groups
Sum for all Bay Area block groups
Total for a single POI
Different ratios for every row (31.5, 26.5, 21.9) based on specific block group of focus
Function at stanfordfuturebay.github.io/covid19
normBG <- function( patterns, home_summary, bay_blockgroups = norm_bay_blockgroups, ca_pop_blockgroup = norm_ca_pop_blockgroup ){...} |
[Content omitted]
Community Characteristics
Movement Behavior
COVID-19
Spread
?
?
Policies
?
?
?
Confounders
Confounders
library(RSelenium)�library(seleniumPipes)��remDr <- remoteDriver(remoteServerAddr ="ipaddresshere", port=4445L)�remDr$open()��remDr$navigate("https://app.powerbigov.us/view?r=eyJrIjoiZTg2MTlhMWQtZWE5OC00ZDI3LWE4NjAtMTU3YWYwZDRlOTNmIiwidCI6IjBhYzMyMDJmLWMzZTktNGY1Ni04MzBkLTAxN2QwOWQxNmIzZiJ9")��webElem <- remDr$findElements(using = "class", value = "column")��cases <-1:length(webElem) %>% � map(function(x){�webElem[[x]]$getElementAttribute("aria-label") %>% as.character()� }) %>% unlist() %>% � as.data.frame() |
[Content omitted]
Leveraging data to support local government and nonprofit partners in COVID-19 response
5/20/20
Stanford Future Bay Initiative
Students: Armelle Coutant, Ayoade Balogun, Cameron Tenner, Charlie Hoffs, Chris Leboa, Evan Kanji, Facundo Golinsky, Emma Liu, Isabelle Foster, Jessica de la Paz, Julia Wagenfehr, Laura Davey, Laura Miron, Maeve Givens, Nancy Chang, Samantha Liu, Simone Speizer, Spencer Robinson, Zihan Wei
Mentors: Cansu Culha, Derek Ouyang, Dr. Gabrielle Wong-Parodi, Dr. Jenny Suckale, Jeremy Smith, Jinal Mehta, Lila Mack, Neel Kasmalkar
Future Bay Initiative