H.T.
Fire Response
API and App

Academic Project in Collaboration with
Philadelphia Fire Department
Instructor: Ken Steif, Michael Fichman
Jan 2021 to May 2021
Access to the web app: https://haoheng-tang.github.io/fireapp21/

1. Background




2. Framework

We trained a model to predict whether the relative fire risk is high or not for any property in the city. Additionally, we built an API tool that demands an address as an input, requests relative data from other sources, parse all the data, make a prediction out the fire risk and output all this information in a clean format. We also created an app as the front end of the API tool.



3. Algorithms

3.1 Exploratory Data Analysis

3.2 Feature Engineering



We resampled the dataset until the catching-fire percentage raised to 20%, i.e., once in every 5 properties. This resampling processed helped to improve the model accuracy. However, it also distorted the probability of buildings catching fire. In other words, our model tends to predict more buildings fires than in reality. With our final predictor variables determined and training set resampled, we proceeded to test different algorithms to identify which would be the best in predicting property fire risk in Philadelphia. We developed a generalized linear regression model (GLM) and a random forest model (RF). As we compared the model criteria, we found that the RF model showed no significant superiority compared to the GLM model in terms of sensitivity and specificity. Thus, we decided to adopt GLM as our final model, for its relative simplicity ensured higher interpretability.

4. API Construction

4.1 Introduction to API

An API is an interface that defines interactions between multiple software applications. When someone uses an application on his or her device, the application connects to the Internet and sends data to a server. The server then retrieves that data, interprets it, performs the necessary actions and sends it back to the device. The application then interprets that data and presents the information in a readable way.

4.2 Local & Cloud Construction

First, the API we built can provide real-time data. It requests the latest data only when getting an input.
Second, the API integrates data from diffuse data sources of the city. It’s convenient to use it because it gives us all the information we want in only one request.
Third, the API provided clean and consistent data for us. It means the API gives back data without redundant or irrelevant information. It also structures it to make the response highly readable.
Last but not least, the API can be used for developments of multiple apps without causing any conflict. Apps in different usages can use the same API to get data/



The API get an address as input, request basic information and data needed for prediction. It outputs all the integrated data and the relative fire risk prediction in a clean format.
We created a web app which serves as a front end of the API tool. Here is the access to it:
https://haoheng-tang.github.io/fireapp21/

Besides the input address, the parcels within 50 meters also show up on the map. It’s important to know whether the fire will spread to these parcels, and which of these parcels are likely to catch fire. Click on one of these markers, the web page will change and provide information for that parcel. By doing so, you will know the risk assessment of those parcels close to the one on fire and decide whether to pay more attention on them. You see, all the information changed to that parcel’s, and as is shown, its relative risk is also above average.