Interactive Leaflet of Social Vulnerability, Child Opporunity, COVID19 Impact, and Geo boundaries in NYC


This is an interactive leaflet containing NYC specific data on NYC public schools, Social Vulnerability, Child Opportunity, COVID19 and County/Zip geographic boundaries.

Modified Zip Code Tabulation Areas (MODZCTAs) with the highest COVID-19 impact (as of 5/29)


There are 45 modified zip code tabulation areas currently impacted the highest by COVID19, based on case and death rate only.

Neighborhood Tabulation Areas (NTAs) with the highest social vulnerability and lowest child opportunity in NYC


There are 34 neighborhoods in NYC identified as “highest social vulnerability” and “very low child opportunity.” These neighborhoods overlap with areas most impacted by COVID-19.

NYC Schools in neighborhoods with the highest vulnerability and lowest child opportunity


There are 507 NYC schools in the 34 identified neighborhoods. As mentioned, schools were used here as a potential means of

  1. identifying mental health need in children,
  2. planning for resource distribution, and
  3. establishing a starting point in assessing the surrounding community needs.

This table can be output into CSV, Excel or PDF format.

---
title: "Exploration of Social Vulnerability and Child Opportunity in NYC in the context of COVID19 and Racial Injustice"
author: "by Jensen Hu"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    source: embed
---

```{r setup, include=FALSE, cache=TRUE}
# Load packages
library(dplyr) # data manipulation
library(reshape) # data manipulation
library(tidyverse) # data manipulation
library(DescTools) # data manipulation
library(tigris) # geospatial data
library(sf) # geo spatial
library(sp) # geo spatial
library(htmlwidgets) # interactive widgets
library(DT) # interactive table
library(leaflet) # visualization
library(ggplot2) # visualization
library(flexdashboard) # visualization
library(ggpubr) # visualization

schools <- readRDS(file = "rds_files/schools.rds")
merge_opp <- readRDS(file = "rds_files/merge_opp.rds")
nyc_covid <- readRDS(file = "rds_files/nyc_covid.rds")
nyc_zips <- readRDS(file = "rds_files/nyc_zips.rds")
county_sp <- readRDS(file = "rds_files/county_sp.rds")
svi_tracts <- readRDS(file = "rds_files/svi_tracts.rds")
ds_svi <- readRDS(file = "rds_files/ds_svi.rds")
svi_opp <- readRDS(file = "rds_files/svi_opp.rds")
school_tracts <- readRDS(file = "rds_files/school_tracts.rds")
svi_nta_ranked <- readRDS(file = "rds_files/svi_nta_ranked.rds")
coi_nta_shp <- readRDS(file = "rds_files/coi_nta_shp.rds")
```


### Interactive Leaflet of Social Vulnerability, Child Opporunity, COVID19 Impact, and Geo boundaries in NYC

