Skip to content

TalariaSoftware/somebadapples

Repository files navigation

RSpec

Rubocop HAML-Lint

Brakeman Bundler audit CodeQL analysis License finder

Maintainability Test Coverage

README

Some Bad Apples attempts to provide a searchable interface to identify some of the bad apples in policing agencies.

Data sources

POST Roster

The list of officers and their positions was acquired by Police Files via a public records request to the California Commission on Peace Officer Standards and Traning

The raw data is located at public/data/us/ca/post-roster-2022.csv.

Import it to your environment with the command ./bin/rails runner "::Us::Ca::PostRoster2022::Entry.import". On a development environment, creating all 400,000+ entries takes about 30 seconds.

Development

Setup

  1. Install Ruby (version in .ruby-version)
  2. Install PosgreSQL
  3. Install bundler: gem install bundler
  4. Install gems: bundle
  5. Setup database: rake db:setup
  6. Install and start ElasticSearch Via Homebrew:
    brew install elastic/tap/elasticsearch-full
    brew services start elasticsearch-full

Tests

Run all automated tests: rake

Individual tests

Code Coverage is provided by SimpleCov. After running rspec you can view the code coverage report in your default browser with open coverage/index.html

Import POST data

The POST data is a collection of over 400,000 officer positions. The CSV file is in app/public/data. After changing the way the data is imported you may want to reimport it.

Development

rake db:reset import_post_roster create_post_agencies create_post_officers create_post_records

Production

heroku maintenance:on
heroku pg:reset
heroku run -s standard-2x rake db:schema:load import_post_roster create_post_agencies create_post_officers create_post_records
heroku maintenance:off

Reindex for search

After loading new data the search database has to be re-indexed.

bin/rails runner "[Agency, Document, Incident, Officer].each(&:reindex)"