diff --git a/.renku/workflow/4cc7ffe9d5a045efb048ef2222a40ffa_papermill.cwl b/.renku/workflow/4cc7ffe9d5a045efb048ef2222a40ffa_papermill.cwl new file mode 100644 index 0000000000000000000000000000000000000000..1ca535dda41f95c17c85bc3c6cf2a2a7c67fb1ea --- /dev/null +++ b/.renku/workflow/4cc7ffe9d5a045efb048ef2222a40ffa_papermill.cwl @@ -0,0 +1,113 @@ +arguments: [] +baseCommand: +- papermill +class: CommandLineTool +cwlVersion: v1.0 +hints: [] +inputs: + input_1: + default: ts_folder + inputBinding: + position: 1 + prefix: -p + separate: true + shellQuote: true + streamable: false + type: string + input_2: + default: + class: Directory + listing: [] + path: ../../data/covid-19_jhu-csse + inputBinding: + position: 2 + separate: true + shellQuote: true + streamable: false + type: Directory + input_3: + default: rates_folder + inputBinding: + position: 3 + prefix: -p + separate: true + shellQuote: true + streamable: false + type: string + input_4: + default: + class: Directory + listing: [] + path: ../../data/covid-19_rates + inputBinding: + position: 4 + separate: true + shellQuote: true + streamable: false + type: Directory + input_5: + default: geodata_path + inputBinding: + position: 5 + prefix: -p + separate: true + shellQuote: true + streamable: false + type: string + input_6: + default: + class: File + path: ../../data/geodata/geo_data.csv + inputBinding: + position: 6 + separate: true + shellQuote: true + streamable: false + type: File + input_7: + default: + class: File + path: ../../notebooks/Dashboard.ipynb + inputBinding: + position: 7 + prefix: --inject-paths + separate: true + shellQuote: true + streamable: false + type: File + input_8: + default: runs/Dashboard.run.ipynb + inputBinding: + position: 8 + separate: true + shellQuote: true + streamable: false + type: string +outputs: + output_0: + outputBinding: + glob: $(inputs.input_8) + streamable: false + type: File +permanentFailCodes: [] +requirements: +- class: InlineJavascriptRequirement +- class: InitialWorkDirRequirement + listing: + - entry: '$({"listing": [], "class": "Directory"})' + entryname: runs + writable: true + - entry: $(inputs.input_2) + entryname: data/covid-19_jhu-csse + writable: false + - entry: $(inputs.input_4) + entryname: data/covid-19_rates + writable: false + - entry: $(inputs.input_6) + entryname: data/geodata/geo_data.csv + writable: false + - entry: $(inputs.input_7) + entryname: notebooks/Dashboard.ipynb + writable: false +successCodes: [] +temporaryFailCodes: [] diff --git a/runs/Dashboard.run.ipynb b/runs/Dashboard.run.ipynb index 190e010a7c08454474636230fddb9c678c05e4aa..97ed85143c3d9761aef8bb6b781fd8d2526c70b4 100644 --- a/runs/Dashboard.run.ipynb +++ b/runs/Dashboard.run.ipynb @@ -5,10 +5,10 @@ "execution_count": 1, "metadata": { "papermill": { - "duration": 0.318369, - "end_time": "2020-03-13T17:58:07.699048", + "duration": 0.328323, + "end_time": "2020-03-15T16:37:29.576519", "exception": false, - "start_time": "2020-03-13T17:58:07.380679", + "start_time": "2020-03-15T16:37:29.248196", "status": "completed" }, "tags": [] @@ -25,10 +25,10 @@ "execution_count": 2, "metadata": { "papermill": { - "duration": 0.02116, - "end_time": "2020-03-13T17:58:07.739632", + "duration": 0.023318, + "end_time": "2020-03-15T16:37:29.619560", "exception": false, - "start_time": "2020-03-13T17:58:07.718472", + "start_time": "2020-03-15T16:37:29.596242", "status": "completed" }, "tags": [ @@ -39,6 +39,7 @@ "source": [ "ts_folder = \"../data/covid-19_jhu-csse/\"\n", "rates_folder = \"../data/covid-19_rates/\"\n", + "geodata_path = \"../data/geodata/geo_data.csv\"\n", "out_folder = None\n", "PAPERMILL_OUTPUT_PATH = None" ] @@ -48,10 +49,10 @@ "execution_count": 3, "metadata": { "papermill": { - "duration": 0.021777, - "end_time": "2020-03-13T17:58:07.771101", + "duration": 0.021164, + "end_time": "2020-03-15T16:37:29.651150", "exception": false, - "start_time": "2020-03-13T17:58:07.749324", + "start_time": "2020-03-15T16:37:29.629986", "status": "completed" }, "tags": [ @@ -61,10 +62,11 @@ "outputs": [], "source": [ "# Parameters\n", - "PAPERMILL_INPUT_PATH = \"/tmp/ajs106te/notebooks/Dashboard.ipynb\"\n", + "PAPERMILL_INPUT_PATH = \"notebooks/Dashboard.ipynb\"\n", "PAPERMILL_OUTPUT_PATH = \"runs/Dashboard.run.ipynb\"\n", - "ts_folder = \"/tmp/ajs106te/data/covid-19_jhu-csse\"\n", - "rates_folder = \"/tmp/ajs106te/data/covid-19_rates\"\n" + "ts_folder = \"./data/covid-19_jhu-csse/\"\n", + "rates_folder = \"./data/covid-19_rates/\"\n", + "geodata_path = \"./data/geodata/geo_data.csv\"\n" ] }, { @@ -72,10 +74,10 @@ "execution_count": 4, "metadata": { "papermill": { - "duration": 0.020625, - "end_time": "2020-03-13T17:58:07.801350", + "duration": 0.018422, + "end_time": "2020-03-15T16:37:29.679468", "exception": false, - "start_time": "2020-03-13T17:58:07.780725", + "start_time": "2020-03-15T16:37:29.661046", "status": "completed" }, "tags": [] @@ -90,10 +92,10 @@ "execution_count": 5, "metadata": { "papermill": { - "duration": 0.088499, - "end_time": "2020-03-13T17:58:07.900202", + "duration": 0.081996, + "end_time": "2020-03-15T16:37:29.770910", "exception": false, - "start_time": "2020-03-13T17:58:07.811703", + "start_time": "2020-03-15T16:37:29.688914", "status": "completed" }, "tags": [] @@ -120,10 +122,10 @@ "execution_count": 6, "metadata": { "papermill": { - "duration": 0.046747, - "end_time": "2020-03-13T17:58:07.960957", + "duration": 0.058057, + "end_time": "2020-03-15T16:37:29.848129", "exception": false, - "start_time": "2020-03-13T17:58:07.914210", + "start_time": "2020-03-15T16:37:29.790072", "status": "completed" }, "tags": [] @@ -150,17 +152,20 @@ "execution_count": 7, "metadata": { "papermill": { - "duration": 0.019568, - "end_time": "2020-03-13T17:58:07.999627", + "duration": 0.032963, + "end_time": "2020-03-15T16:37:29.896281", "exception": false, - "start_time": "2020-03-13T17:58:07.980059", + "start_time": "2020-03-15T16:37:29.863318", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ - "# Compile data needed for the visualizations" + "geodata_df = pd.read_csv(geodata_path)\n", + "geodata_df = geodata_df.drop('Unnamed: 0', axis=1)\n", + "geodata_df = geodata_df.rename({'name_jhu':'Country/Region'}, axis=1)\n", + "geodata_df = geodata_df.set_index('Country/Region')" ] }, { @@ -168,30 +173,10 @@ "execution_count": 8, "metadata": { "papermill": { - "duration": 0.03619, - "end_time": "2020-03-13T17:58:08.046674", + "duration": 0.03569, + "end_time": "2020-03-15T16:37:29.945698", "exception": false, - "start_time": "2020-03-13T17:58:08.010484", - "status": "completed" - }, - "tags": [] - }, - "outputs": [], - "source": [ - "# Compute geospatial coordinates\n", - "country_coords_df = jhu_frames_map['confirmed'].reset_index([2,3])[['Lat', 'Long']]\n", - "country_coords_df = country_coords_df.groupby(level='Country/Region').mean()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "papermill": { - "duration": 0.036248, - "end_time": "2020-03-13T17:58:08.099308", - "exception": false, - "start_time": "2020-03-13T17:58:08.063060", + "start_time": "2020-03-15T16:37:29.910008", "status": "completed" }, "tags": [] @@ -199,7 +184,11 @@ "outputs": [], "source": [ "# Identify countries with 100 or more cases\n", - "case_count_ser = jhu_frames_map['confirmed'].iloc[:,-1].groupby(level='Country/Region').sum()\n", + "def latest_jhu_country_ser(name):\n", + " return jhu_frames_map[name].iloc[:,-1].groupby(level='Country/Region').sum()\n", + "\n", + "\n", + "case_count_ser = latest_jhu_country_ser('confirmed')\n", "countries_over_thresh = case_count_ser[case_count_ser > 99].index" ] }, @@ -207,10 +196,10 @@ "cell_type": "markdown", "metadata": { "papermill": { - "duration": 0.009486, - "end_time": "2020-03-13T17:58:08.127085", + "duration": 0.008775, + "end_time": "2020-03-15T16:37:29.967726", "exception": false, - "start_time": "2020-03-13T17:58:08.117599", + "start_time": "2020-03-15T16:37:29.958951", "status": "completed" }, "tags": [] @@ -218,18 +207,20 @@ "source": [ "# Questions About COVID-19 and Its Spread\n", "\n", - "These plots should be taken with a large grain of salt. I am not an epidemiologist, so the analyses shown here are completely naive. There are large discrepencies in the data from different countries for a variety of reasons (rates of testing, demographics, etc.) so that make direct comparisons inaccurate. Nonetheless, I think there is a lot of interesting information in this data." + "Understanding the spread, distribution, and deadliness of COVID-19 is difficult, despite the data available about it. Differences in rates of testing, quality of data, demographics, etc. make it difficult to compare data between countries. \n", + "\n", + "All this needs to be considered when looking at the plots below. But despite those caveats, I found it helpful to plot the raw data, even though direct comparisons between countries might not be inaccurate." ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": { "papermill": { - "duration": 0.043858, - "end_time": "2020-03-13T17:58:08.178940", + "duration": 0.041164, + "end_time": "2020-03-15T16:37:30.016520", "exception": false, - "start_time": "2020-03-13T17:58:08.135082", + "start_time": "2020-03-15T16:37:29.975356", "status": "completed" }, "tags": [] @@ -238,7 +229,7 @@ { "data": { "text/html": [ - "<em>Data up to Mar 12 2020</em>" + "<em>Data up to Mar 13 2020; countries with 100 or more confirmed cases.</em>" ], "text/plain": [ "<IPython.core.display.HTML object>" @@ -250,17 +241,17 @@ ], "source": [ "data_ts = jhu_frames_map['confirmed'].iloc[:,-1].name.strftime(\"%b %d %Y\")\n", - "display(HTML(f\"<em>Data up to {data_ts}</em>\"))" + "display(HTML(f\"<em>Data up to {data_ts}; countries with 100 or more confirmed cases.</em>\"))" ] }, { "cell_type": "markdown", "metadata": { "papermill": { - "duration": 0.009732, - "end_time": "2020-03-13T17:58:08.205403", + "duration": 0.008127, + "end_time": "2020-03-15T16:37:30.039436", "exception": false, - "start_time": "2020-03-13T17:58:08.195671", + "start_time": "2020-03-15T16:37:30.031309", "status": "completed" }, "tags": [] @@ -271,13 +262,13 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "metadata": { "papermill": { - "duration": 0.215996, - "end_time": "2020-03-13T17:58:08.429475", + "duration": 0.189114, + "end_time": "2020-03-15T16:37:30.236186", "exception": false, - "start_time": "2020-03-13T17:58:08.213479", + "start_time": "2020-03-15T16:37:30.047072", "status": "completed" }, "tags": [] @@ -290,47 +281,58 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "metadata": { "papermill": { - "duration": 0.040087, - "end_time": "2020-03-13T17:58:08.490379", + "duration": 0.046044, + "end_time": "2020-03-15T16:37:30.300949", "exception": false, - "start_time": "2020-03-13T17:58:08.450292", + "start_time": "2020-03-15T16:37:30.254905", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ + "def latest_rates_ser(name):\n", + " return rates_frames_map[name].iloc[:,-1]\n", + "\n", + "\n", "# Compile the basic df\n", "map_df = pd.concat([\n", - " rates_frames_map['confirmed'].iloc[:,-1],\n", - " rates_frames_map['deaths'].iloc[:,-1],\n", - " rates_frames_map['recovered'].iloc[:,-1],\n", - " country_coords_df], axis=1)\n", + " latest_rates_ser('confirmed'),\n", + " latest_rates_ser('deaths'),\n", + " latest_rates_ser('recovered')], axis=1)\n", + "nominal_df = pd.concat([\n", + " latest_jhu_country_ser('confirmed'),\n", + " latest_jhu_country_ser('deaths'),\n", + " latest_jhu_country_ser('recovered')], axis=1)\n", + "map_df = pd.concat([map_df, nominal_df, geodata_df[['Longitude', 'Latitude']]], axis=1)\n", "# Restrict to countries with 100 or more cases\n", "map_df = map_df.loc[countries_over_thresh].dropna()\n", "map_df = map_df.reset_index()\n", - "map_df.columns = ['Country/Region', 'Confirmed', 'Deaths', 'Recovered', 'Lat', 'Long']" + "map_df.columns = ['Country/Region', \n", + " 'Confirmed/100k', 'Deaths/100k', 'Recovered/100k', \n", + " 'Confirmed', 'Deaths', 'Recovered',\n", + " 'Long', 'Lat']" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "metadata": { "papermill": { - "duration": 0.034884, - "end_time": "2020-03-13T17:58:08.543325", + "duration": 0.031175, + "end_time": "2020-03-15T16:37:30.349234", "exception": false, - "start_time": "2020-03-13T17:58:08.508441", + "start_time": "2020-03-15T16:37:30.318059", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ - "def map_of_variable(map_df, variable):\n", + "def map_of_variable(map_df, variable, title):\n", " # Data generators for the background\n", " sphere = alt.sphere()\n", " graticule = alt.graticule()\n", @@ -348,24 +350,26 @@ " latitude='Lat:Q',\n", " size=alt.Size(f'{variable}:Q', title=\"Cases\"),\n", " color=alt.value('steelblue'),\n", - " tooltip=[\"Country/Region:N\", \"Confirmed:Q\", \"Deaths:Q\", \"Recovered:Q\"]\n", + " tooltip=[\"Country/Region:N\", \n", + " \"Confirmed:Q\", \"Deaths:Q\", \"Recovered:Q\",\n", + " \"Confirmed/100k:Q\", \"Deaths/100k:Q\", \"Recovered/100k:Q\"]\n", " )\n", " ).project(\n", " 'naturalEarth1'\n", - " ).properties(width=600, height=400, title=f\"{variable} cases per 100,000\"\n", + " ).properties(width=600, height=400, title=f\"{title} cases per 100k inhabitants\"\n", " ).configure_view(stroke=None)\n", " return p" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": { "papermill": { - "duration": 0.103115, - "end_time": "2020-03-13T17:58:08.660915", + "duration": 0.113317, + "end_time": "2020-03-15T16:37:30.476323", "exception": false, - "start_time": "2020-03-13T17:58:08.557800", + "start_time": "2020-03-15T16:37:30.363006", "status": "completed" }, "tags": [] @@ -375,10 +379,10 @@ "data": { "text/html": [ "\n", - "<div id=\"altair-viz-9d8bbc6305e34585bef05d17e261d227\"></div>\n", + "<div id=\"altair-viz-0d5ef06b0f5c47e49467448e93085b54\"></div>\n", "<script type=\"text/javascript\">\n", " (function(spec, embedOpt){\n", - " const outputDiv = document.getElementById(\"altair-viz-9d8bbc6305e34585bef05d17e261d227\");\n", + " const outputDiv = document.getElementById(\"altair-viz-0d5ef06b0f5c47e49467448e93085b54\");\n", " const paths = {\n", " \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n", " \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n", @@ -419,7 +423,7 @@ " .catch(showError)\n", " .then(() => displayChart(vegaEmbed));\n", " }\n", - " })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300, \"stroke\": null}}, \"layer\": [{\"data\": {\"sphere\": true}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#cae6ef\"}}, {\"data\": {\"graticule\": true}, \"mark\": {\"type\": \"geoshape\", \"stroke\": \"white\", \"strokeWidth\": 0.5}}, {\"data\": {\"url\": \"https://vega.github.io/vega-datasets/data/world-110m.json\", \"format\": {\"feature\": \"countries\", \"type\": \"topojson\"}}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#dddddd\", \"stroke\": \"#aaaaaa\"}}, {\"data\": {\"name\": \"data-af06d21f07e2679aa76ca6a14f5f1418\"}, \"mark\": {\"type\": \"circle\", \"opacity\": 0.6}, \"encoding\": {\"color\": {\"value\": \"steelblue\"}, \"latitude\": {\"field\": \"Lat\", \"type\": \"quantitative\"}, \"longitude\": {\"field\": \"Long\", \"type\": \"quantitative\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"Confirmed\", \"title\": \"Cases\"}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}]}}], \"height\": 400, \"projection\": {\"type\": \"naturalEarth1\"}, \"title\": \"Confirmed cases per 100,000\", \"width\": 600, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-af06d21f07e2679aa76ca6a14f5f1418\": [{\"Country/Region\": \"Australia\", \"Confirmed\": 0.5121563305983519, \"Deaths\": 0.012003663998398872, \"Recovered\": 0.0840256479887921, \"Lat\": -23.1315375, \"Long\": 140.0609875}, {\"Country/Region\": \"Austria\", \"Confirmed\": 3.4135722502347403, \"Deaths\": 0.01130321937163821, \"Recovered\": 0.04521287748655284, \"Lat\": 47.5162, \"Long\": 14.5501}, {\"Country/Region\": \"Bahrain\", \"Confirmed\": 12.424821863098854, \"Deaths\": 0.0, \"Recovered\": 2.230096231838256, \"Lat\": 26.0275, \"Long\": 50.55}, {\"Country/Region\": \"Belgium\", \"Confirmed\": 2.749064355071253, \"Deaths\": 0.026264946067559743, \"Recovered\": 0.008754982022519914, \"Lat\": 50.8333, \"Long\": 4.0}, {\"Country/Region\": \"Canada\", \"Confirmed\": 0.3157140090886777, \"Deaths\": 0.002698410334091263, \"Recovered\": 0.021587282672730104, \"Lat\": 50.795, \"Long\": -93.00628}, {\"Country/Region\": \"Denmark\", \"Confirmed\": 10.6426174560315, \"Deaths\": 0.0, \"Recovered\": 0.01724897480718234, \"Lat\": 59.07825, \"Long\": 1.2949999999999995}, {\"Country/Region\": \"France\", \"Confirmed\": 3.4096043718413016, \"Deaths\": 0.07165543338370511, \"Recovered\": 0.017913858345926282, \"Lat\": 27.399466666666665, \"Long\": -41.22323333333333}, {\"Country/Region\": \"Germany\", \"Confirmed\": 2.5057905104628087, \"Deaths\": 0.0036175993895035743, \"Recovered\": 0.03014666157919645, \"Lat\": 51.0, \"Long\": 9.0}, {\"Country/Region\": \"Iceland\", \"Confirmed\": 29.13110126875845, \"Deaths\": 0.0, \"Recovered\": 0.28282622591027623, \"Lat\": 64.9631, \"Long\": -19.0208}, {\"Country/Region\": \"Israel\", \"Confirmed\": 1.4745942051824668, \"Deaths\": 0.0, \"Recovered\": 0.045025777257479915, \"Lat\": 31.0, \"Long\": 35.0}, {\"Country/Region\": \"Italy\", \"Confirmed\": 20.62176968839136, \"Deaths\": 1.368496511980393, \"Recovered\": 1.7292368259002542, \"Lat\": 43.0, \"Long\": 12.0}, {\"Country/Region\": \"Japan\", \"Confirmed\": 0.5050221648616801, \"Deaths\": 0.012645312422201693, \"Recovered\": 0.09325917911373748, \"Lat\": 36.0, \"Long\": 138.0}, {\"Country/Region\": \"Malaysia\", \"Confirmed\": 0.4725870190495387, \"Deaths\": 0.0, \"Recovered\": 0.08246484896166446, \"Lat\": 2.5, \"Long\": 112.5}, {\"Country/Region\": \"Netherlands\", \"Confirmed\": 2.919154452694232, \"Deaths\": 0.02901743988761661, \"Recovered\": 0.0, \"Lat\": 52.1326, \"Long\": 5.2913}, {\"Country/Region\": \"Norway\", \"Confirmed\": 13.209552425740487, \"Deaths\": 0.0, \"Recovered\": 0.018817026247493568, \"Lat\": 60.472, \"Long\": 8.4689}, {\"Country/Region\": \"Qatar\", \"Confirmed\": 9.418778672002537, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Lat\": 25.3548, \"Long\": 51.1839}, {\"Country/Region\": \"Singapore\", \"Confirmed\": 3.156769426014192, \"Deaths\": 0.0, \"Recovered\": 1.7025273308840587, \"Lat\": 1.2833, \"Long\": 103.8333}, {\"Country/Region\": \"Spain\", \"Confirmed\": 4.873324698324187, \"Deaths\": 0.11771315696435232, \"Recovered\": 0.3916637768086632, \"Lat\": 40.0, \"Long\": -4.0}, {\"Country/Region\": \"Sweden\", \"Confirmed\": 5.882251851706369, \"Deaths\": 0.009820119952765223, \"Recovered\": 0.009820119952765223, \"Lat\": 63.0, \"Long\": 16.0}, {\"Country/Region\": \"Switzerland\", \"Confirmed\": 7.655688464204314, \"Deaths\": 0.04696741389082401, \"Recovered\": 0.04696741389082401, \"Lat\": 46.8182, \"Long\": 8.2275}, {\"Country/Region\": \"US\", \"Confirmed\": 0.508302424745612, \"Deaths\": 0.012226155736515023, \"Recovered\": 0.0036678467209545055, \"Lat\": 38.88347448559672, \"Long\": -94.14907777777768}]}}, {\"mode\": \"vega-lite\"});\n", + " })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300, \"stroke\": null}}, \"layer\": [{\"data\": {\"sphere\": true}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#cae6ef\"}}, {\"data\": {\"graticule\": true}, \"mark\": {\"type\": \"geoshape\", \"stroke\": \"white\", \"strokeWidth\": 0.5}}, {\"data\": {\"url\": \"https://vega.github.io/vega-datasets/data/world-110m.json\", \"format\": {\"feature\": \"countries\", \"type\": \"topojson\"}}, \"mark\": {\"type\": \"geoshape\", \"fill\": \"#dddddd\", \"stroke\": \"#aaaaaa\"}}, {\"data\": {\"name\": \"data-95ea86d40d32f37e513861317827f4db\"}, \"mark\": {\"type\": \"circle\", \"opacity\": 0.6}, \"encoding\": {\"color\": {\"value\": \"steelblue\"}, \"latitude\": {\"field\": \"Lat\", \"type\": \"quantitative\"}, \"longitude\": {\"field\": \"Long\", \"type\": \"quantitative\"}, \"size\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\", \"title\": \"Cases\"}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}]}}], \"height\": 400, \"projection\": {\"type\": \"naturalEarth1\"}, \"title\": \"Confirmed cases per 100k inhabitants\", \"width\": 600, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-95ea86d40d32f37e513861317827f4db\": [{\"Country/Region\": \"Australia\", \"Confirmed/100k\": 0.8002442665599246, \"Deaths/100k\": 0.012003663998398872, \"Recovered/100k\": 0.09202809065439137, \"Confirmed\": 200.0, \"Deaths\": 3.0, \"Recovered\": 23.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 5.696822563305657, \"Deaths/100k\": 0.01130321937163821, \"Recovered/100k\": 0.06781931622982926, \"Confirmed\": 504.0, \"Deaths\": 1.0, \"Recovered\": 6.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 12.042519651926579, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.8035495485966644, \"Confirmed\": 189.0, \"Deaths\": 0.0, \"Recovered\": 44.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 4.894034950588631, \"Deaths/100k\": 0.026264946067559743, \"Recovered/100k\": 0.008754982022519914, \"Confirmed\": 559.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.07208692453324421, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 151.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 0.5207931944796137, \"Deaths/100k\": 0.002698410334091263, \"Recovered/100k\": 0.021587282672730104, \"Confirmed\": 193.0, \"Deaths\": 1.0, \"Recovered\": 8.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.811966425653213, \"Deaths/100k\": 0.22832853460469724, \"Recovered/100k\": 4.609364341975832, \"Confirmed\": 80945.0, \"Deaths\": 3180.0, \"Recovered\": 64196.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 1.3269720239476102, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 141.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 13.868175744974597, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 804.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 2.808963311314685, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018122343943965717, \"Confirmed\": 155.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 5.474176546209304, \"Deaths/100k\": 0.117932900777348, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 3667.0, \"Deaths\": 79.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 4.431559252141878, \"Deaths/100k\": 0.008441065242175007, \"Recovered/100k\": 0.055469857305721466, \"Confirmed\": 3675.0, \"Deaths\": 7.0, \"Recovered\": 46.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 1.771121179365357, \"Deaths/100k\": 0.009321690417712405, \"Recovered/100k\": 0.0, \"Confirmed\": 190.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"Iceland\", \"Confirmed/100k\": 37.898714271977006, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.28282622591027623, \"Confirmed\": 134.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -18.57396167, \"Lat\": 64.99575386}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 13.892374852703725, \"Deaths/100k\": 0.6283597918241565, \"Recovered/100k\": 3.6173475175246668, \"Confirmed\": 11364.0, \"Deaths\": 514.0, \"Recovered\": 2959.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.26279089130344285, \"Deaths/100k\": 0.023417010116148367, \"Recovered/100k\": 0.06244536030972898, \"Confirmed\": 101.0, \"Deaths\": 9.0, \"Recovered\": 24.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 1.8122875346135665, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.045025777257479915, \"Confirmed\": 161.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 29.22327497167319, \"Deaths/100k\": 2.0949414560667194, \"Recovered/100k\": 2.3812170262875267, \"Confirmed\": 17660.0, \"Deaths\": 1266.0, \"Recovered\": 1439.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.5540227504977115, \"Deaths/100k\": 0.01501630850136451, \"Recovered/100k\": 0.09325917911373748, \"Confirmed\": 701.0, \"Deaths\": 19.0, \"Recovered\": 118.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 15.452620201979823, \"Deaths/100k\": 0.12781964322981182, \"Recovered/100k\": 0.9876972431394551, \"Confirmed\": 7979.0, \"Deaths\": 66.0, \"Recovered\": 510.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 0.6248298171326115, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.08246484896166446, \"Confirmed\": 197.0, \"Deaths\": 0.0, \"Recovered\": 26.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 4.666004333928752, \"Deaths/100k\": 0.05803487977523322, \"Recovered/100k\": 0.0, \"Confirmed\": 804.0, \"Deaths\": 10.0, \"Recovered\": 0.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 18.741758142503603, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 996.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 1.0893074552785798, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.009725959422130177, \"Confirmed\": 112.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 11.503851813132869, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 320.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 3.5469319393417886, \"Deaths/100k\": 0.0, \"Recovered/100k\": 1.7202619905807677, \"Confirmed\": 200.0, \"Deaths\": 0.0, \"Recovered\": 97.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 6.820252958828889, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 141.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 11.197731586136207, \"Deaths/100k\": 0.28465181593197925, \"Recovered/100k\": 0.413066168984, \"Confirmed\": 5232.0, \"Deaths\": 133.0, \"Recovered\": 193.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 7.993577641550892, \"Deaths/100k\": 0.009820119952765223, \"Recovered/100k\": 0.009820119952765223, \"Confirmed\": 814.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 13.373971105412135, \"Deaths/100k\": 0.12916038819976602, \"Recovered/100k\": 0.04696741389082401, \"Confirmed\": 1139.0, \"Deaths\": 11.0, \"Recovered\": 4.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 0.6660198337466559, \"Deaths/100k\": 0.01436573299040515, \"Recovered/100k\": 0.0036678467209545055, \"Confirmed\": 2179.0, \"Deaths\": 47.0, \"Recovered\": 12.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 1.2047107166959414, \"Deaths/100k\": 0.012032067083105532, \"Recovered/100k\": 0.028576159322375637, \"Confirmed\": 801.0, \"Deaths\": 8.0, \"Recovered\": 19.0, \"Long\": -2.86563164, \"Lat\": 54.12387156}]}}, {\"mode\": \"vega-lite\"});\n", "</script>" ], "text/plain": [ @@ -433,9 +437,10 @@ "data": { "text/html": [ "\n", - "<p style=\"font-size: smaller\">Data Source: \n", - " <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a> and\n", - " <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>\n", + "<p style=\"font-size: smaller\">Data Sources: \n", + " <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n", + " <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n", + " <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n", "</p>" ], "text/plain": [ @@ -447,23 +452,24 @@ } ], "source": [ - "display(map_of_variable(map_df, 'Confirmed'))\n", + "display(map_of_variable(map_df, 'Confirmed/100k', 'Confirmed'))\n", "display(HTML('''\n", - "<p style=\"font-size: smaller\">Data Source: \n", - " <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a> and\n", - " <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>\n", + "<p style=\"font-size: smaller\">Data Sources: \n", + " <a href=\"https://github.com/CSSEGISandData/COVID-19\">JHU CSSE</a>,\n", + " <a href=\"https://data.worldbank.org/indicator/SP.POP.TOTL\">World Bank</a>,\n", + " <a href=\"https://worldmap.harvard.edu/data/geonode:country_centroids_az8\">Harvard Worldmap</a>\n", "</p>'''))" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "metadata": { "papermill": { - "duration": 0.048886, - "end_time": "2020-03-13T17:58:08.727920", + "duration": 0.083778, + "end_time": "2020-03-15T16:37:30.576656", "exception": false, - "start_time": "2020-03-13T17:58:08.679034", + "start_time": "2020-03-15T16:37:30.492878", "status": "completed" }, "tags": [] @@ -473,10 +479,10 @@ "data": { "text/html": [ "\n", - "<div id=\"altair-viz-01c78ff6476e41d882dd62fc1875817d\"></div>\n", + "<div id=\"altair-viz-6a54aa46a40245ccbf20c582c4265681\"></div>\n", "<script type=\"text/javascript\">\n", " (function(spec, embedOpt){\n", - " const outputDiv = document.getElementById(\"altair-viz-01c78ff6476e41d882dd62fc1875817d\");\n", + " const outputDiv = document.getElementById(\"altair-viz-6a54aa46a40245ccbf20c582c4265681\");\n", " const paths = {\n", " \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n", " \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n", @@ -517,22 +523,25 @@ " .catch(showError)\n", " .then(() => displayChart(vegaEmbed));\n", " }\n", - " })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"bar\", \"encoding\": {\"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}, {\"mark\": {\"type\": \"text\", \"align\": \"left\", \"baseline\": \"middle\", \"dx\": 3}, \"encoding\": {\"text\": {\"type\": \"quantitative\", \"field\": \"Confirmed\", \"format\": \".3\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}], \"data\": {\"name\": \"data-af06d21f07e2679aa76ca6a14f5f1418\"}, \"height\": 900, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-af06d21f07e2679aa76ca6a14f5f1418\": [{\"Country/Region\": \"Australia\", \"Confirmed\": 0.5121563305983519, \"Deaths\": 0.012003663998398872, \"Recovered\": 0.0840256479887921, \"Lat\": -23.1315375, \"Long\": 140.0609875}, {\"Country/Region\": \"Austria\", \"Confirmed\": 3.4135722502347403, \"Deaths\": 0.01130321937163821, \"Recovered\": 0.04521287748655284, \"Lat\": 47.5162, \"Long\": 14.5501}, {\"Country/Region\": \"Bahrain\", \"Confirmed\": 12.424821863098854, \"Deaths\": 0.0, \"Recovered\": 2.230096231838256, \"Lat\": 26.0275, \"Long\": 50.55}, {\"Country/Region\": \"Belgium\", \"Confirmed\": 2.749064355071253, \"Deaths\": 0.026264946067559743, \"Recovered\": 0.008754982022519914, \"Lat\": 50.8333, \"Long\": 4.0}, {\"Country/Region\": \"Canada\", \"Confirmed\": 0.3157140090886777, \"Deaths\": 0.002698410334091263, \"Recovered\": 0.021587282672730104, \"Lat\": 50.795, \"Long\": -93.00628}, {\"Country/Region\": \"Denmark\", \"Confirmed\": 10.6426174560315, \"Deaths\": 0.0, \"Recovered\": 0.01724897480718234, \"Lat\": 59.07825, \"Long\": 1.2949999999999995}, {\"Country/Region\": \"France\", \"Confirmed\": 3.4096043718413016, \"Deaths\": 0.07165543338370511, \"Recovered\": 0.017913858345926282, \"Lat\": 27.399466666666665, \"Long\": -41.22323333333333}, {\"Country/Region\": \"Germany\", \"Confirmed\": 2.5057905104628087, \"Deaths\": 0.0036175993895035743, \"Recovered\": 0.03014666157919645, \"Lat\": 51.0, \"Long\": 9.0}, {\"Country/Region\": \"Iceland\", \"Confirmed\": 29.13110126875845, \"Deaths\": 0.0, \"Recovered\": 0.28282622591027623, \"Lat\": 64.9631, \"Long\": -19.0208}, {\"Country/Region\": \"Israel\", \"Confirmed\": 1.4745942051824668, \"Deaths\": 0.0, \"Recovered\": 0.045025777257479915, \"Lat\": 31.0, \"Long\": 35.0}, {\"Country/Region\": \"Italy\", \"Confirmed\": 20.62176968839136, \"Deaths\": 1.368496511980393, \"Recovered\": 1.7292368259002542, \"Lat\": 43.0, \"Long\": 12.0}, {\"Country/Region\": \"Japan\", \"Confirmed\": 0.5050221648616801, \"Deaths\": 0.012645312422201693, \"Recovered\": 0.09325917911373748, \"Lat\": 36.0, \"Long\": 138.0}, {\"Country/Region\": \"Malaysia\", \"Confirmed\": 0.4725870190495387, \"Deaths\": 0.0, \"Recovered\": 0.08246484896166446, \"Lat\": 2.5, \"Long\": 112.5}, {\"Country/Region\": \"Netherlands\", \"Confirmed\": 2.919154452694232, \"Deaths\": 0.02901743988761661, \"Recovered\": 0.0, \"Lat\": 52.1326, \"Long\": 5.2913}, {\"Country/Region\": \"Norway\", \"Confirmed\": 13.209552425740487, \"Deaths\": 0.0, \"Recovered\": 0.018817026247493568, \"Lat\": 60.472, \"Long\": 8.4689}, {\"Country/Region\": \"Qatar\", \"Confirmed\": 9.418778672002537, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Lat\": 25.3548, \"Long\": 51.1839}, {\"Country/Region\": \"Singapore\", \"Confirmed\": 3.156769426014192, \"Deaths\": 0.0, \"Recovered\": 1.7025273308840587, \"Lat\": 1.2833, \"Long\": 103.8333}, {\"Country/Region\": \"Spain\", \"Confirmed\": 4.873324698324187, \"Deaths\": 0.11771315696435232, \"Recovered\": 0.3916637768086632, \"Lat\": 40.0, \"Long\": -4.0}, {\"Country/Region\": \"Sweden\", \"Confirmed\": 5.882251851706369, \"Deaths\": 0.009820119952765223, \"Recovered\": 0.009820119952765223, \"Lat\": 63.0, \"Long\": 16.0}, {\"Country/Region\": \"Switzerland\", \"Confirmed\": 7.655688464204314, \"Deaths\": 0.04696741389082401, \"Recovered\": 0.04696741389082401, \"Lat\": 46.8182, \"Long\": 8.2275}, {\"Country/Region\": \"US\", \"Confirmed\": 0.508302424745612, \"Deaths\": 0.012226155736515023, \"Recovered\": 0.0036678467209545055, \"Lat\": 38.88347448559672, \"Long\": -94.14907777777768}]}}, {\"mode\": \"vega-lite\"});\n", + " })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"bar\", \"encoding\": {\"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}], \"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}, {\"mark\": {\"type\": \"text\", \"align\": \"left\", \"baseline\": \"middle\", \"dx\": 3}, \"encoding\": {\"text\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\", \"format\": \".3\"}, \"tooltip\": [{\"type\": \"nominal\", \"field\": \"Country/Region\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed\"}, {\"type\": \"quantitative\", \"field\": \"Deaths\"}, {\"type\": \"quantitative\", \"field\": \"Recovered\"}, {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, {\"type\": \"quantitative\", \"field\": \"Deaths/100k\"}, {\"type\": \"quantitative\", \"field\": \"Recovered/100k\"}], \"x\": {\"type\": \"quantitative\", \"field\": \"Confirmed/100k\"}, \"y\": {\"type\": \"nominal\", \"field\": \"Country/Region\", \"sort\": \"-x\"}}}], \"data\": {\"name\": \"data-95ea86d40d32f37e513861317827f4db\"}, \"height\": 900, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-95ea86d40d32f37e513861317827f4db\": [{\"Country/Region\": \"Australia\", \"Confirmed/100k\": 0.8002442665599246, \"Deaths/100k\": 0.012003663998398872, \"Recovered/100k\": 0.09202809065439137, \"Confirmed\": 200.0, \"Deaths\": 3.0, \"Recovered\": 23.0, \"Long\": 134.49100008, \"Lat\": -25.73288704}, {\"Country/Region\": \"Austria\", \"Confirmed/100k\": 5.696822563305657, \"Deaths/100k\": 0.01130321937163821, \"Recovered/100k\": 0.06781931622982926, \"Confirmed\": 504.0, \"Deaths\": 1.0, \"Recovered\": 6.0, \"Long\": 14.1264761, \"Lat\": 47.58549439}, {\"Country/Region\": \"Bahrain\", \"Confirmed/100k\": 12.042519651926579, \"Deaths/100k\": 0.0, \"Recovered/100k\": 2.8035495485966644, \"Confirmed\": 189.0, \"Deaths\": 0.0, \"Recovered\": 44.0, \"Long\": 50.54196932, \"Lat\": 26.04205135}, {\"Country/Region\": \"Belgium\", \"Confirmed/100k\": 4.894034950588631, \"Deaths/100k\": 0.026264946067559743, \"Recovered/100k\": 0.008754982022519914, \"Confirmed\": 559.0, \"Deaths\": 3.0, \"Recovered\": 1.0, \"Long\": 4.64065114, \"Lat\": 50.63981576}, {\"Country/Region\": \"Brazil\", \"Confirmed/100k\": 0.07208692453324421, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 151.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": -53.09783113, \"Lat\": -10.78777702}, {\"Country/Region\": \"Canada\", \"Confirmed/100k\": 0.5207931944796137, \"Deaths/100k\": 0.002698410334091263, \"Recovered/100k\": 0.021587282672730104, \"Confirmed\": 193.0, \"Deaths\": 1.0, \"Recovered\": 8.0, \"Long\": -98.30777028, \"Lat\": 61.36206324}, {\"Country/Region\": \"China\", \"Confirmed/100k\": 5.811966425653213, \"Deaths/100k\": 0.22832853460469724, \"Recovered/100k\": 4.609364341975832, \"Confirmed\": 80945.0, \"Deaths\": 3180.0, \"Recovered\": 64196.0, \"Long\": 103.81907349, \"Lat\": 36.56176546}, {\"Country/Region\": \"Czechia\", \"Confirmed/100k\": 1.3269720239476102, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 141.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 15.31240163, \"Lat\": 49.73341233}, {\"Country/Region\": \"Denmark\", \"Confirmed/100k\": 13.868175744974597, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.01724897480718234, \"Confirmed\": 804.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 10.02800992, \"Lat\": 55.98125296}, {\"Country/Region\": \"Finland\", \"Confirmed/100k\": 2.808963311314685, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018122343943965717, \"Confirmed\": 155.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 26.2746656, \"Lat\": 64.49884603}, {\"Country/Region\": \"France\", \"Confirmed/100k\": 5.474176546209304, \"Deaths/100k\": 0.117932900777348, \"Recovered/100k\": 0.017913858345926282, \"Confirmed\": 3667.0, \"Deaths\": 79.0, \"Recovered\": 12.0, \"Long\": -2.76172945, \"Lat\": 42.17344011}, {\"Country/Region\": \"Germany\", \"Confirmed/100k\": 4.431559252141878, \"Deaths/100k\": 0.008441065242175007, \"Recovered/100k\": 0.055469857305721466, \"Confirmed\": 3675.0, \"Deaths\": 7.0, \"Recovered\": 46.0, \"Long\": 10.38578051, \"Lat\": 51.10698181}, {\"Country/Region\": \"Greece\", \"Confirmed/100k\": 1.771121179365357, \"Deaths/100k\": 0.009321690417712405, \"Recovered/100k\": 0.0, \"Confirmed\": 190.0, \"Deaths\": 1.0, \"Recovered\": 0.0, \"Long\": 22.95555794, \"Lat\": 39.07469623}, {\"Country/Region\": \"Iceland\", \"Confirmed/100k\": 37.898714271977006, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.28282622591027623, \"Confirmed\": 134.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -18.57396167, \"Lat\": 64.99575386}, {\"Country/Region\": \"Iran\", \"Confirmed/100k\": 13.892374852703725, \"Deaths/100k\": 0.6283597918241565, \"Recovered/100k\": 3.6173475175246668, \"Confirmed\": 11364.0, \"Deaths\": 514.0, \"Recovered\": 2959.0, \"Long\": 54.27407004, \"Lat\": 32.57503292}, {\"Country/Region\": \"Iraq\", \"Confirmed/100k\": 0.26279089130344285, \"Deaths/100k\": 0.023417010116148367, \"Recovered/100k\": 0.06244536030972898, \"Confirmed\": 101.0, \"Deaths\": 9.0, \"Recovered\": 24.0, \"Long\": 43.74353149, \"Lat\": 33.03970582}, {\"Country/Region\": \"Israel\", \"Confirmed/100k\": 1.8122875346135665, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.045025777257479915, \"Confirmed\": 161.0, \"Deaths\": 0.0, \"Recovered\": 4.0, \"Long\": 35.00444693, \"Lat\": 31.46110101}, {\"Country/Region\": \"Italy\", \"Confirmed/100k\": 29.22327497167319, \"Deaths/100k\": 2.0949414560667194, \"Recovered/100k\": 2.3812170262875267, \"Confirmed\": 17660.0, \"Deaths\": 1266.0, \"Recovered\": 1439.0, \"Long\": 12.07001339, \"Lat\": 42.79662641}, {\"Country/Region\": \"Japan\", \"Confirmed/100k\": 0.5540227504977115, \"Deaths/100k\": 0.01501630850136451, \"Recovered/100k\": 0.09325917911373748, \"Confirmed\": 701.0, \"Deaths\": 19.0, \"Recovered\": 118.0, \"Long\": 138.03089558, \"Lat\": 37.59230135}, {\"Country/Region\": \"Korea, South\", \"Confirmed/100k\": 15.452620201979823, \"Deaths/100k\": 0.12781964322981182, \"Recovered/100k\": 0.9876972431394551, \"Confirmed\": 7979.0, \"Deaths\": 66.0, \"Recovered\": 510.0, \"Long\": 127.83916086, \"Lat\": 36.38523983}, {\"Country/Region\": \"Malaysia\", \"Confirmed/100k\": 0.6248298171326115, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.08246484896166446, \"Confirmed\": 197.0, \"Deaths\": 0.0, \"Recovered\": 26.0, \"Long\": 109.69762284, \"Lat\": 3.78986846}, {\"Country/Region\": \"Netherlands\", \"Confirmed/100k\": 4.666004333928752, \"Deaths/100k\": 0.05803487977523322, \"Recovered/100k\": 0.0, \"Confirmed\": 804.0, \"Deaths\": 10.0, \"Recovered\": 0.0, \"Long\": 5.28144793, \"Lat\": 52.1007899}, {\"Country/Region\": \"Norway\", \"Confirmed/100k\": 18.741758142503603, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.018817026247493568, \"Confirmed\": 996.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": 15.34834656, \"Lat\": 68.75015572}, {\"Country/Region\": \"Portugal\", \"Confirmed/100k\": 1.0893074552785798, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.009725959422130177, \"Confirmed\": 112.0, \"Deaths\": 0.0, \"Recovered\": 1.0, \"Long\": -8.50104361, \"Lat\": 39.59550671}, {\"Country/Region\": \"Qatar\", \"Confirmed/100k\": 11.503851813132869, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 320.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 51.18479632, \"Lat\": 25.30601188}, {\"Country/Region\": \"Singapore\", \"Confirmed/100k\": 3.5469319393417886, \"Deaths/100k\": 0.0, \"Recovered/100k\": 1.7202619905807677, \"Confirmed\": 200.0, \"Deaths\": 0.0, \"Recovered\": 97.0, \"Long\": 103.81725592, \"Lat\": 1.35876087}, {\"Country/Region\": \"Slovenia\", \"Confirmed/100k\": 6.820252958828889, \"Deaths/100k\": 0.0, \"Recovered/100k\": 0.0, \"Confirmed\": 141.0, \"Deaths\": 0.0, \"Recovered\": 0.0, \"Long\": 14.80444238, \"Lat\": 46.11554772}, {\"Country/Region\": \"Spain\", \"Confirmed/100k\": 11.197731586136207, \"Deaths/100k\": 0.28465181593197925, \"Recovered/100k\": 0.413066168984, \"Confirmed\": 5232.0, \"Deaths\": 133.0, \"Recovered\": 193.0, \"Long\": -3.64755047, \"Lat\": 40.24448698}, {\"Country/Region\": \"Sweden\", \"Confirmed/100k\": 7.993577641550892, \"Deaths/100k\": 0.009820119952765223, \"Recovered/100k\": 0.009820119952765223, \"Confirmed\": 814.0, \"Deaths\": 1.0, \"Recovered\": 1.0, \"Long\": 16.74558049, \"Lat\": 62.77966519}, {\"Country/Region\": \"Switzerland\", \"Confirmed/100k\": 13.373971105412135, \"Deaths/100k\": 0.12916038819976602, \"Recovered/100k\": 0.04696741389082401, \"Confirmed\": 1139.0, \"Deaths\": 11.0, \"Recovered\": 4.0, \"Long\": 8.20867471, \"Lat\": 46.79785878}, {\"Country/Region\": \"US\", \"Confirmed/100k\": 0.6660198337466559, \"Deaths/100k\": 0.01436573299040515, \"Recovered/100k\": 0.0036678467209545055, \"Confirmed\": 2179.0, \"Deaths\": 47.0, \"Recovered\": 12.0, \"Long\": -112.4616737, \"Lat\": 45.6795472}, {\"Country/Region\": \"United Kingdom\", \"Confirmed/100k\": 1.2047107166959414, \"Deaths/100k\": 0.012032067083105532, \"Recovered/100k\": 0.028576159322375637, \"Confirmed\": 801.0, \"Deaths\": 8.0, \"Recovered\": 19.0, \"Long\": -2.86563164, \"Lat\": 54.12387156}]}}, {\"mode\": \"vega-lite\"});\n", "</script>" ], "text/plain": [ "alt.LayerChart(...)" ] }, - "execution_count": 15, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bars = alt.Chart(map_df).mark_bar().encode(\n", - " x='Confirmed:Q',\n", - " y=alt.Y(\"Country/Region:N\", sort='-x')\n", + " x='Confirmed/100k:Q',\n", + " y=alt.Y(\"Country/Region:N\", sort='-x'),\n", + " tooltip=[\"Country/Region:N\", \n", + " \"Confirmed:Q\", \"Deaths:Q\", \"Recovered:Q\",\n", + " \"Confirmed/100k:Q\", \"Deaths/100k:Q\", \"Recovered/100k:Q\"]\n", ")\n", "\n", "text = bars.mark_text(\n", @@ -540,7 +549,7 @@ " baseline='middle',\n", " dx=3 # Nudges text to right so it doesn't appear on top of the bar\n", ").encode(\n", - " text=alt.Text('Confirmed:Q', format=\".3\")\n", + " text=alt.Text('Confirmed/100k:Q', format=\".3\")\n", ")\n", "\n", "(bars + text).properties(height=900)" @@ -566,19 +575,20 @@ "version": "3.7.6" }, "papermill": { - "duration": 2.508313, - "end_time": "2020-03-13T17:58:09.048792", + "duration": 2.502575, + "end_time": "2020-03-15T16:37:30.908644", "environment_variables": {}, "exception": null, - "input_path": "/tmp/ajs106te/notebooks/Dashboard.ipynb", + "input_path": "notebooks/Dashboard.ipynb", "output_path": "runs/Dashboard.run.ipynb", "parameters": { - "PAPERMILL_INPUT_PATH": "/tmp/ajs106te/notebooks/Dashboard.ipynb", + "PAPERMILL_INPUT_PATH": "notebooks/Dashboard.ipynb", "PAPERMILL_OUTPUT_PATH": "runs/Dashboard.run.ipynb", - "rates_folder": "/tmp/ajs106te/data/covid-19_rates", - "ts_folder": "/tmp/ajs106te/data/covid-19_jhu-csse" + "geodata_path": "./data/geodata/geo_data.csv", + "rates_folder": "./data/covid-19_rates/", + "ts_folder": "./data/covid-19_jhu-csse/" }, - "start_time": "2020-03-13T17:58:06.540479", + "start_time": "2020-03-15T16:37:28.406069", "version": "1.1.0" } },