# Boston RentSmart housing conditions by address

## Facts

- Provider: City of Boston (DoIT Data & Analytics)
- License: Open Data Commons Public Domain Dedication and License (PDDL) 1.0
- Size: 4 files
- Records: 491,953 rows
- Format: CSV (in sampled files)
- Stored at: data.boston.gov
- Access: public, readable without an account
- Category: Urban & Civic
- Source: https://data.boston.gov/dataset/rentsmart
- Page: https://scigantic.com/archive/2f0c0e42-b633-5514-84a6-f0abbd660d9d
- Keywords: Urban & Civic, CSV

## About

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.

## Load the data

```python
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"))
```

## Data structure

File types in sampled files: CSV

| Field | Type |
| --- | --- |
| `_id` | int |
| `date` | text |
| `violation_type` | text |
| `description` | text |
| `address` | text |
| `neighborhood` | text |
| `zip_code` | text |
| `parcel` | text |
| `owner` | text |
| `year_built` | text |
| `year_remodeled` | text |
| `property_type` | text |
| `latitude` | text |
| `longitude` | text |

Files:

```text
One row is one recorded issue at one address. 491,953 rows across four DataStore resources; the main file holds 387,923 and a second holds 103,231. RentSmart is a JOIN of two upstream sources, BOS:311 requests and Inspectional Services enforcement records, published so a prospective tenant can look up a specific address.
COLUMNS (14): date, violation_type, description, address, neighborhood, zip_code, parcel, owner, year_built, year_remodeled, property_type, latitude, longitude.
violation_type IS THE SOURCE DISCRIMINATOR and takes six values: Housing Violations, Building Violations, Enforcement Violations, Housing Complaints, Sanitation Requests, Civic Maintenance Requests. The first three are inspector-issued citations with a finding behind them. The last three are resident-reported 311 cases with no finding attached. Mixing them into one "problems per building" count conflates complaint volume with enforcement outcome, and neighborhoods differ systematically in how much they call 311.
description carries the specific issue ("Rodent Activity", "Illegal Occupancy", "No Heat", "Unsanitary Conditions") and is the column that actually says what happened.
THE TWO JOINS THAT MAKE THIS MORE THAN A 311 FILTER: parcel is the assessing parcel identifier, joining to the Property Assessment rolls (GIS_ID / PID), building permits (parcel_id) and the 2025 parcel geometry (MAP_PAR_ID). owner is carried on every row, so conditions can be aggregated across a landlord's whole portfolio rather than one building at a time, which is the analysis the raw 311 feed cannot support.
RESOURCES:
  RentSmart (data.boston.gov/dataset/rentsmart): 4 DataStore resources of 13 total
    dc615ff7-2ff3-416a-922b-f0f334f085d0     387923 rows  RENTSMART 2016 - PRESENT
    f6b5aee9-8607-4ba8-ac6b-17b3ffb43084     103231 rows  1900-to-1919.csv
    d401d262-6556-40d9-a31b-45f79144f638        762 rows  1800-to-1849.csv
    ecb8e8a6-b5cf-41ea-8cbe-73fd53e03219         37 rows  1700-to-1799.csv
```

Example file: `Issue mix by neighborhood, split by whether it is a citation or a complaint:
  SELECT "neighborhood", "violation_type", count(*) n
  FROM "dc615ff7-2ff3-416a-922b-f0f334f085d0"
  GROUP BY 1, 2 ORDER BY n DESC LIMIT 30`

## Open it

- In a hosted notebook with the data mounted: https://scigantic.com/archive/2f0c0e42-b633-5514-84a6-f0abbd660d9d
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/2f0c0e42-b633-5514-84a6-f0abbd660d9d
- Over MCP: `get_schema_card` with id `2f0c0e42-b633-5514-84a6-f0abbd660d9d` at https://api.scigantic.com/mcp

## Related topics

- [CSV datasets](https://scigantic.com/topics/csv)
- [Urban & Civic datasets](https://scigantic.com/topics/urban-and-civic)
