Skip to content

Commit

Permalink
Merge pull request #84 from brandonp728/master
Browse files Browse the repository at this point in the history
Added arrest data. Closes #63 . Thanks, @brandonp728 !
  • Loading branch information
vonbearshark authored Jan 27, 2017
2 parents 42ce8e9 + 79768fc commit 2ee61e6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
html: '<i class="fa fa-balance-scale"></i>',
iconSize: [32, 32],
iconAnchor: [16, 32]
}),
CITY_ARREST: L.divIcon({
className: 'map-pin red',
html: '<i class="fa fa-gavel"></i>',
iconSize: [32, 32],
iconAnchor: [16, 32]
}),
CITY_311_ICON: L.divIcon({
className: 'map-pin yellow',
Expand Down Expand Up @@ -141,6 +147,24 @@
}
},

"Arrest": {
id: 'e03a89dd-134a-4ee8-a2bd-62c40aeebc6f',
primaryFiltering: 'WHERE "INCIDENTNEIGHBORHOOD" LIKE \'%Oakland\'',
latLong: ['Y', 'X'],
icon: iconTypes.CITY_ARREST,

// TODO: Better title and popup messages?
title: (record) => record['OFFENSES'],
popup: (record) => record['OFFENSES'],

processRecord: (record) => {
// Collect time of incident from the record
record.incidentYear = parseInt(record.ARRESTTIME.substring(0,4));
record.incidentMonth = parseInt(record.ARRESTTIME.substring(5,8));
record.incidentDay = parseInt(record.ARRESTTIME.substring(8,10));
}
},

// City of Pittsburgh 311 data
// TODO: would be great to prune 311 data to the last 30 days, like the police data
"311": {
Expand Down Expand Up @@ -203,6 +227,7 @@
// TODO: should have some generic error handling for data
.catch((err) => displayNotification(err))
.then((data) => {
console.log(dataSource.id, data);
const records = data.result.records;

records.forEach((record, i) => {
Expand Down Expand Up @@ -231,6 +256,7 @@
Promise.all([
fetchWPRDCData('Police', { limit: 250 }),
fetchWPRDCData('311', { limit: 250 }),
fetchWPRDCData('Arrest', { limit: 250 }),
fetchWPRDCData('Library')
]).then(() => {
console.log('All data loaded');
Expand Down

0 comments on commit 2ee61e6

Please sign in to comment.