```{r, cache=TRUE}
# Layer 1 - COVID by ZIP options
popup1 <- paste0("Modified ZCTA: ", nyc_covid$MODZCTA, "
", "Level of COVID Impact: ", nyc_covid$impact_cat, "
", "Case Rate: ", nyc_covid$total_case_rate, "
", "Death Rate: ", nyc_covid$total_death_rate) pal1 <- colorFactor(palette = "YlGnBu", domain= nyc_covid$impact_cat) # Layer 2 - SVI by NTA popup2 <- paste0("NTA: ", svi_nta_ranked$ntaname, "
","svi: ", svi_nta_ranked$cat_nta) pal2 <- colorFactor(palette = "YlGnBu", domain = svi_nta_ranked$cat_nta) # Layer 3 - COI by NTA popup3 <- paste0("NTA: ", coi_nta_shp$ntaname, "
", "COI: ", coi_nta_shp$cat_coi_nta) pal3 <- colorFactor(palette = "YlGnBu", domain = coi_nta_shp$cat_coi_nta, reverse = TRUE) # Layer 4 - SMH Layer popup4 <- paste0("School Name: ", schools$location_name, "
","DBN: ", schools$system_code, "
","Address: ", schools$primary_address_line_1) # Label Text labels1 <- sprintf( # label for covid by zip code "Modified ZCTA: %s
Level of COVID Impact: %s
Case Rate: %s
Death Rate: %s", nyc_covid$MODZCTA, nyc_covid$impact_cat, nyc_covid$total_case_rate, nyc_covid$total_death_rate) %>% lapply(htmltools::HTML) labels2 <- sprintf( # label for zip codes "Zip code: %s", nyc_zips$MODZCTA) %>% lapply(htmltools::HTML) labels3 <- sprintf( # label for county names "County: %s", county_sp$NAME) %>% lapply(htmltools::HTML) labels4 <- sprintf( # label for school names "School Name: %s", schools$location_name) %>% lapply(htmltools::HTML) # label parameters label_Options <- labelOptions(style = list("font-weight" = "normal", padding = "3px 8px"), textsize = "15px", direction = "auto") # highlight parameters highlight_Options <- highlightOptions(color = "white", weight = 2, fillOpacity = 0.9, bringToFront = TRUE) highlight_Options2 <- highlightOptions(color = "white", weight = 2, bringToFront = TRUE) p <- leaflet() %>% # Base Groups addProviderTiles("CartoDB.Positron", group = "Positron") %>% addTiles(urlTemplate = "http://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", attribution = 'Google', group = "Google Map") %>% # Overlay Groups addCircleMarkers(data=schools, # school layer lat = schools$latitude, lng = schools$longitude, weight = 2, radius = 2, stroke = FALSE, color = "black", fillOpacity = 1.0, label = labels4, popup = popup4, group = "NYC Schools") %>% addPolygons(data = nyc_covid, # NYC ZIPS + COVID19 % Positive fillColor = ~pal1(nyc_covid$impact_cat), weight =2, color = "black", fillOpacity = 0.7, popup = popup1, label = labels1, labelOptions = label_Options, highlightOptions = highlight_Options, group = "COVID19 Impact by MODZCTA") %>% addPolygons(data = svi_nta_ranked, # SVI by NTA fillColor = ~pal2(svi_nta_ranked$cat_nta), weight =2, color = "black", fillOpacity = 0.6, popup = popup2, highlightOptions = highlight_Options, group = "Social Vulnerability Index by NTA") %>% addPolygons(data = coi_nta_shp, # COI by NTA fillColor = ~pal3(coi_nta_shp$cat_coi_nta), weight =2, color = "black", fillOpacity = 0.7, popup = popup3, highlightOptions = highlight_Options, group = "Child Opportunity Index by NTA") %>% addPolygons(data = nyc_zips, # NYC Zip Codes weight =2, color= "blue", fillOpacity = 0, label = labels2, labelOptions = label_Options, highlightOptions = highlight_Options2, group = "Zip Code") %>% addPolygons(data = county_sp, # NY County Boundaries color = "orange", fillOpacity = 0, weight = 3, label = labels3, labelOptions = label_Options, highlightOptions = highlight_Options2, group = "County") %>% setView(lng = "-73.935242", lat = "40.730610", zoom = 10.3) %>% # Layers control addLayersControl( baseGroups = c("Positron","Google Map"), overlayGroups = c("COVID19 Impact by MODZCTA", "Social Vulnerability Index by NTA", "Child Opportunity Index by NTA", "NYC Schools", "Zip Code", "County"), options = layersControlOptions(collapsed = FALSE) ) %>% addLegend(pal = pal1, values = nyc_covid$impact_cat, position = "bottomleft", title = "Level of Impact", group = "COVID19 Impact by MODZCTA") %>% addLegend(pal = pal2, values = svi_nta_ranked$cat_nta, position = "topleft", title = "Social Vulnerability Index", group = "Social Vulnerability Index by NTA") %>% addLegend(pal = pal3, values = coi_nta_shp$cat_coi_nta, title = "Child Opportunity Index", group = "Child Opportunity Index by NTA") %>% hideGroup(c("COVID19 Impact by MODZCTA","NYC Schools", "Zip Code", "County", "Child Opportunity Index by NTA")) p ``` *** This is an interactive leaflet containing NYC specific data on NYC public schools, Social Vulnerability, Child Opportunity, COVID19 and County/Zip geographic boundaries. - Positron and Google Map are different choices of basemap. - COVID19 Impact, SVI by NTA, and COI by NTA layers are best viewed one at a time. The overlay of multiple layers will not correspond to any defined color legends. - The Zip Codes or actually modified zip code tabulation areas, can be used with the SVI and COI layers to get a sense of "zip" boundaries. - The County layer can be used with any layer to get a sense of county boundaries. - NYC schools were added as a potential means of (1) identifying mental health need in children, (2) planning for resource distribution, and (3) establishing a starting point in assessing the surrounding community needs. ### Modified Zip Code Tabulation Areas (MODZCTAs) with the highest COVID-19 impact (as of 5/29) ```{r} st_geometry(nyc_covid) <- NULL # remove geometry highest_impact <- nyc_covid %>% filter(impact_cat == "Highest Impact") %>% select(MODZCTA, total_case_rate, total_death_rate, rank_impact) %>% arrange(desc(rank_impact)) datatable(highest_impact, extensions = 'Buttons', options = list(dom = 'Bfrtip',buttons = list(extend = 'collection', buttons = c('csv', 'excel', 'pdf'), text = 'Download'))) ``` *** There are 45 modified zip code tabulation areas currently impacted the highest by COVID19, based on case and death rate only. ### Neighborhood Tabulation Areas (NTAs) with the highest social vulnerability and lowest child opportunity in NYC ```{r} # priority list of NTAs w/ very low opportunity, highest vulnerability priority_list <- svi_opp %>% filter(cat_nta == "Highest Vulnerability" & cat_coi_nta == "Very Low") %>% select(boro_name.x, ntacode, ntaname.x) %>% group_by(boro_name.x) %>% summarize(count = n(), Neighborhoods = paste(unique(ntaname.x), collapse = ', ')) datatable(priority_list, extensions = 'Buttons', options = list(dom = 'Bfrtip',buttons = list(extend = 'collection', buttons = c('csv', 'excel', 'pdf'), text = 'Download'))) ``` *** There are 34 neighborhoods in NYC identified as "highest social vulnerability" and "very low child opportunity." These neighborhoods overlap with areas most impacted by COVID-19. - Please note this does NOT factor in current COVID19 impact data as data by NTA is not publicly available (and crosswalk between MODZCTA and NTA is tricky). - This table can be output into CSV, Excel or PDF format. ### NYC Schools in neighborhoods with the highest vulnerability and lowest child opportunity ```{r} priority_dbn <- svi_opp %>% filter(cat_nta == "Highest Vulnerability" & cat_coi_nta == "Very Low") %>% left_join(., schools, by = c("ntacode" = "nta")) %>% group_by(ntaname.x) %>% summarize(Schools = paste(unique(location_name), collapse = ', ')) datatable(priority_dbn, extensions = 'Buttons', options = list(dom = 'Bfrtip',buttons = list(extend = 'collection', buttons = c('csv', 'excel', 'pdf'), text = 'Download'))) ``` *** There are 507 NYC schools in the 34 identified neighborhoods. As mentioned, schools were used here as a potential means of (1) identifying mental health need in children, (2) planning for resource distribution, and (3) establishing a starting point in assessing the surrounding community needs. This table can be output into CSV, Excel or PDF format.