Published
Edited
Mar 24, 2020
1 fork
6 stars
Andy's Walgreens COVID-19 Tracker TrackerBelgium Vaccination Tracker - Progress of the vaccination campaignVaccination against covid-19 in France500,000 COVID-19 DeathsCovid-19 vaccinations: BubblesTime Spiral with a COVID DemoCOVID MasksGrid Cartogram component with live COVID demos (plus a MapEditor)The US COVID SyringeCOVID-19 DKCOVID-19 World Community Mobility Report by GoogleCOVID 19Chicago COVID ZIP SparklinesThe COVID Syringeభారతదేశంలో కోవిడ్-19SVG DataGrid with many features and a live COVID Dashboard demoThe spread of Covid-19 in New MexicoHeatmap of COVID-19 Confirmed Cases by Age over Time in JapanThe CoViD-19 ReportCovid19 WorldwideMassachusetts Coronavirus Cases by TownChoropleth map about Covid19 in FranceWell ordered coronavirus heatmaps for US and the WorldCOVID-19 Racial/Ethnic Mortality AnalysisProPublica's COVID Arrow MapClustering students to slow virus spread inside schoolsCOVID-19 in the USAWho Is Wearing Masks in the U.S.Covid-19 Viz RoundupCoronavirus StatsThe Covid-19 Crisis' Impact on the Number of US Flight PassengersCOVID-19 Daily New CasesCOVID-19 CasesCOVID–19 Bubble Chart with D3 RenderCoronavirus Deaths by Race / EthnicityHow many SARS-CoV-2 tests are we running in the U.S.?COVID-19 Onset vs. ConfirmationPeaks in confirmed daily deaths due to COVID-19 so farCOVID-19 in the U.S.Recreating John Burn-Murdoch’s Coronavirus trackerTracking COVID-19 Cases in VietnamCOVID-19 in NYC by Zip Code & IncomeVisualizing the Network Meta-Analysis of Covid-19 Studiesxkcd COVID-19 spread sketchCOVID-19's deaths in EuropeCovid-19 (corona virus) deaths per 1,000,000 peopleCOVID-19 Bubble map or spike map? (Twitter debate)A Timeline of Shelter-in-PlaceWhere’s that $2 trillion going?Estimating SARS-COV-2 infectionsCODAVIM - CountySARS-CoV-2 Epi CurveCOVID-19 Curves (U.S.)COVID-19 Cases by CountyCOVID-19 world growth rateA graphical experiment of exponential spreadCOVID-19 by US countyCOVID-19 Confirmed vs. New cases"Live" Logistic Coronavirus Death CounterInfografiche: COVID-19 in ItaliaCoronavirus (COVID-19) GlobeBar Chart Race, COVID-19 outbreak Worldwide to 24th March 2020
US Coronavirus testing by states
United States Coronavirus Daily Cases Map (COVID-19)COVID-19 Numbers by State, Side by SideRecreating NYT U.S. Cases MapCOVID-19 in Washington stateCOVID-19 outbreak in maps and chartsCOVID-19 Spreading trendsRestaurants during COVID-19 social distancingCOVID-19 Countries Trajectories in 3DStates that aren't reporting aspects of their COVID-19 testing processNextstrain Prototyping - Issue 817Reviewing COVID-19 SARS-CoV-2 preprints from medRxiv and bioRxivCoronavirus worldwide evolutionCovid-19 New Cases PunchcardCovid-19 cases per district in Germany.COVID-19 Cases, Deaths, and Recoveries (Select Country)Quarantine NowEmissions in WuhanCOVID-19(nCOV-2019) Outbreak in S.KoreaMovement of population between provinces in 2019-nCoVComparing COVID-19 GrowthCovid-19 derived chartCoronavirus Trends (COVID-19)Netherlands Coronavirus Daily Cases Map (COVID-19)Map and timeline of Corona outbreakSARS-CoV-2 Phylogenetic TreeCoronavirus data (covid-19)Visualizing the Logic of Exponential Viral SpreadItaly Coronavirus Daily Cases Map (COVID-19)COVID-19 Fatality Rate
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
embed({
data: {values: improved.filter(d=>d[variable] > 0)},
mark: mark,
height: 600,
title: `Coronavirus ${variable.replace(/_/g, " ")} by states`,
width: width * 0.6,
encoding: {
x: {
field:"date",
type:"ordinal",
timeUnit: "yearmonthdate"
},
y: {
field:"state",
type:"ordinal",
sort: ["HI","AK","WA","OR","CA","AZ","NM","CO","WY","UT","NV","ID","MT","ND","SD","NE","KS","IA","MN","MO","OH","MI","IN","IL","WI","OK","AR","TX","LA","MS","AL","TN","KY","GA","FL","SC","WV","NC","VA","DC","MD","DE","PA","NJ","NY","CT","RI","MA","NH","VT","ME"]
},
color: mark == 'rect' ? {
field: variable,
type: "quantitative",
scale: {type: scale_type}
} : undefined,

size: mark == 'circle' ? {
field: variable,
type: "quantitative",
scale: {type: "sqrt"},
} : undefined,
tooltip: {
field: variable
}
}
})


