Noisy Neighbors and Traffic Trouble: An Analysis of NYC 311 Service Requests
By: Avonlea Fisher
Tags: Editors Pick, New York City, Civic Data, Data Science, Keras

Noisy Neighbors and Traffic Trouble

Introduction

NYC Open Data is a vast trove of City government datasets that have been made available to the public. One such dataset, 311 Service Requests from 2010 to Present, will be the focus of this article. This 311 data is updated daily and contains information about more than 24 million service requests made since 2010. For those who aren’t familiar, 311 is a phone number used in the U.S. that allows callers to access non-emergency municipal services, report problems to government agencies, and request information. This article discusses my process for exploring trends in a recent subset of the data (June-Nov. 2020), and for building a neural network to classify the government agency that responded to a given call. The full code for this project is available on its GitHub repository.

Obtaining the Data

The 311 data was obtained through the Socrata Open Data (SODA) API, which partners with NYC Open Data to host City data. The code below creates a data frame with data for the 1.5 million most recent calls.

This project also uses data from the NYC Department of City Planning’s Community District Profiles. A CSV file containing indicators for all community districts can be downloaded from any district profile. Both the 311 data and the indicators data contain a column for the community district/board. After reformatting the values and column name in the indicators data frame, it could be merged with the 311 data on their mutual “community board” column:

Exploratory Analysis

Using Plotly Express bar charts, I visualized the distribution of calls across different complaint types and government agencies. There were dozens of unique complaint types, so the first plot displays only the top 30 most frequent complaints:

Plot by Author

We can see that complaints related to noise, vehicles/traffic, utilities and trees are the most common, with noise complaints standing out as the clear majority category.

Plot by Author

The agency column is similarly imbalanced: since the NYPD handles noise complaints, it responds to the vast majority of 311 calls. The Department of Housing Preservation and Development (HPD) and the Department of Parks and Recreation (DPR) also respond to a significant proportion of calls.

To explore how the volume of calls received in different complaint categories changed over time, the function below generated daily call frequency dictionaries for a given complaint type:

There was no “day” column in the original data frame, but by converting the “created date” column to a datetime object, a new day column could be generated by applying datetime.date() to each row. This allowed for the creation of area plots that show the change in daily call counts over time. The following plot, for example, shows the daily counts for calls related to COVID-19.

Plot by Author

The non-compliance calls peaked in August, and with the exception of a couple dips, consistently exceeded 200 calls per day. Mass gathering complaints, on the other hand, were not recorded during the summer, and hover just above 100 daily calls at their peak. This does not indicate that no mass gatherings occurred in the summer (as a New Yorker, I can confidently attest to the contrary). It means, simply, that this complaint category was not formally introduced to the data before the fall. Let’s now take a look at noise complaints, which were the most common type:

The number of residential noise complaints surpasses that of other noise categories, and exceeded more than 4000 calls on some days. We would expect most people in their homes to be particularly bothered by excessive noise coming nearby locations; and with all the tiny, packed apartments in this city, it is no surprise that residential noise takes the lead here. Vehicle and sidewalk/street noise complaints are also fairly common. Next, we’ll look at a complaint type with a single peak in call count: damaged trees.

Plot by Author

Damaged tree calls are relatively rare on most days, but on August 4th and the subsequent couple of days, the call counts exceeded 12k. A quick Google search revealed the likely culprit: Tropical Storm Isaias, which not only damaged thousands of trees, but also resulted in mass power outages and took the lives of at least 5 people. This plot is demonstrative of just one form of wide-sweeping, devastating damage that natural disasters can cause.

Using Plotly’s Mapbox Density Heatmap and the location data for the calls, it was possible to create animations that show how call volume varied across the 5 boroughs:

Animation by Author