Troubleshooting#

Dataset Will Not Load#

OpenPoliceData (OPD) accesses data from many different websites, and occasionally, some websites will be unavailable due to temporary maintenance, data being removed, or data being reposted to a new URL. When unavailable datasets are requested, the resulting error often includes an HTTP error code such as 404 Not Found error. OPD tries to catch these errors to provide tips to the user on how to determine if the error is due to an unavailable website:

> src = opd.Source('Buffalo')
> # Attempt to load dataset that was removed by Buffalo (now also removed from OPD)
> src.load(table_type='TRAFFIC ARRESTS',year=2023)

openpolicedata.exceptions.OPD_SocrataHTTPError: ('data.buffalony.gov', '5kqt-m62h', '404 Client Error: Not Found', 'There is likely an issue with the website. Open the URL https://data.buffalony.gov/resource/5kqt-m62h.json with a web browser to confirm. See a list of known site outages at https://github.com/openpolicedata/opd-data/blob/main/outages.csv')

The error message provides a URL that can be tested in a web browser to determine if the website is down. A link to a list of known outages is also provided. If you think you’ve found an outage that is not on this list, create an issue or email us.

There may be instances where OPD does not catch an error caused by an unavailable website. In this case, it is recommended that the user try to open the dataset’s source_url and/or URL in a web browser to test it:

> src = opd.Source('Tucson')
> idx = (src.datasets['TableType']=='ARRESTS') &  (src.datasets['Year']==2017)  # Find data
> src.datasets[idx]['URL'].iloc[0]  
'https://services3.arcgis.com/9coHY2fvuFjG9HQX/arcgis/rest/services/OpenData_PublicSafety/FeatureServer/0'
> src.datasets[idx]['source_url'].iloc[0]
'https://gisdata.tucsonaz.gov/datasets/cotgis::tucson-police-arrests-2017-open-data/about'

Please report the issue (whether a website outage or a bug in OPD) by creating an issue or emailing us.

Deprecations#

When a new version is released, OpenPoliceData (OPD) tries to make changes that are backward compatible. However, occasionally, changes that are not backward compatible are necessary to add new features or make OPD easier to use.

Deprecation Warnings#

In order to minimize any disruption, OPD will first release versions that indicate what features have been deprecated prior to releasing versions that remove those features. Usage of deprecated features will result in DeprecationWarning messages that include instructions on how to update your code:

> src = opd.Source('Oakland')
> tbl_dep = src.load_from_url(2023, 'STOPS')
DeprecationWarning: load_from_url is deprecated and will be removed in a future release. Please use load instead. load uses the same inputs except table_type now comes before year.
> tbl = src.load('STOPS', 2023)
> tbl.table.equals(tbl_dep.table)
True

Current Deprecations#

The following are deprecated and will be removed in OPD Version 1.0:

  • The word ‘CIVILIAN’ has been replaced by ‘SUBJECT’ in table type names

  • Function opd.datasets_query has been replaced by opd.datasets.query

  • Class function opd.Source.load_from_url has been replaced by opd.Source.load_from_url

  • Class function opd.Source.load_from_url_gen has been replaced by opd.Source.load_iter

  • All functions of opd.Source where the year input was before the table_type input, i.e. opd.Source.get_count(year, table_type), will now have those inputs reversed, i.e. opd.Source.get_count(table_type, year)

Report Issues#

Report issues with OPD by creating an issue or emailing us.