Some Bad Apples attempts to provide a searchable interface to identify some of the bad apples in policing agencies.
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.
- Install Ruby (version in
.ruby-version
) - Install PosgreSQL
- Install bundler:
gem install bundler
- Install gems:
bundle
- Setup database:
rake db:setup
- Install and start ElasticSearch
Via Homebrew:
brew install elastic/tap/elasticsearch-full brew services start elasticsearch-full
Run all automated tests: rake
Individual tests
- Rubocop (ruby linting):
rubocop
- HAML Lint:
haml-lint
- RSpec (executable specifications):
rspec
- Rails Best Practices (Rails-specific linting):
rail_best_practices
- License Finder (library license checking):
license_finder
- Brakeman (security testing via static analysis):
brakeman
- bundler-audit (Find vulnerable ruby libraries)
bundler-audit
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
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.
rake db:reset import_post_roster create_post_agencies create_post_officers create_post_records
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
After loading new data the search database has to be re-indexed.
bin/rails runner "[Agency, Document, Incident, Officer].each(&:reindex)"