Skip to content

yo-mike/846-backend

Repository files navigation

8:46 police brutality πŸ•£ 🚨

8 minutes and 46 seconds is the length of time associated with the killing of George Floyd, who died in police custody after police officer Derek Chauvin knelt on his neck for roughly eight minutes.

This repo provides and API and archives acts of assault by public servants to American Citizens during non-violent acts of protest.


API

Incidents Endpoint

List all catalog Incidents of Police Assault

GET https://api.846policebrutality.com/api/incidents

Show a Single Incident

GET https://api.846policebrutality.com/api/incidents/{id}

Including Video Evidence on the Incidents Endpoint

List all Incidents and include Evidence (such as Video)

GET https://api.846policebrutality.com/api/incidents?include=evidence

You can also include the Evidence model:

GET https://api.846policebrutality.com/api/incidents/{id}?include=evidence

Filtering Incidents

By State and/or Date

GET https://api.846policebrutality.com/api/incidents?filter[date]=2020-06-01&filter[state]=New+York

By Tag or Tags (plural, separated by a comma)

GET https://api.846policebrutality.com/api/incidents?filter[tags]=journalist

GET https://api.846policebrutality.com/api/incidents?filter[tags]=journalist,lrad

Final Note on Filters

You can filter the legislators by any attribute generated by the response.

Sorting Data

By default, results are sorted by date, ascending.

You can pass any field to the sort parameter. Multiple fields should be separated by a comma.

To change the sort direction, simply make the sort-field positive (ascending) or negative (descending)

GET https://api.846policebrutality.com/api/incidents?sort={field1},{field2},{...},{fieldn}

Sort by Date (Newest), then by State (Alpha)

GET https://api.846policebrutality.com/api/incidents?sort=-date,state

Paging and Limiting Response Size

Returning only 100 results

GET https://api.846policebrutality.com/api/incidents?page[limit]=100

Returning the 100 results after the first 50 (results 51-150)

GET https://api.846policebrutality.com/api/incidents?page[limit]=100&page[offset]=50

Legislators Endpoint

List all US Legislators in the House and Senate

Includes:

  • phone numbers
  • fax number
  • websites
  • website contact forms
  • twitter accounts
  • facebook accounts
  • youtube accounts
  • voting records
  • ... and more.

GET https://api.846policebrutality.com/api/legislators

Filtering Legislators by House and Senate

GET https://api.846policebrutality.com/api/legislators?filter[chamber]=house

GET https://api.846policebrutality.com/api/legislators?filter[chamber]=senate

Filtering Legislators by State Abbrev

GET https://api.846policebrutality.com/api/legislators?filter[state]=CA

GET https://api.846policebrutality.com/api/legislators?filter[state]=NY

Combining Multiple Filters

GET https://api.846policebrutality.com/api/legislators?filter[state]=CA&filter[chamber]=house

Final Note on Filters

You can filter the legislators by any attribute generated by the response.


Data Visualization and Front-end Websites

Map

https://846policebrutality.com/ - Uses this API, currently slightly lagged as the parent data-feed doesn't include static ids

https://policebrutality.me/ - Uses this API, shows incidents and videos/photos on map

Filter by State

https://2020policebrutality.netlify.app/ - Uses parent repo's data feed, real time.


Reference Repos

This repo aggregates data from a variety of source, most notably:

2020PB/police-brutality - The JSON data feed made available

mnlmaier/846-frontend - A front-end app to visual this data


About This Project

This project was inspired by 2020PB/police-brutality. Therefore:

This repository exists to accumulate and contextualize evidence of police brutality during the 2020 George Floyd protests.

Our goal in doing this is to assist journalists, politicians, prosecutors, activists and concerned citizens who can use the evidence accumulated here for political campaigns, news reporting, public education and prosecution of criminal police officers.

If you wish to contribute, please start by reading the contribution guidelines.


