/mapping-seattle-911

Geospatial analysis of Seattle Fire Department 911 dispatch data to map Out of Hospital Cardiac Arrest (OHCA)

Primary LanguageJavaScript

mapping-seattle-911

The purpose of this data exploration is an answer a simple question: Where do cardiac arrests occur in Seattle, WA? This type of analysis can be useful for staging ambulances, positioning AEDs, and targeting community enagagement. animated time series map of seattle 911 dispatched for Medical emergencies

The purpose of this project is to faciliate mapping and geospatial analysis of open source Seattle Fire Realtime 911 data, with a particular focus on out of hospital cardiac arrest (OHCA).

Out of Hospital Cardiac Arrest is a life threatening emergency. Prompt initation of high quality CPR, early defibrilation, and advanced life support and transport to a suitable medical center can dramatically improve outcomes. Because of the time sensitive nature of cardiac arrest resuscitation, geospatial analysis of where cardiac arrests occur is potentially useful. Thus, identifying 'hotspots' for OHCA can conceivable be used in several different ways:

  • it can be used to determine where to place AEDs
  • it can be used to determine staging locations for ambulances

initial data exploration

  • You can see the realtime feed of 911 dispatches which is a fairly unique level of transparency provided by the City of Seattle. In another repository, I show you we can use this near-realtime feed to predict ED visits.
  • I pull data from the Seattle Fire 911 API provided by the Seattle Open Data Program.
  • I use the incident type "Medical Response, 7 per rule" to identify high acuity medical emergencies, of which OHCA is one particular subtype. This is not quite perfect (it also includes medical emergencies like 'person not breathing' but it's a good first pass approximation.

incident type example

  • Next I loaded the flat file (.csv) into powerBI and used ArcGIS esri to explore the data. Unfortunately, there are so many events it can be hard to identify patterns, even if we create an automated time slicer:

animated time series map of seattle 911 dispatched for Medical emergencies

  • We can use alternative visualization tools, such as MapBox to build simple heatmaps. This starts to show us some more subtle patterns in the data.

  • But what if we want more nuanced control of the visualization? For this it helps to use the GoogleMaps API directly.
  • I export the GPS coordinates of these events and load them into the Google Maps Javascript API where I display the events as a heatmap.
  • The Google maps API makes it easy to zoom and translate on the map. You can adjust the color scheme, and the heatmap gradient, and other parameters
var map, heatmap;\
// load map centered on Seattle, default is roadmap\
function initMap() \{\
  map = new google.maps.Map(document.getElementById('map'), \{\
    zoom: 11,\
    center: \{lat: 47.63, lng: -122.35\},\
    mapTypeId: 'roadmap'\
  \});\
\
// ideally would like to have multiple different heatmaps, for now just one\
  heatmap = new google.maps.visualization.HeatmapLayer(\{\
    data: getPoints(),\
    map: map\
  \});\
\}\
\
// default = red/green, alternative = red/blue\
function toggleHeatmap() \{\
  heatmap.setMap(heatmap.getMap() ? null : map);\ 
\}\
function changeRadius() \{\
  heatmap.set('radius', heatmap.get('radius') ? null : 19);\
\}\
\
function changeOpacity() \{\
  heatmap.set('opacity', heatmap.get('opacity') ? null : 0.2);\
\}\

example image

  • This is a much more efficient way to specify some of the parameters for visualization. We can also make it more user friendly and interactive.
  • The final live map of OHCA in Seattle can be found here:
  • https://jsfiddle.net/user/nickmmark/fiddles/
<script async src="//jsfiddle.net/nickmmark/j6k2vhg0/embed/"></script>

mapping cardiac arrest calls in Seattle, WA

Data Source(s)

Version/To-Do

v1.0 by Nick Mark, 7/16/2017

  • need to load census data for population density to normalize
  • would also be helpful to explore by ZIP and aggregate

References