Platform
Resources
Pricing
Sign in
Get started
Cameron Yick
dataviz + interactive analytics
Workspace
Fork
Published
By
Cameron Yick
Edited
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
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.
Try it for free
Learn more