Skip to content

Instantly share code, notes, and snippets.

Last active January 5, 2018 16:35
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
VICE News Police Shootings data with Datasette

Running in Datasette at

Here's what I did:

First, I exported as CSV the data from

Then I converted it to a SQLite database using like so:

csvs-to-sqlite ~/Downloads/ViceNews_FullOISData.csv /tmp/vice.db \
    -c Fatal -c SubjectArmed -c SubjectRace -c SubjectGender -c OfficerRace \
    -c OfficerGender -c Department -c city -c NatureOfStop \
    -f city -f Department -f Notes -f FullNarrative -f NatureOfStop

Each -c option means "extract this column into a new foreign key table", e.g.

Each -f option means "make the contents of this column searchable using SQLite full text search", e.g.

Then I published /tmp/vice.db using like this:

datasette publish now /tmp/vice.db \
    --title="VICE News Police Shootings" \
    --source="VICE News" \
    --source_url="" \
    --license="CC BY-NC-SA 4.0" \
    --license_url="" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment