# Boston 311 Service Requests, 2011 to present

## Facts

- Provider: City of Boston (Boston 311)
- License: Open Data Commons Public Domain Dedication and License (PDDL) 1.0
- Size: 17 files
- Records: 3,398,808 rows
- Stored at: data.boston.gov
- Access: public, readable without an account
- Category: Urban & Civic
- Source: https://data.boston.gov/dataset/311-service-requests
- Page: https://scigantic.com/archive/a4eb6ef7-ce3a-515c-9db9-2863a7a439b9
- Keywords: Urban & Civic

## About

Every constituent service request handled by BOS:311, the City of Boston's non-emergency request channel, from 2011 to the present: 3,398,808 rows across 17 DataStore-loaded CSV resources on data.boston.gov. One row is one case. Each case carries the request type and subject, the responsible department and queue, open and close timestamps, an SLA target and an on-time or overdue flag, the closure reason as free text, the reporting channel (phone, the Citizens Connect app, web, Twitter), a street address with latitude and longitude, and a full set of administrative geographies: neighborhood, ward, precinct, city council district, police district, fire district and public works district. Photos submitted by residents and taken at closure are linked as Cloudinary URLs. The volume is remarkably stable at roughly 250,000 to 280,000 cases per year since 2016, which makes the series usable for year-over-year comparison of service delivery, response time by request type and neighborhood, and equity analysis of who gets served how fast. The structural fact that governs every query is a backend migration: starting October 2025, 311 began moving to a new case management system, and cases from the new system land in a separate resource with an entirely different column vocabulary (case_id, open_date, case_topic, service_name, assigned_department) from the legacy one (case_enquiry_id, open_dt, type, reason, subject, queue). The two overlap in time rather than succeeding one another, so the 2025 legacy file and the NEW SYSTEM file both contain August through December 2025 and concatenating them double counts. The city expects the transition to complete in mid-2026. The schema card carries the full column mapping between the two schemas, the per-year row counts, and the coordinate and administrative-code quirks (all columns are text, ward is formatted 'Ward 1' in the legacy schema and '06' in the new one, and geom_4326 is PostGIS WKB hex rather than a coordinate pair). Published by Boston 311 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"])

R_2024 = "dff4d804-5031-443a-8409-8344efd0e5c8"   # 311 Service Requests - 2024, 282,836 rows

# GROUP BY server-side: the whole year in one small response, no 32k truncation.
# Two rewrites this portal forces, both because the natural form returns 403:
#   extract(epoch FROM a - b)   ->  date_part('epoch', a - b)
#   avg(x) FILTER (WHERE cond)  ->  avg(CASE WHEN cond THEN x END)
by_type = sql(f'''
    SELECT "reason", "type", count(*) AS cases,
           avg(CASE WHEN "on_time" = \'ONTIME\' THEN 1.0 ELSE 0.0 END) AS on_time_rate,
           avg(CASE WHEN "closed_dt" IS NOT NULL AND "closed_dt" <> \'\'
                    THEN date_part(\'epoch\', "closed_dt"::timestamp - "open_dt"::timestamp)
                         / 86400.0 END) AS mean_days_to_close
    FROM "{R_2024}"
    GROUP BY 1, 2
    ORDER BY cases DESC
    LIMIT 25
''')
print(by_type.to_string(index=False))
```

## Data structure

| Field | Type |
| --- | --- |
| `_id` | int |
| `case_enquiry_id` | text |
| `open_dt` | text |
| `sla_target_dt` | text |
| `closed_dt` | text |
| `on_time` | text |
| `case_status` | text |
| `closure_reason` | text |
| `case_title` | text |
| `subject` | text |
| `reason` | text |
| `type` | text |
| `queue` | text |
| `department` | text |
| `submitted_photo` | text |
| `closed_photo` | text |
| `location` | text |
| `fire_district` | text |
| `pwd_district` | text |
| `city_council_district` | text |

and 11 more fields

Files:

```text
One row is one 311 case. 3,398,808 rows across 17 DataStore resources, one per year from 2011 to 2026 plus a separate NEW SYSTEM resource.
THE ONE THING THAT MATTERS: there are TWO INCOMPATIBLE SCHEMAS and they OVERLAP IN TIME. Boston began migrating 311 to a new case management backend in October 2025. Cases from the new system land in their own resource with a different column vocabulary. The legacy 2025 resource covers 2025-01-01 to 2025-12-31 (267,187 rows) and the NEW SYSTEM resource covers 2025-08-01 to 2026-08-14 (38,469 rows), so August through December 2025 exists in BOTH. Concatenating every resource in the package double counts that window. The city expects the transition to finish in mid-2026.
COLUMN MAPPING between the two, for the fields you actually need:
  legacy                    new system
  case_enquiry_id           case_id            (numeric string vs "BCS-00232230")
  open_dt                   open_date
  closed_dt                 close_date
  sla_target_dt             target_close_date
  case_title / type         service_name
  reason / subject          case_topic
  department / queue        assigned_department / assigned_team
  source                    report_source
  location                  full_address (+ street_number, street_name)
  location_zipcode          zip_code
  pwd_district              public_works_district
  (no equivalent)           closure_comments
  geom_4326                 (dropped)
  neighborhood_services_district (dropped)
