Public
Edited
Mar 28, 2023
1 fork
Insert cell
# madatdata/client testing
(number of states with mask mandates)
Insert cell
madatdata = await import("https://cdn.skypack.dev/@madatdata/core@latest?min");
Insert cell
client = splitgraph.makeClient({ credential: null })
Insert cell
result = await client.execute(`select
to_date(date, 'MM/DD/YYYY') as raw_date,
date_part('year', to_date(date, 'MM/DD/YYYY')) || '-' ||
date_part('week', to_date(date, 'MM/DD/YYYY')) as year_week,
date,
count(state_tribe_territory)
from "cdc-gov/us-state-and-territorial-public-mask-mandates-from-tzyy-aayg:latest"."us_state_and_territorial_public_mask_mandates_from"
where face_masks_required_in_public = 'Yes'
group by date
order by raw_date asc;`)
Insert cell
states_with_mask_mandates = result.response.rows.map(row => ({...row, raw_date: new Date(row.raw_date), count: parseInt(row.count) }))
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(states_with_mask_mandates, {x: "raw_date", y: "count"})
]
})
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