Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Follow publication

Optimizing Emergency Response in Calgary

Vishnu Regimon Nair
Towards AI
Published in
8 min readApr 7, 2024

--

Photo by Constante Lim on Unsplash

Facing the Growing Challenge: Optimizing Emergency Response Times in Calgary

Unlocking Efficiency: Mapping Response Times in Calgary’s Emergency Services

Leveraging Open Data: The Foundation of the Analysis

Bridging the Gap: Acknowledging Real-World Factors in Response Time Modeling

Building the Framework: How We Calculated Response Times

Calgary Fire Station Response Times

Image by Author
# Create a map
m = folium.Map(location=[51.0447,-114.0719], zoom_start=10)

for index, row in df_fire.iterrows():
folium.CircleMarker(
location=[row["LAT"], row["LON"]],
popup=row["NAME"],
tooltip=row["NAME"],
radius=2,
fill=True,
fill_color="red",
fill_opacity=1,
icon=folium.Icon(color="red"),
color="red",
opacity=1,
weight=1
).add_to(m)

# Add the shapefile with color ranges to the map
folium.GeoJson(
df_avgtimes_fire,
style_function=lambda x: {
"fillColor": color_scale(x["properties"]["Avg_time"]),
"color": "black",
"weight": 2,
"fillOpacity": 0.6,
},
tooltip=folium.GeoJsonTooltip(fields=["FSA", "Avg_time"], aliases=["FSA", "Avg Response Time(min)"], sticky=False),
highlight_function=lambda x: {
"weight": 4,
"fillOpacity": 0.9,
},
name="Average Response Time (s)"
).add_to(m)
Image by Author
fig_bar = px.bar(df_avgtimes_fire, x='FSA', y='Avg_time', labels={'FSA':'Forward Sortation Area', 'Avg_time':'Average Response Time (mins)'})
fig_bar.update_traces(marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)', marker_line_width=1.5, opacity=0.6)
fig_bar.update_layout(title_text='Average Emergency Response Times by FSA')
fig_bar.add_hline(y=7, line_dash="dash", line_color="red",
annotation_text="Target",annotation_font_color="red")
st.plotly_chart(fig_bar, use_container_width=True)
Image by Author
fig_hist = px.histogram(df_avgtimes_fire, x='Avg_time', nbins=20, labels={'Avg_time':'Average Response Time (mins)'})
fig_hist.update_traces(marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)', marker_line_width=1.5, opacity=0.6)
fig_hist.update_layout(title_text='Distribution of Emergency Response Times',yaxis_title = 'Count')
fig_hist.add_vline(x=7, line_dash="dash", line_color="red",
annotation_text="Target",annotation_font_color="red")
st.plotly_chart(fig_hist, use_container_width=True)
Image by Author
Image by Author
Image by Author

Emergency Medical Services Response Times

Image by Author
Image by Author
Image by Author
Image by Author
Image by Author

Optimizing Calgary’s Response: Targeted Recommendations

Image by Author

Ensuring Equity in Response Times: Balancing Optimization with Ethics

Saving Lives Starts Now: A Call to Action for Improved Response Times

--

--

No responses yet