The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
Stanford Open Policing Project Database
Traffic and pedestrian stops released by the Stanford Open Policing Project for 35 state patrols and 53 city or county departments, roughly 2000–2020. Use stops for individual stop records and locations to choose a department, time window and fields with usable coverage. Agencies report different years and outcomes; a state-patrol file is not all policing in that state.
Start querying
Preview Connecticut stop records from 2015 onward. Participating agency coverage is uneven; this is not all policing in Connecticut.
Choose R or Python. Install datapond once: use install.packages("datapond") in R, or run python -m pip install datapond in a terminal.
R
library(datapond)
con <- dp_connect("open-policing")
tryCatch({
DBI::dbExecute(con, "SET threads=1")
DBI::dbExecute(con, "SET memory_limit='128MiB'")
DBI::dbExecute(con, "SET max_temp_directory_size='0B'")
print(DBI::dbGetQuery(con, "SELECT state,date,subject_race,search_conducted FROM stops WHERE date>=DATE '2015-01-01' AND state='CT' LIMIT 5"))
}, finally = dp_disconnect(con))
Python
import datapond
con = datapond.connect('open-policing')
try:
con.execute("SET threads=1")
con.execute("SET memory_limit='128MiB'")
con.execute("SET max_temp_directory_size='0B'")
print(con.execute("""SELECT state,date,subject_race,search_conducted FROM stops WHERE date>=DATE '2015-01-01' AND state='CT' LIMIT 5""").fetchall())
finally:
con.close()
Queries run on your computer and read the byte ranges they need. A small result can still require a large scan. These examples limit DuckDB to one thread and a 128 MiB buffer pool with disk spill disabled; that is not a limit on the entire R or Python process. Larger analyses may need more memory or a local download with enough disk space.
Tables, fields and joins
See the data dictionary for column definitions.
230,002,705 rows across 2 tables. The 88 source locations use the project’s standardized stop schema.
| Table | Description | Row Count | Column Count |
|---|---|---|---|
stops |
One row per traffic or pedestrian stop; location_id, state and city identify its source |
230,002,617 | 223 |
locations |
One row per source file: state, city or statewide, release date, rows loaded, observed first/last stop dates, the data readme's stated coverage and data notes | 88 | 14 |
location_id (for example ca_statewide, il_chicago) joins stops to locations. The v_stops_by_year view gives one row per location and year, with stops, searches, contraband hits, arrests, citations and warnings.
Common fields and missing values
The common fields describe date, time, place, subject race/sex/age, outcome, search, contraband and vehicle. date is a DATE, time is a TIME, and the twelve yes/no fields (including search_conducted, contraband_found and arrest_made) are BOOLEAN. subject_age, vehicle_year and officer_age are INTEGER; lat, lng and speeds are DOUBLE; other fields are text.
The project’s NA is stored as NULL, not false or zero. Columns named raw_* preserve location-specific source fields as lower-case text; they are NULL for other locations. The project’s per-location readme explains these extra fields.
Researcher caveats
- Coverage differs by location and field. Not every agency records searches,
contraband, race or outcomes, and date ranges vary from a single year to two decades.
locations.readme_coverageand the per-location null rates inDICTIONARY.mdsay what exists;v_stops_by_yearshows when. Do not compare rates across locations without checking that the field is populated in both. - Two releases. 2023-01-26 files replaced the 2020-04-01 files for the locations the
project updated (
locations.release_date); the others are the 2020 release. - Privacy sanitisation by the project. Most free-text fields have digits replaced by
-;officer_id_hashis consistent only within a location; some fields were removed before public release (see the readme's asterisked columns). - Statewide files are state patrols, not all policing in the state; city files are single departments.
Other ways to connect: direct DuckDB SQL
This direct example does not set resource limits; the first R/Python examples above do.
This alternative uses a DuckDB SQL client and the policing catalog alias. The query compares search percentages by state and recorded race for stops from 2015 onward.
The search percentage uses stops with a recorded search flag as its denominator, not all stops. A missing flag is excluded rather than treated as “not searched.” Check location and field coverage before interpreting differences between groups.
INSTALL httpfs; LOAD httpfs;
ATTACH 'https://huggingface.co/datasets/Nason/open-policing-database/resolve/main/open-policing.duckdb' AS policing (READ_ONLY);
SELECT state, subject_race, COUNT(*) AS stops,
ROUND(100.0 * COUNT(*) FILTER (WHERE search_conducted) / NULLIF(COUNT(*) FILTER (WHERE search_conducted IS NOT NULL), 0), 2) AS pct_searched
FROM policing.stops WHERE date >= '2015-01-01' AND subject_race IN ('white', 'black', 'hispanic')
GROUP BY 1, 2 ORDER BY 1, 2;
Sources and maintenance
Sources, license and build
Source: Stanford Open Policing Project. License: ODC-By 1.0.
Build pipeline, the project’s data readme and caveats: https://github.com/ian-nason/open-policing-database Source: Stanford Open Policing Project, https://openpolicing.stanford.edu (ODC-By 1.0; cite Pierson et al. 2020).
R with DBI and duckdb
Install the dependencies once with install.packages(c("DBI", "duckdb")).
library(DBI)
con <- dbConnect(duckdb::duckdb())
dbExecute(con, "INSTALL httpfs")
dbExecute(con, "LOAD httpfs")
dbExecute(con, "ATTACH 'https://huggingface.co/datasets/Nason/open-policing-database/resolve/main/open-policing.duckdb' AS policing (READ_ONLY)")
dbGetQuery(con, "SELECT state, subject_race FROM policing.stops LIMIT 5")
dbDisconnect(con, shutdown = TRUE)
DuckDB uses HTTP range requests; queries run on your machine and may need substantial memory or download data. A LIMIT does not guarantee a small scan.
Or with the datapond packages: pip install datapond / pak::pak("datapond-db/datapond-r").
Build pipeline, the project's data readme and caveats: https://github.com/ian-nason/open-policing-database Source: Stanford Open Policing Project, https://openpolicing.stanford.edu (ODC-By 1.0; cite Pierson et al. 2020).
- Downloads last month
- 244