Skip to main content

Lab 3 — Street Bump

Skills: 1, 2

Introduction

In this lab, you’ll work with a simple representation of Boston’s “Street Bump” pothole-detection data. Each pothole is modeled as a record containing its zipcode, latitude, and longitude.

Problem 1

For this first problem, we'd like you to define a new table z02115 containing only rows whose zipcode field equals 02115. You can find the list of Boston's potholes in the potholes_2024.csv file, which you should load then filter through to find potholes that are found in the zipcode 02115. (Hint: the function filter-with may be helpful here!)

Use scatter-plot to visualize the latitude and longitude of the 02115 potholes. While latitude and longitudes are coordinates that represent degrees on the planet, at close enough distances, treating them as X / Y coordinates on a flat surface produces recognizable visualizations.

Problem 2

Potholes are a big problem in Boston. The task of fixing potholes throughout the city first requires locating them. 311 – a special telephone number for reporting non-emergency problems to city officials – is a valuable source for this data. Residents can report where services are needed and give further explanation, if needed. In 2023, Boston found that they could supplement this data with anonymized data from Mercedes-Benz vehicles. https://www.boston.gov/departments/analytics-team/automated-pothole-detection-0

Imagine you work for the City of Boston and you care about the city’s neighborhoods receiving equal attention when it comes to pothole repairs, rather than some neighborhoods regularly receiving higher priority than others.

Question: You already have the data received through 311 reports. Based on the “Automated Pothole Detection” page linked above, explain in two or three sentences why using data from 311 calls alone does not provide enough information to help ensure that city neighborhoods will receive equal attention for pothole repairs and why adding anonymized data from Mercedes-Benz vehicles would help neighborhoods receive equal services.

Put your answer as a comment.

Problem 3

Create a new table ordered-by-lat that contains all the rows from your z02115 table sorted by the "latitude" column in ascending order (so the southernmost points come first). Once you’ve built ordered-by-lat, define a constant LOWEST-LAT which extract the first row of the transformed table to identify which neighborhood has the lowest latitude.

Problem 4

Finally, you’ll enrich your z02115 table by adding a new "midpt" column that captures the average of each pothole’s latitude and longitude. First, define a helper function:

fun mid-point(row :: Row) -> Number:
doc: "calculates the midpoint of a pothole"
# IMPLEMENT HERE
end

Then, use build-column to attach "midpt" to z02115, producing a new table potholes-with-midpt where every row includes its computed midpoint.