Published
Edited
Feb 19, 2021
1 fork
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sampleDatum = {
viewAnother;
return data[Math.floor(Math.random() * data.length)];
}
Insert cell
categories = [
"Blocked Street or SideWalk",
// "Graffiti",
"Residential Building Request",
// "Noise Report",
// "Street and Sidewalk Cleaning",
"Sign Repair",
"Streetlights",
"Tree Maintenance"
]
Insert cell
byCategory.map(([key, values]) => values)
Insert cell
byCategory = d3.groups(data, d => d.category)
Insert cell
data = fetch(uri).then(res => res.json())
Insert cell
uri = `${endpoint}?$limit=${limit}&$select=${select}&$where=${where}&$order=${order}`
Insert cell
order = "requested_datetime DESC"
Insert cell
where = `requested_datetime >= '2020-12-01' AND closed_date < '2021-02-15' AND (service_name = ${categories
.map(d => `'${d}'`)
.join(" OR service_name = ")})`
Insert cell
limit = 50 // default is 1000 rows
Insert cell
select = "service_request_id as id, closed_date as endDate, requested_datetime as startDate, service_name as category, service_details as description" // default is '*'
Insert cell
endpoint = "https://data.sfgov.org/resource/vw6y-z8j6.json"
Insert cell
d3 = require("d3-array@2")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more