Published
Edited
Jan 22, 2022
Importers
Insert cell
Insert cell
function buildURI (dataset, limit=1000, other_params="") {
if (limit === 1000) {
// to call this with default limit and additional params, use undefined as 2nd argument:
// buildURI("dataset", undefined, "params")
var uri = "https://data.virginia.gov/resource/" + dataset + other_params;
} else {
var uri = "https://data.virginia.gov/resource/" + dataset + ".json?$limit=" + limit + other_params;
}
return uri;
}
Insert cell
Insert cell
uri = buildURI("bre9-aqqr", 100000) // since there were 89.9k on Jan 22, 2022, request more than that
Insert cell
Insert cell
data = (await fetch(uri)).json()
Insert cell
printTable(data.slice(0,5))
Insert cell
Insert cell
data.forEach(d => {
d.report_date = new Date(d.report_date),
d.total_cases = +d.total_cases,
d.hospitalizations = +d.hospitalizations,
d.deaths = +d.deaths
});
Insert cell
printTable(data.slice(0,5))
Insert cell
import {printTable} from "@uwdata/data-utilities"
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