covid_19_onset_confirmation = {
update;
const parseDate = d3.utcParse("%d.%m.%Y");
return d3.csv("https://raw.githubusercontent.com/beoutbreakprepared/nCoV2019/master/latest_data/latestdata.csv", d => {
let {date_confirmation, date_onset_symptoms: date_onset} = d;
if (!date_confirmation || !date_onset) return;
switch (date_onset) {
case "01.31.2020": date_onset = "31.01.2020"; break;
case "08.03.20202": date_onset = "08.03.2020"; break;
}
date_confirmation = parseDate(date_confirmation);
date_onset = parseDate(date_onset);
if (!date_confirmation) console.warn(`invalid date_confirmation: ${d.date_confirmation}`);
if (!date_onset) console.warn(`invalid date_onset: ${d.date_onset}`);
return date_onset && date_confirmation && {date_onset, date_confirmation};
});
}