14
$\begingroup$

I'm using this dataset to check out the data on new COVID-19 cases. But there are two issues:

  1. Two days ago it was working great and it had data up to March 13; 1 day lag. Now when I run the cell in mathematica:

    ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"]
    

    it doesn't update past March 13. So I cannot get the newer data by running the cell again.

  2. On the data repo page it says it has data as recent as March 14. But I think the original data comes from Johns Hopkins University (link), which seems to have updated 14 hours ago (March 15).

So how can I 1. get the new data and, if I cannot expect the Wolfram data to update daily then 2. is it possible to import the JHU data directly and turn it into nice TimeSeries objects like they provide in the Wolfram data repo?

$\endgroup$
3
  • 2
    $\begingroup$ I think they update it on weekdays only so by the end of Monday you will see it updated till 16th. But the patient data is so far off from its source and is missing several entries (docs.google.com/spreadsheets/d/…) $\endgroup$
    – user13892
    Mar 16 '20 at 16:18
  • $\begingroup$ @user13892 I'm not sure that's the whole story because in the first link I posted, they have an example notebook that uses data from up to March 14. Mine only gets the data from March 13. $\endgroup$
    – Diffycue
    Mar 16 '20 at 22:48
  • $\begingroup$ I suspect you may need to use raw data from GitHub this may help "Coronavirus Covid 19 Stats Analysis in Excel" as it is not staightforward. youtube.com/watch?v=jgsSqDUbYqQ $\endgroup$
    – deeuubee
    Apr 3 '20 at 10:58
15
$\begingroup$

It never updates for me properly. This is what I do:

ro = ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"];
DeleteObject[ro];
ro = ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"];

Just delete and re-download.

Wolfram basically just provides some minor convenience by re-formatting the data to a more Mathematica-compatible format. It may be a better idea to take the data from the source directly:

data = SemanticImport[
  "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv", 
  HeaderLines -> 1
]

data[All, {1, 2, 5 ;;}][
  All, {3 -> KeyMap[DateObject[{#, {"Month", "Day", "Year"}}, "Day"] &] /* TimeSeries}]
$\endgroup$
6
  • 1
    $\begingroup$ Thanks this is exactly what I was looking for! $\endgroup$
    – Diffycue
    Mar 17 '20 at 18:52
  • $\begingroup$ @Szabolcs Thank you for your important and useful answer. Is it possible, that the link SemanticImport[…] is protected? I failed opening. $\endgroup$ Mar 27 '20 at 9:46
  • $\begingroup$ @UlrichNeumann I was told they changed the structure of the data repo recently, please take a look on GitHub. I have not yet had a chance to look. $\endgroup$
    – Szabolcs
    Mar 27 '20 at 9:58
  • $\begingroup$ @Szabolcs Thanks, I'll try it $\endgroup$ Mar 27 '20 at 10:00
  • 1
    $\begingroup$ @TugrulTemel The file is no longer there. They changes the repository structure, and possibly also the format of the data. github.com/CSSEGISandData It'd take a bit of effort to find the best way to import into Mathematica, and tonight I'm too tried. $\endgroup$
    – Szabolcs
    Mar 29 at 20:06
5
$\begingroup$

Use ResourceUpdate for this:

data = ResourceData[ResourceUpdate["Epidemic Data for Novel Coronavirus COVID-19"]];
$\endgroup$
4
  • 1
    $\begingroup$ This is exactly what almost never works for me. It works if the data was last downloaded many days ago. But for updating every day, it does not work. $\endgroup$
    – Szabolcs
    Mar 17 '20 at 19:08
  • $\begingroup$ @Szabolcs Hm, worked for me today. If it doesn't, then it may be safely considered a bug, as it not doing what is supposed to according to documentation. $\endgroup$
    – swish
    Mar 17 '20 at 19:11
  • $\begingroup$ Did you update yesterday? Did you ever try using ResourceUpdate with a less than 24h difference from the last update? I already reported it to Wolfram and I was told that currently ResourceUpdate does not check for an update on the server. If the system has automatically synced with the server before, and therefore ResourceUpdate is aware that the data is out of date, then it will work. This was my understanding. $\endgroup$
    – Szabolcs
    Mar 17 '20 at 19:34
  • 1
    $\begingroup$ @Szabolcs Yeah, I've downloaded the data about two days ago for the first time, today I've decided to redraw my plot on a new data, this is what worked immediately, without doing any object deletion and without any troubles. $\endgroup$
    – swish
    Mar 17 '20 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.