Boston RentSmart housing conditions by address

RentSmart Boston joins BOS:311 requests to Inspectional Services enforcement records so that a prospective tenant can see the complaint and violation history of a specific address: 491,953 rows across four DataStore-loaded resources, of which the main file holds 387,923. One row is one recorded issue at one address. Each carries the timestamp, the violation_type (Housing Violations, Building Violations, Enforcement Violations, Housing Complaints, Sanitation Requests, Civic Maintenance Requests), a free-text description of the specific problem (Rodent Activity, Illegal Occupancy, No Heat, Unsanitary Conditions), the address and ZIP, the neighborhood, the assessing parcel id, the property owner name, the year built and year remodeled, the property type (for example 'Residential 3-family'), and latitude and longitude. The parcel column joins directly to the Property Assessment rolls and to the 2025 parcel geometry, and the owner column makes it possible to aggregate conditions across a landlord's whole portfolio rather than one building at a time, which is what distinguishes this dataset from the raw 311 feed it partly derives from. It supports work on habitability, differential enforcement across neighborhoods, the relationship between building age or ownership structure and reported conditions, and the geography of rodent and sanitation complaints. Two things are documented in the schema card. The main resource is titled 'RENTSMART 2016 - PRESENT' but its earliest record is 7 September 2021, so the title overstates the coverage by five years and any claim about the 2016 to 2021 period drawn from this file is unfounded. And because the file is a union of two very different upstream sources, a 'Sanitation Request' row is a resident-reported 311 case with no finding attached, while a 'Housing Violation' row is an inspector-issued citation, so mixing the two into a single count of problems per building conflates complaint volume with enforcement outcome. Published by DoIT Data and Analytics under PDDL 1.0.

Category
Urban & Civic
Provider
City of Boston (DoIT Data & Analytics)
License
Open Data Commons Public Domain Dedication and License (PDDL) 1.0
Hosted on
bucket data.boston.gov, us-east-1
Access
Free and public. No account with the data provider is needed.
Source
https://data.boston.gov/dataset/rentsmart
Data structure and loading code

Fields

_idint
datetext
violation_typetext
descriptiontext
addresstext
neighborhoodtext
zip_codetext
parceltext
ownertext
year_builttext
year_remodeledtext
property_typetext
latitudetext
longitudetext

Load the data

import io, json, urllib.error, urllib.parse, urllib.request
import pandas as pd

CKAN = "https://data.boston.gov/api/3/action"

def ckan(action, **params):
    """Any CKAN action endpoint. Plain urllib works; no auth, no headers."""
    url = f"{CKAN}/{action}?" + urllib.parse.urlencode(params)
    with urllib.request.urlopen(url, timeout=300) as r:
        return json.load(r)["result"]

def sql(query):
    """Server-side SQL over the DataStore. Warns when the 32,000-row cap clips."""
    res = ckan("datastore_search_sql", sql=query)
    if res.get("records_truncated"):
        print("WARNING: clipped at the 32,000-row cap; aggregate or page with OFFSET")
    return pd.DataFrame(res["records"])

RENTSMART = "dc615ff7-2ff3-416a-922b-f0f334f085d0"   # 387,923 rows, from 2021-09-07

# Keep citations and complaints apart: they are different kinds of evidence.
CITATION = ("Housing Violations", "Building Violations", "Enforcement Violations")
df = sql(f'''
    SELECT "neighborhood", "violation_type", "property_type", count(*) AS n
    FROM "{RENTSMART}"
    WHERE "neighborhood" IS NOT NULL
    GROUP BY 1, 2, 3
''')
df["kind"] = df["violation_type"].isin(CITATION).map({True: "citation", False: "complaint"})
print(df.pivot_table(index="neighborhood", columns="kind", values="n", aggfunc="sum")
        .fillna(0).astype(int).sort_values("citation", ascending=False))

# Confirm the real start date rather than trusting the resource title.
print(sql(f'SELECT min("date"::timestamp) AS first, max("date"::timestamp) AS last '
          f'FROM "{RENTSMART}"').to_dict("records"))

Written for a Scigantic notebook, where /mnt/archive is the mounted dataset.

Analyze this dataset without downloading it

On Scigantic, Boston RentSmart housing conditions by address opens in a hosted JupyterLab notebook with the data already mounted, so you can read files where they are stored instead of copying them first. Each notebook includes an AI assistant that can see the mounted files and write and run analysis code. Open the dataset page to launch a notebook, or browse the full catalog.

Related Urban & Civic datasets