Data last updated on Tuesday, February 16, 2021 - 6:08:49 PM EST
24 Hour Addiction Hotline 716-831-7007 - Get immediate help, education, information, referrals and assistance with linking to addiction treatment services.
Need Narcan? Use the Text For Narcan program to have Narcan delivered directly to you!
Text your request to 716-225-5473
Erie County H.O.P.E Project (Community Education & Prevention)
Program Contact
Cheryll Moore
Medical Care Administrator
95 Franklin St., Room 911
Buffalo, NY 14202
Phone: (716) 858-7695
Fax: (716) 858-8701
Cheryll.Moore@erie.gov
---
title: NaloxTrac
output:
flexdashboard::flex_dashboard:
vertical_layout: fill
css: 'NarcantrackingCSS.css'
favicon: ios7-location-outline.png
source_code: embed
---
```{r setup, include=FALSE, cache = FALSE}
#Prepping workspace by loading in existing datasets and plots and sourcing it through the RMD file.#
# Library Load-in====
`Required Packages` <- c("knitr", "gridExtra", "tidyverse","extrafont","leaflet","leafem","lubridate","crosstalk","DT","summarywidget", "plotly","raster")
`New Packages` <- `Required Packages`[!(`Required Packages` %in% installed.packages()[,"Package"])]
if(length(`New Packages`)) install.packages(`New Packages`)
invisible(suppressPackageStartupMessages(suppressWarnings(lapply(`Required Packages`, require, character.only=T))))
# Font load-in====
loadfonts(device = "win", quiet = TRUE)
windowsFonts("TREBUC" = windowsFont("TREBUC"))
#Hard loading of the data sets.#
Narcanboxkitprovided <- read_csv("data/Narcanboxkitprovided.csv",
col_types = cols(ZIP = col_character(),
`# of Wall Boxes Provided` = col_number(),
`# of Narcan Kits Provided` = col_number(),
Date = col_date(format = "%Y-%m-%d"),
Year = col_character()))
Narcanboxkitexplorer <- read_csv("data/Narcanboxkitexplorer.csv")
Narcanboxkit_nogeo <- read_csv("data/Narcanboxkit_nogeo.csv")
Textfornarcan <- read_csv("data/Textfornarcan.csv")
Textfornarcangeo <- readRDS("data/Textfornarcangeo.rds")
innercitygeo <- readRDS("data/innercitygeo.rds")
TFNcitydata <- read_csv("data/TFNcitydata.csv")
ODgeo <- readRDS("data/ODgeo.rds")
ALLnarcanmapgeo <- readRDS("data/ALLnarcanmapgeo.rds")
ALLECmapgeo <- readRDS("data/ALLECmapgeo.rds")
ALLBUFFmapgeo <- readRDS("data/ALLBUFFmapgeo.rds")
ALLnarcannogeo <- readRDS("data/ALLnarcannogeo.rds")
ALLnarcantotal <- readRDS("data/ALLnarcantotal.rds")
#Using crosstalk to add interactivity between the map, filters, summaries, and data explorer.#
sd <- SharedData$new(Narcanboxkitprovided)
sd3 <- SharedData$new(Narcanboxkit_nogeo)
sd4 <- SharedData$new(TFNcitydata)
sd5 <- SharedData$new(ODgeo)
sd6 <- SharedData$new(ALLnarcanmapgeo)
sd7 <- SharedData$new(ALLECmapgeo)
sd8 <- SharedData$new(ALLBUFFmapgeo)
#Pulling today's date.#
today <- format(Sys.time(), "%A, %B %d, %Y - %X %Z")
#Loading in pre-generated plotly graphs for the explorer tab#
Dateboxchart <- readRDS("objects/Dateboxchart.rds")
Datekitchart <- readRDS("objects/Datekitchart.rds")
#Loading in data for the Narcan and Text for Narcan Map and plots.#
TFNnogeo <- readRDS("data/TFNnogeo.rds")
TFNdategraph <- readRDS("objects/TFNdategraph.rds")
ODstartdate <- readRDS("data/ODstartdate.rds")
```
Naloxone Wall Box/Refill Kit Map {data-icon="fa-map-pin"}
=====================================
Column {data-width=390}
-------------------------------------
###
**Filters**
```{r Filters}
filter_slider(
id = "Date",
label = "Date",
sharedData = sd,
step = 1,
column = ~Date,
width = "97%",
timeFormat = "%D"
)
filter_select(
id = "City",
label = "City",
sharedData = sd,
group = ~City,
allLevels = FALSE
)
filter_select(
id = "County",
label = "County",
sharedData = sd,
group = ~County,
allLevels = FALSE
)
filter_select(
id = "ZIP",
label = "Zip Code",
sharedData = sd,
group = ~ZIP,
allLevels = FALSE
)
```
###
**Naloxone Wall Box / Refill Kit Summaries**
Total Sites Provided with Naloxone Wall Boxes and Kits:
`r summarywidget(sd)`
Total Naloxone Wall Boxes Distributed:
`r summarywidget(sd, statistic='sum', column='# of Wall Boxes Provided', digits=0)`
Total Naloxone Kits Distributed:
`r summarywidget(sd, statistic='sum', column='# of Narcan Kits Provided', digits=0)`
**Overall,** **`r nrow(Narcanboxkit_nogeo)`** **sites could not be mapped due to limitations in geocoding and/or missing geospatial data within the original data set.** **`r (nrow(Narcanboxkitexplorer) - nrow(Narcanboxkitprovided) - nrow(Narcanboxkit_nogeo))`** **requests were not fulfilled and were removed from the data set. All fulfilled requests can be found within the "Data Explorer" tab.**
Data last updated on **`r today `**
Column {data-width=575}
-------------------------------------
###
```{r map, cache = FALSE, warning= FALSE}
Homeimg <- htmltools::HTML(paste("
"))
Home <- list("Home" = Homeimg)
homecolor <- colorNumeric(palette = "Reds",
domain = ODgeo$Total)
homepopuptext <- paste0(
" Zip Code:",ODgeo$Zip ,"
",
"Total Overdoses:
",
"",ODgeo$Total,"
",
"Total Fatal:", ODgeo$Fatal,"
",
"Total Non-Fatal:", ODgeo$`Non-Fatal` ,"
") %>%
lapply(htmltools::HTML)
leaflet() %>%
addProviderTiles(providers$OpenStreetMap) %>%
addAwesomeMarkers(data = sd,
popup = ~paste0(
"",Narcanboxkitprovided$`Site Name`, "
",
Narcanboxkitprovided$`Street Address`,"
",
Narcanboxkitprovided$City, ",", Narcanboxkitprovided$State, ",", Narcanboxkitprovided$ZIP, "
",
Narcanboxkitprovided$County," County"),
icon = awesomeIcons(
library = "fa",
icon = "fa-circle",
iconColor = "#ffffff",
markerColor = "green"),
group = "Naloxone Locations") %>%
addPolygons(data= sd5,
fillColor = ~homecolor(Total),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =homepopuptext,
group = "OD Zip Codes")%>%
setView(-78.823333,42.857789, zoom = 10) %>%
addLegend(data = sd5,
pal = homecolor,
values = ~Total,
opacity = 0.7,
title = htmltools::HTML(paste("Total Number of
Reported Overdoses
Since",ODstartdate,"
")),
position = "bottomright") %>%
addControl(htmltools::HTML(paste("
=
Sites with Naloxone
Wall Boxes/Refill Kits ")), position = "bottomright") %>%
addHomeButton(ext = c(-79.53164,42.96246,-77.9914,42.96246,-77.9914,43.24523,-79.53164,43.24523), group = Home, position = "topright", add = TRUE) %>%
addLayersControl(
overlayGroups = c("OD Zip Codes", "Naloxone Locations"),
options = layersControlOptions(collapsed = FALSE)
)
```
Naloxone Wall Box/Refill Kit Summaries {data-orientation=rows data-icon="fa-search"}
=====================================
Column {.tabset}
-------------------------------------
### Summary Chart for Naloxone Wall Boxes
```{r wallboxplot}
#Placing plot
Dateboxchart
```
### Summary Chart for Naloxone Refill Kits
```{r kitplot}
#Placing plot
Datekitchart
```
Text-for-Narcan Data {data-orientation=rows data-icon="fa-qrcode"}
=====================================
Column {.tabset}
-------------------------------------
### "Text for Narcan" Distribution Map
```{r TFNmap, warning= FALSE}
#Light work for leafletmap prep.#
#Creating the color palette
color <- colorNumeric(palette = "BuPu",
domain = Textfornarcangeo$`Total Narcan Boxes Mailed`)
popuptext <- paste0(
" Zip Code:",Textfornarcangeo$Zip,"
",
"Total `Text-for-Narcan` Kits Mailed:
",
"",Textfornarcangeo$`Total Narcan Boxes Mailed`,"
",
Textfornarcangeo$City, ", ", Textfornarcangeo$State,"
") %>%
lapply(htmltools::HTML)
Textfornarcangeo %>%
leaflet %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPolygons(fillColor = ~color(`Total Narcan Boxes Mailed`),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =popuptext) %>%
setView(-78.823333,42.857789, zoom = 9) %>%
addLegend(pal = color,
values = ~`Total Narcan Boxes Mailed`,
opacity = 0.7,
title = htmltools::HTML(paste("Total Number of
'Text-for-Narcan'
Kits Mailed
Since",format(min(Textfornarcan$`Date mailed`),"%B %Y")),"
"),
position = "bottomright")%>%
addHomeButton(ext = c(-79.53164,42.96246,-77.9914,42.96246,-77.9914,43.24523,-79.53164,43.24523), group = Home, position = "topright", add = TRUE)
```
### "Text for Narcan" Distribution Map (City of Buffalo)
```{r TFNinnercitymap, warning = FALSE}
#Light work for leafletmap prep.#
#Creating the color palette
colorinner <- colorNumeric(palette = "BuPu",
domain = innercitygeo$`Total Narcan Boxes Mailed`)
popuptextinner <- paste0(
" Zip Code:",innercitygeo$Zip,"
",
"Total Text-for-Narcan Kits Mailed:
",
"",innercitygeo$`Total Narcan Boxes Mailed`,"
",
innercitygeo$City, ", ", innercitygeo$State,"
") %>%
lapply(htmltools::HTML)
innercitygeo %>%
leaflet %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPolygons(data = innercitygeo,
fillColor = ~colorinner(`Total Narcan Boxes Mailed`),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =popuptextinner) %>%
addHomeButton(ext = extent(innercitygeo), group = Home, position = "topright", add = TRUE) %>%
setView(-78.823333,42.914099, zoom = 12) %>%
addLegend(pal = colorinner,
values = ~`Total Narcan Boxes Mailed`,
opacity = 0.7,
title = htmltools::HTML(paste("Total Number of
Text-for-Narcan
Kits Mailed
Since",format(min(Textfornarcan$`Date mailed`),"%B %Y")),"
"),
position = "bottomright")
```
### "Text for Narcan" Distribution Summary
```{r TFNdategraph}
TFNdategraph
```
### "Text for Narcan" City Distribution Table
```{r TFNinnertable}
sd4 %>%
DT::datatable(
filter = "top", # allows filtering on each column
extensions = c("Scroller"),
rownames = FALSE,
style = "bootstrap",
class = "compact",
selection = list(mode = "multiple"),
options = list(
dom = "Blrtif", # specify content (search box, etc)
deferRender = TRUE,
scroller = FALSE,
fillContainer = TRUE,
columnDefs = list(
list(width = '50%',
visible = TRUE,
targets = "_all"))),
colnames = c(
"City" = "City",
"State" = "State",
"Number of Text-for-Narcan Kits Mailed" = "Number of Narcan Boxes Mailed"
))
```
Overall Naloxone Distribution Map {data-icon="fa-map-pin"}
=====================================
Column {.tabset}
-------------------------------------
### Total Overall Naloxone Distribution Map
```{r Overalldistmap}
#Light work for leafletmap prep.#
#Creating the color palette
coloroverall <- colorNumeric(palette = "Greens",
domain = ALLnarcanmapgeo$Total)
popuptextoverall <- paste0(
" Zip Code:",ALLnarcanmapgeo$Zip,"
",
"Total Naloxone Products Distributed:
",
"",ALLnarcanmapgeo$Total,"
") %>%
lapply(htmltools::HTML)
sd6 %>%
leaflet() %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPolygons(fillColor = ~coloroverall(Total),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =popuptextoverall) %>%
setView(-78.823333,42.857789, zoom = 9) %>%
addLegend(pal = coloroverall,
values = ~Total,
opacity = 0.7,
title = htmltools::HTML(paste("Total Estimated Number
of Naloxone Distributed
Since 2016
")),
position = "bottomright")%>%
addHomeButton(ext = c(-79.53164,42.96246,-77.9914,42.96246,-77.9914,43.24523,-79.53164,43.24523), group = Home, position = "topright", add = TRUE) %>%
addControl(htmltools::HTML(paste(" Overall, Erie County has distributed an estimated total of ", scales::comma(ALLnarcantotal)," Naloxone products since 2016.
")), position = "bottomleft" )
```
### Total Overall Naloxone Distribution Map - Erie County
```{r OverallECdistmap}
#Light work for leafletmap prep.#
#Creating the color palette
coloroverallEC <- colorNumeric(palette = "Greens",
domain = ALLECmapgeo$Total)
popuptextoverallEC <- paste0(
" Zip Code:",ALLECmapgeo$Zip,"
",
"Total Naloxone Products Distributed:
",
"",ALLECmapgeo$Total,"
") %>%
lapply(htmltools::HTML)
sd7 %>%
leaflet(height = "80%") %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPolygons(fillColor = ~coloroverallEC(Total),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =popuptextoverallEC) %>%
setView(-78.823333,42.690099, zoom = 10) %>%
addLegend(pal = coloroverallEC,
values = ~Total,
opacity = 0.7,
title = htmltools::HTML(paste("Total Estimated Number
of Naloxone Distributed
Since 2016
")),
position = "bottomright")%>%
addHomeButton(ext = c(-79.53164,42.96246,-77.9914,42.96246,-77.9914,43.24523,-79.53164,43.24523), group = Home, position = "topright", add = TRUE) %>%
addControl(htmltools::HTML(paste(" Erie County has distributed an estimated total of ", scales::comma(sum(ALLECmapgeo$Total))," Naloxone Products throughout Erie County since 2016.
")), position = "bottomleft" )
```
### Total Overall Naloxone Distribution Map - City of Buffalo
```{r OverallBuffdistmap}
#Light work for leafletmap prep.#
#Creating the color palette
coloroverallBuff <- colorNumeric(palette = "Greens",
domain = ALLBUFFmapgeo$Total)
popuptextoverallBuff <- paste0(
" Zip Code:",ALLBUFFmapgeo$Zip,"
",
"Total Naloxone Products Distributed:
",
"",ALLBUFFmapgeo$Total,"
") %>%
lapply(htmltools::HTML)
sd8 %>%
leaflet(height = "80%") %>%
addProviderTiles(providers$OpenStreetMap) %>%
addPolygons(fillColor = ~coloroverallBuff(Total),
weight = 2,
opacity = 1,
color = "#666666",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(weight = 2,
color = "#333333",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label =popuptextoverallBuff)%>%
setView(-78.823333,42.914099, zoom = 12) %>%
addLegend(pal = coloroverallBuff,
values = ~Total,
opacity = 0.7,
title = htmltools::HTML(paste("Total Estimated Number
of Naloxone Distributed
Since 2016
")),
position = "bottomright")%>%
addHomeButton(ext = c(-79.53164,42.96246,-77.9914,42.96246,-77.9914,43.24523,-79.53164,43.24523), group = Home, position = "topright", add = TRUE) %>%
addControl(htmltools::HTML(paste(" Erie County has distributed an estimated total of ", scales::comma(sum(ALLBUFFmapgeo$Total))," Naloxone Products throughout the city of Buffalo since 2016.
")), position = "bottomleft" )
```
Resources {data-orientation=rows data-icon="fa-info-circle"}
=====================================
### **Resources**
- **24 Hour Addiction Hotline 716-831-7007** - Get immediate help, education, information, referrals and assistance with linking to addiction treatment services.
- Need Narcan? Use the Text For Narcan program to have Narcan delivered directly to you!
Text your request to **716-225-5473**
- Hotline Flyers for Distribution
- Trainings and Events
- Publications, Presentation, & Related Materials
- Naloxone (Narcan) Access & Information
- Treatment
- Needle Access & Medication Disposal Sites
- Erie County H.O.P.E Project (Community Education & Prevention)
**Program Contact**
Cheryll Moore
Medical Care Administrator
95 Franklin St., Room 911
Buffalo, NY 14202
Phone: (716) 858-7695
Fax: (716) 858-8701
Cheryll.Moore@erie.gov