generated from usf-cs360-spring2020/template-bulma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preparationtime.html
261 lines (227 loc) · 12.2 KB
/
preparationtime.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ColorIsFake Midterm</title>
<!-- Load Bulma from CDN (consider saving it to repository instead) -->
<!-- https://bulma.io/ -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
<!-- Load Font Awesome 5 (free) icons -->
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<!-- include d3.js v5 -->
<script src="https://d3js.org/d3.v5.min.js"></script>
<!-- include d3.js modules -->
<!-- <script src="https://d3js.org/d3-array.v2.min.js"></script>-->
<!-- <script src="https://d3js.org/d3-fetch.v1.min.js"></script>-->
<!-- <script src="https://d3js.org/d3-time.v1.min.js"></script>-->
<!-- <script src="https://d3js.org/d3-time-format.v2.min.js"></script>-->
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-dispatch.v1.min.js"></script>
<script src="https://d3js.org/d3-ease.v1.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
<script src="https://d3js.org/d3-timer.v1.min.js"></script>
<script src="https://d3js.org/d3-selection.v1.min.js"></script>
<script src="https://d3js.org/d3-transition.v1.min.js"></script>
<script src="https://d3js.org/d3-drag.v1.min.js"></script>
<script src="https://d3js.org/d3-brush.v1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-legend/2.25.6/d3-legend.min.js" integrity="sha256-qo76Vs9B6JAALbrTn+PcN1r09hbNLd2M78V19glOMeU=" crossorigin="anonymous"></script>
<!-- My CSS! -->
<link rel="stylesheet" href="resources/eve-style.css">
</head>
<body>
<!-- Page header -->
<!-- https://bulma.io/documentation/layout/hero/ -->
<section class="hero is-primary is-bold">
<div class="hero-body">
<div class="container">
<h1 class="title">ColorIsFake Midterm</h1>
<h2 class="subtitle">Chaitrika, Priscilla, and Eve's Data Visualization Site</h2>
</div>
</div>
</section>
<!-- End page header -->
<!-- Page navigation -->
<!-- https://bulma.io/documentation/components/navbar/ -->
<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href="index.html">
<span class="icon"><i class="fas fa-home"></i></span>
<span>Home</span>
</a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="main-menu">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="main-menu" class="navbar-menu has-text-weight-medium">
<!-- Left navbar items -->
<div class="navbar-start">
<a class="navbar-item" href="dataset.html" title="Dataset">
<span class="icon"><i class="fas fa-table"></i></span>
<span>Dataset</span>
</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Visualizations
</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="responsetime.html">
<span class="icon"><i class="fas fa-chart-line"></i></span>
<span>Priscilla - Response Time</span>
</a>
<a class="navbar-item is-active" href="preparationtime.html">
<span class="icon"><i class="fas fa-chart-area"></i></span>
<span>Evelyn - Preparation Time</span>
</a>
<a class="navbar-item" href="hospitalaccesstime.html">
<span class="icon"><i class="fas fa-chart-bar"></i></span>
<span>Chaitrika - Hospital Access Time</span>
</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Prototypes
</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="responsetime-prototype.html">
<span class="icon"><i class="fas fa-chart-line"></i></span>
<span>Priscilla - Response Time</span>
</a>
<a class="navbar-item" href="preparationtime-prototype.html">
<span class="icon"><i class="fas fa-chart-area"></i></span>
<span>Evelyn - Preparation Time</span>
</a>
<a class="navbar-item" href="hospitalaccesstime-prototype.html">
<span class="icon"><i class="fas fa-chart-bar"></i></span>
<span>Chaitrika - Hospital Access Time</span>
</a>
</div>
</div>
</div>
<!-- Right navbar items -->
<div class="navbar-end">
<a class="navbar-item" href="about.html" title="About">
<span class="icon"><i class="fas fa-info-circle"></i></span>
<span>About the Team</span>
</a>
</div>
</div>
</div>
</nav>
<!-- End page navigation -->
<section class="section">
<div class="container">
<!-- Begin page content -->
<div class="content">
<h2>Visualizations</h2>
<p>
In my visualizations, I chose to focus on 'preparation time': how long it takes fire department units to prepare for a call, or the difference between when a call is sent from a 911 dispatcher (dispatch time) and when the unit leaves the station (response time).
I focus on three of the most common types of incidents - medical incidents, structure fires, and traffic collisions - and only on the preparation time for the first response vehicle dispatched to any given call.
</p>
<p>
For each, I separate the data by weekday and hour of the day, then calculate the average preparation time for all matching responses.
Average preparation time is encoded as color, and the number of matching responses is encoded as the height of the bar.
</p>
<p>
So, <strong>higher bars</strong> represent higher call volumes at a given time on a given weekday.
<strong>Darker bars</strong> represent a longer preparation time during that same interval.
</p>
<h3>Interactivity</h3>
<p>Each of these visualizations has two types of interactivity: data-on-demand hover tooltip and overview + detail brushing.</p>
<p>
The user can hover their cursor over any bar (including in the overview) to view more detailed information about the data it represents.
</p>
<p>
The user can also adjust which years the visualization is including data from.
Move the edges of the overview plot's brushed area by clicking and dragging, then release to update the main plot.
</p>
<svg class="visualization" id="fire"></svg><br><br>
<svg class="visualization" id="medical"></svg><br><br>
<svg class="visualization" id="traffic"></svg><br><br>
<script src="preperationtime.js"></script>
<h3>Findings and Relevance to Overall Theme</h3>
<p>
Examining the processing time at different times during the week shows discrepancies in how efficiently the system is able to respond to different incidents.
The visualizations show that the fire department is more or less prepared to send help to where it's needed depending on what time of day and what day of the week it is.
</p>
<p>
Many of these times when processing times are higher happen during periods of the week when fewer incidents take place, but some have high rates of incidents AND high average processing time (such as medical incidents at 2AM on Saturday and Sunday).
This demonstrates times when the fire department is less effective for the people who need it then.
</p>
<p>
On the other hand, exploring the data using the detail + overview interactivity reveals that the SF Fire Department's preparation times have decreased over the past two decades, despite rising call volumes.
Especially for Medical incidents, today the system has a lower average preparation time than twenty years ago, which is a good thing for San Franciscans and worth celebrating!
</p>
<h3>Data Wrangling</h3>
<p>After loading the entire dataset (downloaded February 20, 2020: 35 columns and 5210953 rows) into Tableau, worksheet created for each visualization (based on data downloaded in February 2020) into Tableau, I created a worksheet to export the data I needed for my final visualization.
It was created as follows:</p>
<ul>
<li>Filtered by Call Type : removed all but "Medical Incident", "Structure Fire", and "Traffic Collision".</li>
<li>Filtered by Year of Entry Date and Time : removed 2000 and 2020 </li>
<li>Filtered by Unit Sequence in Call Dispatch : kept only 1</li>
<li>Filtered by Processing Minutes (Response Date and Time minus Dispatch Date and Time) : kept only 0 to 60</li>
<li>Filtered by Neighborhood : removed "none"</li>
<li>Added Hour of Entry Date and Time as a column</li>
<li>Added rows in the following order: Call Type, Year of Entry Date and Time, Weekday of Entry Date and Time, Sum of Number of Records</li>
<li>Added Average of Processing Minutes as a mark for color.</li>
</ul>
<p>I then exported the data used by tableau for that worksheet (Worksheet > Export > Data), and saved it as a file onto my computer.
I used Sublime Text to convert the file from tab-separated-value format to comma-separated-value.
Next, I opened the file in Microsoft Excel, then saved it back as a .csv file to fix its text encoding.
Finally, I opened the csv file in Atom and used it to convert from carriage return line format to standard unix line format.</p>
<p>Once I had the data in a format to add to d3, I did further wrangling with Javascript to filter by year, depending on the brushing performed by the user. This gets re-run each time the user brushes on the overview of a visualization.</p>
<h3>Inspirations</h3>
<p>
I was inspired by <a href="https://observablehq.com/@d3/focus-context">Mike Bostocks's Focus + Context example</a> for my the brushed overview interactivity.
</p>
<p>
I used Professor Sophie Engles lectures and examples extensively for reference.
</p>
<p>
I used <a href="https://d3-legend.susielu.com">Susie Lu's D3 Legend package.</a>
</p>
<p></p>
</div>
<!-- End page content -->
</div>
</section>
<!-- Page footer -->
<!-- <div class="false-footer"></div>-->
<!-- https://bulma.io/documentation/layout/footer/ -->
<footer class="footer smaller-footers-are-better">
<div class="content has-text-centered is-size-7">
<p>
<a href="https://fontawesome.com/" class="button is-small" style="padding-left: 1em; padding-right: 1em;">
<i class="fab fa-font-awesome"></i> <strong>FontAwesome</strong>
</a>
<a href="https://bulma.io" class="button is-small">
<img src="https://bulma.io/images/made-with-bulma--semiblack.png" alt="Made with Bulma" width="128" height="24">
</a>
</p>
</div>
</footer>
<!-- End page footer -->
<!-- Mobile menu responsiveness -->
<!-- https://bulma.io/documentation/components/navbar/ -->
<script>
document.addEventListener('DOMContentLoaded', () => {
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
if ($navbarBurgers.length > 0) {
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
const target = el.dataset.target;
const $target = document.getElementById(target);
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
});
</script>
<!-- End mobile menu responsiveness -->
</body>
</html>