311 calls reported to the city of Boston.
Refer to this link to learn more about BOS:311.
Volume and Retention
This dataset is stored in Parquet format. It is updated daily, and contains about 100K rows (10MB) in total as of 2019.
This dataset contains historical records accumulated from 2011 to the present. You can use parameter settings in our SDK to fetch data within a specific time range.
Storage Location
This dataset is stored in the East US Azure region. Allocating compute resources in East US is recommended for affinity.
Additional Information
This dataset is sourced from city of Boston government. More details can be found from here. Reference Open Data Commons Public Domain Dedication and License (ODC PDDL) for the license of using this dataset.
Notices
MICROSOFT PROVIDES AZURE OPEN DATASETS ON AN “AS IS” BASIS. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, GUARANTEES OR CONDITIONS WITH RESPECT TO YOUR USE OF THE DATASETS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAW, MICROSOFT DISCLAIMS ALL LIABILITY FOR ANY DAMAGES OR LOSSES, INCLUDING DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, INCIDENTAL OR PUNITIVE, RESULTING FROM YOUR USE OF THE DATASETS.
This dataset is provided under the original terms that Microsoft received source data. The dataset may include data sourced from Microsoft.
Access
Available in | When to use |
---|---|
Azure Notebooks | Quickly explore the dataset with Jupyter notebooks hosted on Azure or your local machine. |
Azure Databricks | Use this when you need the scale of an Azure managed Spark cluster to process the dataset. |
Azure Synapse | Use this when you need the scale of an Azure managed Spark cluster to process the dataset. |
Preview
dataType | dataSubtype | dateTime | category | subcategory | status | address | latitude | longitude | source | extendedProperties |
---|---|---|---|---|---|---|---|---|---|---|
Safety | 311_All | 2/21/2021 12:03:17 AM | Code Enforcement | Unshoveled Sidewalk | Open | 10 Dawes St Dorchester MA 02125 | 42.3189 | -71.0602 | Citizens Connect App | |
Safety | 311_All | 2/21/2021 12:01:52 AM | Enforcement & Abandoned Vehicles | Parking Enforcement | Open | 195 E Cottage St Dorchester MA 02125 | 42.3197 | -71.0608 | Citizens Connect App | |
Safety | 311_All | 2/21/2021 12:01:00 AM | Notification | Notification | Open | 280 Friend St Boston MA 02114 | 42.3649 | -71.0619 | Constituent Call | |
Safety | 311_All | 2/21/2021 12:00:58 AM | Code Enforcement | Unshoveled Sidewalk | Open | 187 E Cottage St Dorchester MA 02125 | 42.3199 | -71.0612 | Citizens Connect App | |
Safety | 311_All | 2/21/2021 12:00:04 AM | Code Enforcement | Unshoveled Sidewalk | Open | 201 E Cottage St Dorchester MA 02125 | 42.3195 | -71.0606 | Citizens Connect App | |
Safety | 311_All | 2/20/2021 11:51:00 PM | Signs & Signals | Traffic Signal Inspection | Open | INTERSECTION of Massachusetts Ave & Beacon St Boston MA | 42.3594 | -71.0587 | Constituent Call | |
Safety | 311_All | 2/20/2021 11:41:11 PM | Street Cleaning | Requests for Street Cleaning | Open | 81 Belnel Rd Mattapan MA 02126 | 42.2605 | -71.1041 | Citizens Connect App | |
Safety | 311_All | 2/20/2021 11:40:54 PM | Street Cleaning | Requests for Street Cleaning | Open | 81 Belnel Rd Mattapan MA 02126 | 42.2605 | -71.1041 | Citizens Connect App | |
Safety | 311_All | 2/20/2021 11:11:40 PM | Street Cleaning | Pick up Dead Animal | Open | 8 Beacon St Boston MA 02108 | 42.3582 | -71.0616 | Citizens Connect App | |
Safety | 311_All | 2/20/2021 11:05:00 PM | Highway Maintenance | Request for Pothole Repair | Open | 55 Church St West Roxbury MA 02132 | 42.2898 | -71.1463 | Citizens Connect App |
Name | Data type | Unique | Values (sample) | Description |
---|---|---|---|---|
address | string | 142,046 | \" \" 1 City Hall Plz Boston MA 02108 |
Location. |
category | string | 54 | Street Cleaning Sanitation |
Reason of the service request. |
dataSubtype | string | 1 | 311_All | “311_All” |
dataType | string | 1 | Safety | “Safety” |
dateTime | timestamp | 1,723,318 | 2015-07-23 10:51:00 2015-07-23 10:47:00 |
Open date and time of the service request. |
latitude | double | 1,622 | 42.3594 42.3603 |
This is the latitude value. Lines of latitude are parallel to the equator. |
longitude | double | 1,806 | -71.0587 -71.0583 |
This is the longitude value. Lines of longitude run perpendicular to lines of latitude, and all pass through both poles. |
source | string | 7 | Constituent Call Citizens Connect App |
Original source of the case. |
status | string | 2 | Closed Open |
Case status. |
subcategory | string | 208 | Parking Enforcement Requests for Street Cleaning |
Type of the service request. |
Azure Notebooks
# This is a package in preview.
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_pandas_dataframe()
safety.info()
# Pip install packages
import os, sys
!{sys.executable} -m pip install azure-storage-blob
!{sys.executable} -m pip install pyarrow
!{sys.executable} -m pip install pandas
# Azure storage access info
azure_storage_account_name = "azureopendatastorage"
azure_storage_sas_token = r""
container_name = "citydatacontainer"
folder_name = "Safety/Release/city=Boston"
from azure.storage.blob import BlockBlobServicefrom azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
if azure_storage_account_name is None or azure_storage_sas_token is None:
raise Exception(
"Provide your specific name and key for your Azure Storage account--see the Prerequisites section earlier.")
print('Looking for the first parquet under the folder ' +
folder_name + ' in container "' + container_name + '"...')
container_url = f"https://{azure_storage_account_name}.blob.core.windows.net/"
blob_service_client = BlobServiceClient(
container_url, azure_storage_sas_token if azure_storage_sas_token else None)
container_client = blob_service_client.get_container_client(container_name)
blobs = container_client.list_blobs(folder_name)
sorted_blobs = sorted(list(blobs), key=lambda e: e.name, reverse=True)
targetBlobName = ''
for blob in sorted_blobs:
if blob.name.startswith(folder_name) and blob.name.endswith('.parquet'):
targetBlobName = blob.name
break
print('Target blob to download: ' + targetBlobName)
_, filename = os.path.split(targetBlobName)
blob_client = container_client.get_blob_client(targetBlobName)
with open(filename, 'wb') as local_file:
blob_client.download_blob().download_to_stream(local_file)
# Read the parquet file into Pandas data frame
import pandas as pd
print('Reading the parquet file into Pandas data frame')
df = pd.read_parquet(filename)
# you can add your filter at below
print('Loaded as a Pandas data frame: ')
df
Azure Databricks
# This is a package in preview.
# You need to pip install azureml-opendatasets in Databricks cluster. https://docs.microsoft.com/en-us/azure/data-explorer/connect-from-databricks#install-the-python-library-on-your-azure-databricks-cluster
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_spark_dataframe()
display(safety)
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "citydatacontainer"
blob_relative_path = "Safety/Release/city=Boston"
blob_sas_token = r""
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
blob_sas_token)
print('Remote blob path: ' + wasbs_path)
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))
Azure Synapse
from azureml.opendatasets import BostonSafety
from datetime import datetime
from dateutil import parser
end_date = parser.parse('2016-01-01')
start_date = parser.parse('2015-05-01')
safety = BostonSafety(start_date=start_date, end_date=end_date)
safety = safety.to_spark_dataframe()
display(safety)
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "citydatacontainer"
blob_relative_path = "Safety/Release/city=Boston"
blob_sas_token = r""
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
blob_sas_token)
print('Remote blob path: ' + wasbs_path)
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))

City Safety
From the Urban Innovation Initiative at Microsoft Research, databricks notebook for analytics with safety data (311 and 911 call data) from major U.S. cities. Analyses show frequency distributions and geographic clustering of safety issues within cities.