More about *this* repo

  • This project does not condone acts aggression of any parties
  • This project is meant to enable others to share their voice and stand-up against acts of violence by public service
  • This project intends to fight censorship by encouraging all to get involved and mirror this data, download the media, and fight for progress
  • This project is not anti-police
  • This project is a public work dedicated to all of humanity, regardless of race, creed, or borders.

Roadmap

Incidents Endpoint

  • HTTP GET /api/incidents - list all incidents
  • HTTP GET /api/incidents?include=evidence - Include video evidence
  • HTTP GET /api/incidents?xx - Filter by city, state, date range
  • Any requested end-points?

Video

  • Artisan command to pull videos from Incident websites

Geolocation

  • Artisan command to update lat/long for all Incidents
  • Automatically find lat/long on data import

Data Aggregation

  • Continuous Integration of data via MD files from 2020PB/police-brutality

Data Management

  • Is there value in a CRM?

Developer Notes

So you want to contribute or build this locally?

Installation

git clone https://github.com/949mac/846-backend

cd 846-backend

# Create a MySQL database, and then

cp .env.example .env

# Update the MySQL settings in .env

composer install

# This application uses Laravel Nova. 
# It will ask you for Nova credentials.
# Before running `composer install`, 
# you can remove references to `laravel/nova` 
# from the composer.json file

php artisan migrate

php artisan key:generate

php artisan nova:user # Create a user account

MySQL DB Seed

# Add some Roles into MySQL

INSERT INTO `roles` (`id`, `slug`, `name`, `created_at`, `updated_at`)
VALUES
   (1, 'link-submission-manager', 'Link Submission Manager', '2020-06-09 22:32:43', '2020-06-09 22:32:43'),
   (2, 'admin', 'Admin', '2020-06-09 22:51:53', '2020-06-09 22:51:53');

INSERT INTO `role_permission` (`role_id`, `permission_slug`, `created_at`, `updated_at`)
VALUES
   (1, 'upload link submissions', '2020-06-09 22:42:06', '2020-06-09 22:42:06'),
   (1, 'view link submissions', '2020-06-09 22:42:06', '2020-06-09 22:42:06'),
   (2, 'create roles', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'create users', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'delete link submissions', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'delete roles', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'delete users', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'edit link submissions', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'edit roles', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'edit users', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'upload link submissions', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'view link submissions', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'view roles', '2020-06-09 22:52:05', '2020-06-09 22:52:05'),
   (2, 'view users', '2020-06-09 22:52:05', '2020-06-09 22:52:05');

INSERT INTO `role_user` (`role_id`, `user_id`, `created_at`, `updated_at`)
VALUES
   (1, 'YOUR_USER_ID_FROM_USERS_TABLE', NULL, NULL),
   (2, 'YOUR_USER_ID_FROM_USERS_TABLE', NULL, NULL);

Now run php artisan serve

Finally, why not add some sample incidents for review?

