Published
Edited
Feb 1, 2021
Insert cell
Insert cell
md`Show items that have slots, in response to canceled appointments reappearing on the site`
Insert cell
unfilteredWithSlots = apiLocationsUnfiltered.locations.filter(loc => loc.json.slots.length > 0)
Insert cell
Insert cell
unrecognizedLocations = apiLocations.locations.filter(row => newIds.has(row.id)).map(formatLocForTable)
Insert cell
aq.from(unrecognizedLocations)
.view()
Insert cell
Insert cell
recognizedLocations = apiLocations.locations.filter(row => !newIds.has(row.id)).map(formatLocForTable)
Insert cell
aq.from(recognizedLocations)
.view()
Insert cell
md`These locations are in the sheet but not in the API... perhaps they were renamed?`
Insert cell
maybeStaleLocations = sheetLocations.filter(row => maybeStaleIds.has(Number(row['locations/id'])))
Insert cell
aq.from(maybeStaleLocations)
.view()
Insert cell
formatLocForTable = loc => {

return {
...loc,
address: loc.address.join(" ")
}

}
Insert cell
Insert cell
sheetLocations = d3.csv('https://docs.google.com/spreadsheets/d/e/2PACX-1vTmgw0Qvj65TWlhxOprndjA702WPTLFsUVXlpV18hWEH5KR_I0JpY30W1Ki6JnIKwEmxvxzkvR0hJw2/pub?output=csv')
Insert cell
apiLocations = d3.json('https://admin.nycvaccinelist.com/api/locations')
Insert cell
apiLocationsUnfiltered = d3.json('https://admin.nycvaccinelist.com/api/locations_unfiltered')
Insert cell
apiIds = apiLocations.locations.map(loc => loc.id)
Insert cell
sheetIds = sheetLocations.map(row => Number(row['locations/id']))
Insert cell
md`Check items from API that are new`
Insert cell
newIds = {
const sheetIdSet = new Set(sheetIds);
return new Set(apiIds.filter(id => !sheetIdSet.has(id)))
}
Insert cell
maybeStaleIds = {
const apiIdSet = new Set(apiIds);
return new Set(sheetIds.filter(id => !apiIdSet.has(id)))
}
Insert cell
md`
## Related reading

https://observablehq.com/@uwdata/introducing-arquero
`
Insert cell
d3 = require("d3@5")
Insert cell
import { aq, op } from '@uwdata/arquero'
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