D3 Hierarchical Tree of Fire department Call Records in Feb 2020 by Neighborhoods and Call Types.

For this project, I've visualized the data from the Fire Department Calls for Service dataset using hierarchical data visualization techniques (hierarchical tree) in D3 version 5.

Dataset

Fire Calls-For-Service includes all fire units responses to calls. Each record includes the call number, incident number, address, unit identifier, call type, and disposition. All relevant time intervals are also included. Because this dataset is based on responses, and since most calls involved multiple units, there are multiple records for each call number. Addresses are associated with a block number, intersection or call box, not a specific address.

Dataset Information

I accessed this data on April 21, 2020 and by the date I fetched it, it had the following details.

  • Data Last Updated: April 21, 2020
  • Metadata Last Updated: April 21, 2020
  • Date Created: December 17, 2015
  • Dataset Owner: OpenData
  • Publishing Department: Fire Department
  • Geographic unit: Street address
  • Publishing frequency: Daily
  • Data change frequency: Daily
obi-onyeador-HMcd1bWLTjo-unsplash

Dataset Analysis

This dataset has 5.26M rows and 34 columns, while each row is a response.

Columns in this dataset

Column Name Description Type
Call Number A unique 9-digit number assigned by the 911 Dispatch Center (DEM) to this call. These number are used for both Police and Fire calls. Plain Text
Unit ID Unit ID Plain Text
Incident Number A unique 8-digit number assigned by DEM to this Fire incident. Plain Text
Call Type Call Type Plain Text
Call Date Date the call is received at the 911 Dispatch Center. Used for reporting purposes. Date & Time
Watch Date Watch date when the call is received. Watch date starts at 0800 each morning and ends at 0800 the next day. Date & Time
Received DtTm Date and time of call is received at the 911 Dispatch Center. Date & Time
Entry DtTm Date and time the 911 operator submits the entry of the initical call information into the CAD system Date & Time
Dispatch DtTm Date and time the 911 operator dispatches this unit to the call. Date & Time
Response DtTm Date and time this unit acknowledges the dispatch and records that the unit is en route to the location of the call. Date & Time
On Scene DtTm Date and time the unit records arriving to the location of the incident Date & Time
Transport DtTm If this unit is an ambulance, date and time the unit begins the transport unit arrives to hospital Date & Time
Hospital DtTm If this unit is an ambulance, date and time the unit arrives to the hospital. Date & Time
Call Final Disposition Disposition of the call (Code). For example TH2: Transport to Hospital – Code 2, FIR: Resolved by Fire Department Plain Text
Available DtTm Date and time this unit is not longer assigned to this call and it is available for another dispatch. Date & Time
Address Address of incident (note: address and location generalized to mid-block of street, intersection or nearest call box location, to protect caller privacy). Plain Text
City City of incident Plain Text
Zipcode of Incident Zipcode of incident Plain Text
Battalion Emergency Response District (There are 9 Fire Emergency Response Districts) Plain Text
Station Area Fire Station First Response Area associated with the address of the incident Plain Text
Box Fire box associated with the address of the incident. A box is the smallest area used to divide the City. Each box is associated with a unique unit dispatch order. The City is divided into more than 2,400 boxes. Plain Text
Original Priority Initial call priority (Code 2: Non-Emergency or Code 3:Emergency). Plain Text
Priority Call priority (Code 2: Non-Emergency or Code 3:Emergency). Plain Text
Final Priority Final call priority (Code 2: Non-Emergency or Code 3:Emergency). Plain Text
ALS Unit Does this unit includes ALS (Advance Life Support) resources? Is there a paramedic in this unit? Checkbox
Call Type Group Call types are divided into four main groups: Fire, Alarm, Potential Life Threatening and Non Life Threatening. Plain Text
Number of Alarms Number of alarms associated with the incident. This is a number between 1 and 5. Number
Unit Type Unit type Plain Text
Unit sequence in call dispatch A number that indicates the order this unit was assigned to this call Number
Fire Prevention District Bureau of Fire Prevention District associated with this address Plain Text
Supervisor District Supervisor District associated with this address (note: these are the districts created in 2012). Plain Text
Neighborhooods – Analysis Boundaries Neighborhood District associated with this address Plain Text
Location Location of incident (note: address and location generalized to mid-block of street, intersection or nearest call box location, to protect caller privacy). Location
RowID Unique Call Number and Unit ID combination Plain Text

Dataset License

This dataset uses the Public Domain Dedication and License (PDDL).

Except where otherwise stated in the file containing such Data or on the page from which such Data is accessed, including its metadata, Data is made available under the Public Domain Dedication and License v1.0 whose full text can be found at: http://www.opendatacommons.org/licenses/pddl/1.0/

Data Encoding

  • Tree Levels
    • 1st level: fire department
    • 2nd level: neighborhoods
    • 3td level: call types
  • Colors
    • White: the parent node – fire department and neighborhoods
    • Other colors: the children node – call types
  • Links
    • Left side: parent node
    • Right side: child node
  • Legends: different colors for call types

Data Wrangling

API Request Filter and Sorting

In the website of the fire department, I did some data wrangling to narrow down my dataset, I used the filter to only select the data from the Feb 2020 and sorter them by the number of call types, so they will have the same order in each neighborhood.

Convert the fire depatment records to a hierarchical format (SF fire department records -> Neighborhoods -> Call Types)

The original dataset doesn’t have a hierarchy based on the neighborhoods and call types. Although there are some ways to wrangle it in d3, I decided to wrangle it with vanilla JavaScript considering the hierarchy that I need only has three levels.

So, I fetched all the records of Feb 2020 with the API and sorted them by call types(making sure they follow the same order). I created a new object of the fire department, and store each neighborhood as its children, and each neighborhood also has a list of children, which is a list of different call types. While loading the records, each record will be saved to the list of neighborhoods and the list of call types in that neighborhood.

D3 Hierarchical Tree of Fire department Call Records in Feb 2020 by Neighborhoods and Call Types Interactivity1

Tooltip

Hovering on a node will wake the details-on-demand interactivity, which will display the name of the node and the number of records of the node.


Write a Comment