INSERT INTO `link_submissions` (`id`, `submission_datetime_utc`, `submission_title`, `submission_media_url`, `submission_url`, `data`, `video_status`, `user_id`, `link_status`, `link_status_ref`, `is_api_submission`, `dont_touch`, `created_at`, `updated_at`, `deleted_at`)
VALUES
   ('0002c180-b80a-11ea-870f-15e88dc1a0d5', '2020-06-03 02:58:17', 'LAPD is doing drive-bys now #protest #PoliceBrutality https://t.co/bMDqbJQzEH', 'https://video.twimg.com/ext_tw_video/1268014080964558848/pu/vid/640x640/bQKN2RaQa2U0bQca.mp4?tag=10', 'https://twitter.com/balleralert/status/1268014113105555456/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1268014113105555456,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-03 02:58:17\",\"submission_title\":\"LAPD is doing drive-bys now #protest #PoliceBrutality https:\\/\\/t.co\\/bMDqbJQzEH\",\"submission_body\":\"User Location: Ballerville\",\"id_submitter\":14204133,\"submission_url\":\"https:\\/\\/twitter.com\\/balleralert\\/status\\/1268014113105555456\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/ext_tw_video\\/1268014080964558848\\/pu\\/vid\\/640x640\\/bQKN2RaQa2U0bQca.mp4?tag=10\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'Duplicate', 'Duplicate Link Submission', 1, 0, '2020-06-27 00:06:07', '2020-06-27 00:06:07', NULL),
   ('0004a800-b3d5-11ea-b114-abb105e2a4f1', '2020-06-21 15:02:45', 'y’all please send this girl help #BlackLivesMatter https://t.co/PInRMb8Wr0', 'https://video.twimg.com/ext_tw_video/1274719390391558146/pu/vid/360x640/y6Nhoas4-_uY0JqS.mp4?tag=10', 'https://twitter.com/gyhh70296488/status/1274719412248104961/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1274719412248104961,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-21 15:02:45\",\"submission_title\":\"y\\u2019all please send this girl help #BlackLivesMatter https:\\/\\/t.co\\/PInRMb8Wr0\",\"submission_body\":null,\"id_submitter\":1258777845788262401,\"submission_url\":\"https:\\/\\/twitter.com\\/gyhh70296488\\/status\\/1274719412248104961\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/ext_tw_video\\/1274719390391558146\\/pu\\/vid\\/360x640\\/y6Nhoas4-_uY0JqS.mp4?tag=10\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'First Seen', '', 1, 0, '2020-06-21 15:36:39', '2020-06-21 18:07:47', NULL),
   ('00090900-b680-11ea-a0f0-17b5dc78a65e', '2020-06-24 00:28:22', 'YALL LOOK. WHAT THE FUCK \n#BlackLivesMatter #PoliceBrutality https://t.co/JafTMPLgEH', 'https://video.twimg.com/ext_tw_video/1275586412570697728/pu/vid/320x568/OlxjqypaeR_vl4T6.mp4?tag=10', 'https://twitter.com/livinwithdevils/status/1275586527989338112/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1275586527989338112,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-24 00:28:22\",\"submission_title\":\"YALL LOOK. WHAT THE FUCK \\n#BlackLivesMatter #PoliceBrutality https:\\/\\/t.co\\/JafTMPLgEH\",\"submission_body\":null,\"id_submitter\":2783000198,\"submission_url\":\"https:\\/\\/twitter.com\\/livinwithdevils\\/status\\/1275586527989338112\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/ext_tw_video\\/1275586412570697728\\/pu\\/vid\\/320x568\\/OlxjqypaeR_vl4T6.mp4?tag=10\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'Duplicate', 'Duplicate Link Submission', 1, 0, '2020-06-25 01:05:46', '2020-06-25 01:05:46', NULL),
   ('000afc30-b6e5-11ea-828f-113ce88e4fa3', '2020-06-24 13:08:48', '#GoodMorning #RebuildTrust #CommunityPolicing πŸ–€ over #PoliceBrutality πŸ‘πŸΎπŸ‘πŸΎπŸ‘πŸΎπŸ‘πŸΎ https://t.co/uFdmiW8Tmg', 'https://video.twimg.com/ext_tw_video/1275777873027227652/pu/vid/480x480/GYua3SyJiLpnSRXH.mp4?tag=10', 'https://twitter.com/Mosesjp/status/1275777899514208259/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1275777899514208259,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-24 13:08:48\",\"submission_title\":\"#GoodMorning #RebuildTrust #CommunityPolicing \\ud83d\\udda4 over #PoliceBrutality \\ud83d\\udc4d\\ud83c\\udffe\\ud83d\\udc4f\\ud83c\\udffe\\ud83d\\udc4f\\ud83c\\udffe\\ud83d\\udc4f\\ud83c\\udffe https:\\/\\/t.co\\/uFdmiW8Tmg\",\"submission_body\":\"User Location: ATL Boston LA & International\",\"id_submitter\":38844197,\"submission_url\":\"https:\\/\\/twitter.com\\/Mosesjp\\/status\\/1275777899514208259\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/ext_tw_video\\/1275777873027227652\\/pu\\/vid\\/480x480\\/GYua3SyJiLpnSRXH.mp4?tag=10\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'Duplicate', 'Duplicate Link Submission', 1, 0, '2020-06-25 13:08:45', '2020-06-25 13:08:45', NULL),
   ('000cef00-b4ac-11ea-985f-1996a7627843', '2020-06-22 08:13:00', 'Damn...if this is true...its very sad.\n\n#policebrutality #americanpolice #kenyans https://t.co/oIt5ueQYkp', 'https://video.twimg.com/amplify_video/1274509111212814337/vid/480x480/H87QfSA2jDu3i4xz.mp4?tag=13', 'https://twitter.com/SimonSaysMaingi/status/1274978681320951812/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1274978681320951812,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-22 08:13:00\",\"submission_title\":\"Damn...if this is true...its very sad.\\n\\n#policebrutality #americanpolice #kenyans https:\\/\\/t.co\\/oIt5ueQYkp\",\"submission_body\":\"User Location: Kenya\",\"id_submitter\":115345705,\"submission_url\":\"https:\\/\\/twitter.com\\/SimonSaysMaingi\\/status\\/1274978681320951812\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/amplify_video\\/1274509111212814337\\/vid\\/480x480\\/H87QfSA2jDu3i4xz.mp4?tag=13\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'Duplicate', 'Duplicate Link Submission', 1, 0, '2020-06-22 17:15:41', '2020-06-22 17:15:41', NULL),
   ('00276900-b34a-11ea-8b9f-6523492b753c', '2020-06-13 03:07:02', 'Oopsss I totally didn’t mean to post this on twitter and tag it with #BLUEFALL https://t.co/nJS3xzezZI', 'https://video.twimg.com/ext_tw_video/1271640177694343173/pu/vid/320x568/u_qyBJ_8osuXgnZT.mp4?tag=10', 'https://twitter.com/NayveenBlue/status/1271640193460850688/video/1', '{\"data_source\":\"Twitter\",\"id_source\":1271640193460850688,\"submission_community\":null,\"submission_datetime_utc\":\"2020-06-13 03:07:02\",\"submission_title\":\"Oopsss I totally didn\\u2019t mean to post this on twitter and tag it with #BLUEFALL https:\\/\\/t.co\\/nJS3xzezZI\",\"submission_body\":\"User Location: Outer Space\",\"id_submitter\":753629919352066048,\"submission_url\":\"https:\\/\\/twitter.com\\/NayveenBlue\\/status\\/1271640193460850688\\/video\\/1\",\"submission_media_url\":\"https:\\/\\/video.twimg.com\\/ext_tw_video\\/1271640177694343173\\/pu\\/vid\\/320x568\\/u_qyBJ_8osuXgnZT.mp4?tag=10\"}', NULL, 'a0c28f40-ab30-11ea-8600-83cd8e55a953', 'First Seen', '', 1, 0, '2020-06-20 23:01:39', '2020-06-21 18:07:47', NULL);

Optional

  1. Geocoding - https://developers.google.com/maps/documentation/geocoding/start and then update GOOGLE_MAPS_GEOCODING_API_KEY in .env
  2. Importing Videos - https://rapidapi.com/ then update RAPIDAPI_KEY in .env

Console Commands

Incidents

Import the data from the https://raw.githubusercontent.com/2020PB/police-brutality/data_build/all-locations.json feed

php artisan pb:import-incidents

Traverse the feed and find the links for the videos

php artisan pb:import-video

Fetch the GEOs for new Incidents

php artisan pb:update-lat-long

**Incidents -- Helper Commands **

Truncate the incidents table and import again

php artisan pb:redo-import

Run important and geo

php artisan pb:run-import

CDN

Dump the cache

php artisan cdn:purge-cache

Link Submission Helper

Link Submission Review - Run manually

link-submission:batch-review

Other helpful commands

These commands are used frequently while debugging

`php artisan dump` in the terminal with dump() in the source code

php artisan optimize # clear cache

composer dump-autoload

Commit message conventions

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

feat(test): i am a message

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •