Published
Edited
Mar 19, 2022
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
officersNoReports = totalOfficers - officerCount
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
officerReportsIncludeNoNameData = {
const allResults = [...officerReportsRawData]
const oneOrTwoReports = allResults.splice(0, 2)
const threeReportsOrMore = allResults

const noName = allResults.pop()
const one = oneOrTwoReports[0].total_reports
const two = oneOrTwoReports[1].total_reports
const threeOrMore = threeReportsOrMore.reduce((int, item) => {
int += item.total_reports
return int
}, 0)

return [
{ value: one, label:'One report' },
{ value: two, label:'Two reports' },
{ value: threeOrMore, label:'Three or more reports' },
{ value: noName.total_reports, label:'Reports without officer name'}
]
}
Insert cell
totalOfficersReportsSubmitted = {
return officerReportsRawData.reduce((int, item) => {
console.log('item', item)
int += item.number_of_officers
return int
}, 0)
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof incidentsDonut = createDonut(incidentsData, {
labelKey: 'subject_race',
dataKey: 'incident_count',
width: 450
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof treatmentsBar = createHorizontalBar(treatmentsData, {
labelKey: 'subject_race',
dataKey: 'incident_count'
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof dischargeBar = createHorizontalBar(dischargeData, {
dataKey: 'incident_count',
labelKey: 'subject_race',
height: 100,
marginLeft: 55
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more