This interactive asset map is designed to provide comprehensive information on the resources available for individuals dealing with Opioid Use Disorder (OUD) in Barry County. It serves as a visual guide to locate and access various OUD services, including treatment centers, rehabilitation facilities, support groups, and prevention programs.
Our goal is to connect community members, healthcare providers, and stakeholders with the necessary tools to support recovery and address the challenges associated with opioid addiction. The map includes detailed information on each resource, such as services offered, contact information, and the type of insurance accepted, enabling users to find tailored support that meets their specific needs.
Through this platform, we aim to enhance community engagement, facilitate easier access to vital services, and contribute to the ongoing efforts to combat the opioid crisis in Barry County. As you navigate the map, we encourage you to reach out to the listed organizations for further information and support.
Before we begin, we need to install the necessary packages for this project. These packages include ggmap, shiny, leaflet, DT, ggplot2, shinydashboard, shinyWidgets, shinyjs, shinythemes, leaflet.extras, leaflet.providers, leaflet.minicharts, and purrr. These packages will be used for data manipulation, visualization, and creating the interactive map.
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
##
## The downloaded binary packages are in
## /var/folders/wp/b7x51r2d1bjfmsgydpfs6p_m0000gn/T//RtmpoblAOg/downloaded_packages
Next, we will load the required libraries to use the installed packages. These libraries include tidyverse, dplyr, ggmap, shiny, leaflet, DT, ggplot2, shinydashboard, shinyWidgets, shinyjs, shinythemes, leaflet.extras, leaflet.providers, leaflet.minicharts, and purrr.
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## ℹ Google's Terms of Service: <https://mapsplatform.google.com>
## Stadia Maps' Terms of Service: <https://stadiamaps.com/terms-of-service/>
## OpenStreetMap's Tile Usage Policy: <https://operations.osmfoundation.org/policies/tiles/>
## ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.
##
## Attaching package: 'DT'
##
##
## The following objects are masked from 'package:shiny':
##
## dataTableOutput, renderDataTable
##
##
##
## Attaching package: 'shinydashboard'
##
##
## The following object is masked from 'package:graphics':
##
## box
##
##
##
## Attaching package: 'shinyjs'
##
##
## The following object is masked from 'package:shinyWidgets':
##
## alert
##
##
## The following object is masked from 'package:shiny':
##
## runExample
##
##
## The following object is masked from 'package:lubridate':
##
## show
##
##
## The following objects are masked from 'package:methods':
##
## removeClass, show
##
##
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
##
## here() starts at /Users/cecilia/Desktop/CDC_FOUNDATION/Overdose_Analysis
The data used in this project is a combination of two datasets: the Barry County Assets and Services dataset and the Local Units shapefile. The Barry County Assets and Services dataset contains information on the various resources available for individuals dealing with Opioid Use Disorder (OUD) in Barry County. The dataset includes details such as the name of the organization, address, city, state, zip code, phone number, and the type of services offered. The Local Units shapefile contains the geographical boundaries of the local units in Barry County. We will use this shapefile to create the map and visualize the locations of the resources.
# Construct the paths to the CSV file and the shapefile
bc_assets_services_path <- here("BC_AssetMap", "bc_assets_services_desktop.csv")
local_units_path <- here("BC_AssetMap", "Local_Units", "LocalUnits.shp")
# Read the CSV file and the shapefile using the paths
bc_assets_services <- read_csv(bc_assets_services_path)
## Rows: 53 Columns: 32
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): name, service_type, address, city, state, country, phone_number, e...
## dbl (23): zipcode, mat, rehab_residential, rehab_inpatient, rehab_outpatient...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
local_units <- st_read(local_units_path)
## Reading layer `LocalUnits' from data source
## `/Users/cecilia/Desktop/CDC_FOUNDATION/Overdose_Analysis/BC_AssetMap/Local_Units/LocalUnits.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 21 features and 14 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -85.54558 ymin: 42.41969 xmax: -85.07155 ymax: 42.77079
## Geodetic CRS: WGS 84
In this step we will use the ggmap package to geocode the addresses in the dataset to get the latitude and longitude coordinates for each location. This will allow us to plot the locations on the map.
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=500+Barfield+Dr,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1108+West+State+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1009+West+Green+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=220+S+Broadway+St+Ste+1,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=206+W+Court+St+%23104,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1230+W+State+St+Ste+335,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=200+S+Boltwood+St.,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=450+Meadow+Run,%E2%80%AFSuite+300%E2%80%AF,%E2%80%AFHastings,%E2%80%AFMI%E2%80%AF49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=2750+M-43,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=209+W+Green+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=5505+Otis+Lake+Rd,+Delton,+MI+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=11137+Floria+Rd,+Delton,+MI,+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=141+Irving+Rd,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=111+Church+St,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=330+W+Woodlawn+Ave.,+Hastings,+MI,+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=430+Barfield+Dr,+Hastings,+MI,+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=231+S+Broadway+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=PO+Box+388,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=220+W+State+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=11+Green+St,+Battle+Creek,+MI+49014&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=990+W.+Kilgore+Rd,+Kalamazoo,+MI+49008&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=225+Commerce+Ave+SW,+Grand+Rapids,+MI+49503&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=448+N+Burdick+St,+Kalamazoo,+MI+49007&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=144+Division+Ave+S,+Grand+Rapids,+MI+49503&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=5500+Armstrong+Rd,+Battle+Creek,+MI+49037&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1215+N+Broadway,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=231+S+Broadway+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=130+E+State+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=206+W.+Court+St.,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=303+Capital+Ave+NE,+Battle+Creek,+MI+49017&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=3490+Belle+Chase+Way+Ste+50,+Lansing,+MI+48911&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=2055+Iroquois+Trl,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1216+W+State+St,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=500+Barfield+Dr,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=301+S+Michigan+Ave,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=20+State+St,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=12081+S+M43+Hwy,+Delton,+MI+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=2750+Michigan+43+Hwy,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=330+W+Woodlawn+Ave,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=206+W.+Court+St.,+Ste.+103%E2%80%AF,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=301+S+Michigan+Ave,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=90+Edward+St.,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=330+N+Grove+St.,+Delton,+MI+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=338+North+Grove+St.,+Delton,+MI+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=902+W.+State+St.,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=227+E+State+St.,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=124+E+Main+St.,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=219+Main+St.,+Nashville,+MI+49073&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=4652+N.+M-37+Hwy,+Middleville,+MI+49333&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=327+Main+St.,+Nashville,+MI+49073&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=210+S+Grove+St.,+Delton,+MI+49046&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=126+N+Broadway,+Hastings,+MI,+49058&key=xxx-Cn2gWrHHP1fcpU>
## ℹ <https://maps.googleapis.com/maps/api/geocode/json?address=1618+W+M+43+Hwy,+Hastings,+MI+49058&key=xxx-Cn2gWrHHP1fcpU>
Here we will load the geocoded data that we saved to a CSV file in the previous step.
## Rows: 53 Columns: 34
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): name, service_type, address, city, state, country, phone_number, e...
## dbl (25): zipcode, mat, rehab_residential, rehab_inpatient, rehab_outpatient...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Now that we have the geocoded data, we can create an interactive map to visualize the locations of the resources in Barry County. We will use the leaflet package to create the map and add markers for each resource. The markers will display the name of the organization, address, and the type of services offered when clicked. We will also add a search bar to allow users to search for specific resources by name.
# Create the map
bc_assets_services_geocoded <- bc_assets_services_geocoded %>%
mutate(
treatment = mat == 1 | rehab_inpatient == 1 | rehab_outpatient == 1 | rehab_outpatient_iop == 1 | rehab_detox == 1 | sud_assess == 1,
support = rowSums(select(., starts_with("support_")) == 1, na.rm = TRUE) > 0,
service_category = case_when(
treatment ~ "treatment",
support ~ "support",
TRUE ~ "default"
)
)
m <- leaflet(bc_assets_services_geocoded) %>%
addProviderTiles(providers$OpenStreetMap) %>% # Add base tiles
addCircleMarkers(
~longitude, ~latitude,
popup = ~paste(name, "<br>", address),
color = ~case_when(
service_category == "treatment" ~ "#FF7F50",
service_category == "support" ~ "#2E8B57",
TRUE ~ "#483d8b"
),
fillColor = ~case_when(
service_category == "treatment" ~ "#FF7F50",
service_category == "support" ~ "#2E8B57",
TRUE ~ "#483d8b"
),
fillOpacity = 0.9,
group = ~service_category
) %>%
addLegend(
"bottomright",
colors = c("#FF7F50", "#2E8B57", "#483d8b"),
labels = c("Treatment", "Support Services", "Other Services"),
title = "Service Type"
) %>%
addControl(
html = "<h2>Barry County's Opioid Recovery and Support Resource Map</h2>",
position = "topleft"
)%>%
addPolygons(
data = local_units,
fillColor = "#A9A9A9", # Set fill color to transparent
weight = 2, # Boundary weight
opacity = 0.5, # Boundary opacity
label = ~UNIT, # Use the 'UNIT' column for labeling the polygons
)
# Display the map
m
To provide additional context, we will display the townships in Barry County on the map. This will help users understand the geographical distribution of the resources and their proximity to different townships.
m2 <- leaflet(bc_assets_services_geocoded) %>%
addProviderTiles(providers$OpenStreetMap) %>% # Add base tiles
addCircleMarkers(
~longitude, ~latitude,
popup = ~paste(name, "<br>", address),
color = ~case_when(
service_category == "treatment" ~ "#FF7F50",
service_category == "support" ~ "#2E8B57",
TRUE ~ "#483d8b"
),
fillColor = ~case_when(
service_category == "treatment" ~ "#FF7F50",
service_category == "support" ~ "#2E8B57",
TRUE ~ "#483d8b"
),
fillOpacity = 0.9,
group = ~service_category
) %>%
addLegend(
"bottomright",
colors = c("#FF7F50", "#2E8B57", "#483d8b"),
labels = c("Treatment", "Support Services", "Other Services"),
title = "Service Type"
) %>%
addControl(
html = "<h2>Barry County's Opioid Recovery and Support Resource Map</h2>",
position = "topleft"
)%>%
addPolygons(
data = local_units,
fillColor = "#A9A9A9", # Set fill color to transparent
weight = 2, # Boundary weight
opacity = 0.5, # Boundary opacity
label = ~UNIT, # Use the 'UNIT' column for labeling the polygons
labelOptions = labelOptions(noHide = TRUE, textOnly = TRUE, direction = "center")
)
# Display the map
m2
Treatment services are variables that indicate the availability of different types of treatment services, such as medication-assisted treatment (MAT), residential rehabilitation, inpatient rehabilitation, outpatient rehabilitation, intensive outpatient programs, and detoxification services.
Support services are variables that indicate the availability of various support services, such as housing support, employment support, legal support, transportation support, childcare support, food support, mental health support, and skill-building support.
Other services are variables that do not fall into the treatment or support categories which include services such as substance use disorder assessments, prevention programs, and other resources.