Shared, and identical in both: on_time, case_status, closure_reason, neighborhood, ward, precinct, city_council_district, police_district, fire_district, latitude, longitude, submitted_photo, closed_photo.
PER-YEAR ROW COUNTS (legacy): 2011 58,262 | 2012 118,092 | 2013 142,610 | 2014 147,820 | 2015 210,083 | 2016 216,535 | 2017 251,269 | 2018 262,748 | 2019 259,022 | 2020 251,222 | 2021 273,784 | 2022 276,599 | 2023 266,438 | 2024 282,836 | 2025 267,187 | 2026 75,832 (partial). NEW SYSTEM: 38,469.
RESOURCES:
  311 Service Requests (data.boston.gov/dataset/311-service-requests): 17 DataStore resources of 21 total
    254adca6-64ab-4c5c-9fc0-a6da622be185      38469 rows  311 Service Requests - NEW SYSTEM
    1a0b420d-99f1-4887-9851-990b2a5a6e17      75832 rows  311 Service Requests - 2026
    9d7c2214-4709-478a-a2e8-fb2020a5bb94     267187 rows  311 Service Requests - 2025
    dff4d804-5031-443a-8409-8344efd0e5c8     282836 rows  311 Service Requests - 2024
    e6013a93-1321-4f2a-bf91-8d8a02f1e62f     266438 rows  311 Service Requests - 2023
    81a7b022-f8fc-4da5-80e4-b160058ca207     276599 rows  311 SERVICE REQUESTS - 2022
    f53ebccd-bc61-49f9-83db-625f209c95f5     273784 rows  311 SERVICE REQUESTS - 2021
    6ff6a6fd-3141-4440-a880-6f60a37fe789     251222 rows  311 SERVICE REQUESTS - 2020
...
```

Example file: `Median days-to-close by request type in 2024, computed server-side so nothing is truncated. Note date_part('epoch', a - b) rather than extract(epoch FROM a - b): the extract form is rejected with a 403 by this portal.
  SELECT "type", count(*) n,
         percentile_cont(0.5) WITHIN GROUP (ORDER BY
`

## Open it

- In a hosted notebook with the data mounted: https://scigantic.com/archive/a4eb6ef7-ce3a-515c-9db9-2863a7a439b9
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/a4eb6ef7-ce3a-515c-9db9-2863a7a439b9
- Over MCP: `get_schema_card` with id `a4eb6ef7-ce3a-515c-9db9-2863a7a439b9` at https://api.scigantic.com/mcp

## Related topics

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