Insert cell
new Date("2020","01","01")
Insert cell
embed = require("vega-embed@6")
Insert cell
function parse(str) {
//https://stackoverflow.com/questions/10638529/how-to-parse-a-date-in-format-yyyymmdd-in-javascript
var y = str.substr(0,4),
m = str.substr(4,2) - 1,
d = str.substr(6,2) ;
var D = new Date(y,m,d, 16);
return (D.getFullYear() == y && D.getMonth() == m && D.getDate() == d) ? D : 'invalid date';
}

Insert cell
improved.filter( d=> d.state=="CA")
Insert cell
improved = d3.nest().key(d => d.state)
.map(daily)
.values()
.map(state => {
state.sort((a, b) => a.date - b.date)
let last_positive = 0;
let last_negative = 0;
let last_death = 0;
for (let d of state) {
d.new_positives = +d.positive - last_positive
d.new_tests = +d.total - (last_positive + last_negative);
d.delta = d.new_positives/last_positive
if (d.new_positives < 50 | last_positive < 100) {d.delta = undefined}
d.new_negatives = +d.negative - last_negative
d.new_death = +d.death - last_death;
d.cases_per_bed = +d.positive / bed_counts.get(d.state)
d.new_cases_per_bed = d.new_positives / bed_counts.get(d.state)

last_positive = +d.positive
last_death = +d.death;
last_negative = +d.negative
d.positive_rate = d.new_positives / (d.new_positives + d.new_negatives)
if (d.new_negatives < 100) {
d.positive_rate = undefined
}
}
return state.flat()
}).flat()
Insert cell
daily = d3.csv('https://covidtracking.com/api/states/daily.csv')
.then(data => {
data.forEach(d => {
d.date = parse(d.date)
})
data = data.concat(newest)
return data
})
Insert cell
next_cutoff = function() {
const current_time = new Date()
let [m, d] = [current_time.getMonth(), current_time.getDate()]
if (current_time.getHours() >= 16) {
current_time.setDate(current_time.getDate() + 1)
}
current_time.setHours(16)
current_time.setMinutes(0)
current_time.setSeconds(0)
current_time.setMilliseconds(0)
return current_time
}
Insert cell
next_cutoff() > 16
Insert cell
newest = d3.csv('https://covidtracking.com/api/states.csv').then(frame => {
frame.forEach(d => {
d.date = new Date(d.dateModified)
if (d.date.getHours() >= 16) {
d.date.setDate(d.date.getDate() + 1)
}
d.date.setHours(16)
d.date.setMinutes(0)
d.date.setSeconds(0)
d.date.setMilliseconds(0)
})
return frame.filter(d => {
d.date = next_cutoff()
d.last = next_cutoff()
d.last.setDate(d.last.getDate() - 1)
if (new Date(d.dateModified) > d.last) {
return true
}
return true
})
})
Insert cell
new Date().getHours()
Insert cell
new Date("2020-03-22T16:01:00Z")
Insert cell
new Date()
Insert cell

import {vl} from '@vega/vega-lite-api'
Insert cell
d3 = require('d3@5','d3-array')
Insert cell
import {radio} from '@jashkenas/inputs'
Insert cell
md`My own estimates of hospital beds, based on medicare cost reporting files. This dataset is a little messy, so I may be off by 10%.`
Insert cell
bed_counts = d3.rollup(hospital_beds, v => v[0].beds, k => k.State)
Insert cell
hospital_beds = [{"State":"CA","beds":70529},{"State":"TX","beds":60549.5},{"State":"FL","beds":51170},{"State":"NY","beds":44429.5},{"State":"PA","beds":34337.5},{"State":"IL","beds":29643},{"State":"OH","beds":29041.5},{"State":"MI","beds":22643},{"State":"NC","beds":21127},{"State":"NJ","beds":20680.5},{"State":"GA","beds":20397},{"State":"TN","beds":17801.5},{"State":"MO","beds":17397},{"State":"IN","beds":16574.5},{"State":"VA","beds":15867},{"State":"MA","beds":15492.5},{"State":"LA","beds":14471},{"State":"AZ","beds":14146},{"State":"AL","beds":14036},{"State":"KY","beds":13719},{"State":"WI","beds":12832.5},{"State":"MD","beds":12520.5},{"State":"WA","beds":11430.5},{"State":"SC","beds":11335},{"State":"MN","beds":10846},{"State":"OK","beds":10490.5},{"State":"MS","beds":10465},{"State":"CO","beds":9846.5},{"State":"AR","beds":8695.5},{"State":"PR","beds":8659},{"State":"KS","beds":7787.5},{"State":"CT","beds":7617},{"State":"IA","beds":7507.5},{"State":"OR","beds":6471.5},{"State":"NV","beds":6215},{"State":"WV","beds":5806.5},{"State":"UT","beds":5142.5},{"State":"NE","beds":5111.5},{"State":"NM","beds":4200.5},{"State":"ID","beds":3049.5},{"State":"ME","beds":2953.5},{"State":"MT","beds":2761},{"State":"SD","beds":2716},{"State":"DE","beds":2577.5},{"State":"DC","beds":2576.5},{"State":"NH","beds":2556},{"State":"ND","beds":2442.5},{"State":"HI","beds":2371},{"State":"RI","beds":2309},{"State":"AK","beds":1432},{"State":"WY","beds":1280},{"State":"VT","beds":1114},{"State":"GU","beds":253},{"State":"VI","beds":219},{"State":"MP","beds":74}]
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