Covid-19 Data

ee201su2021week6covid19

Contents

Covid-19 Data

WHO Coronavirus (COVID-19) Dashboard https://covid19.who.int/info/

Daily cases and deaths by date reported to WHO Download link: https://covid19.who.int/WHO-COVID-19-global-data.csv

Short field name Type Description
Date_reported Date Date of reporting to WHO
Country_code String ISO Alpha-2 country code
Country String Country, territory, area
WHO_region String WHO regional offices: WHO Member States are grouped into six WHO regions -- Regional Office for Africa (AFRO), Regional Office for the Americas (AMRO), Regional Office for South-East Asia (SEARO), Regional Office for Europe (EURO), Regional Office for the Eastern Mediterranean (EMRO), and Regional Office for the Western Pacific (WPRO).
New_cases Integer New confirmed cases. Calculated by subtracting previous cumulative case count from current cumulative cases count.*
Cumulative_cases Integer Cumulative confirmed cases reported to WHO to date.
New_deaths Integer New confirmed deaths. Calculated by subtracting previous cumulative deaths from current cumulative deaths.*
Cumulative_deaths Integer Cumulative confirmed deaths reported to WHO to date.

*Users should note that, in addition to capturing new cases and deaths reported on any given day, updates are made retrospectively to correct counts on previous days as needed based on subsequent information received. See "Daily aggregate case and death count data" above for further details on the calculation of new cases/deaths.

clear;close all;clc;

Load Data

% the file contains mixxed data and loaded as a table
% convert to cell
covid19=webread('https://covid19.who.int/WHO-COVID-19-global-data.csv');
covid19=table2cell(covid19);

Get data

% find the indices corresponding to a specific coutry code
cc='SA';

% returns a logical array matching cc with the cell array containing the
% country codes
ind=find(ismember(covid19(:,2),cc));

% you may also use strcmp to compare the string of country codes with cc
ind=find(strcmp(covid19(:,2),cc));

% the data are cell arrays and need to be converted to mat
% for example, cases_new is a cell array
%   either use cell2mat(covid19{ind,5})
%   or [covid19{ind,5}]' the transpose is to convert into a column
t=[covid19{ind,1}]';
cases_new=[covid19{ind,5}]';
cases_cum=[covid19{ind,6}]';
deaths_new=[covid19{ind,7}]';
deaths_cum=[covid19{ind,8}]';

Plot cases data

% find the maximum number of new deaths
[cases_max,cind_max]=max(cases_new);

% plot the new cases and 7-day moving average of new cases
cases_7d_avg=smooth(cases_new,7);
subplot(2,1,1);grid on;
yyaxis left;
plot(t,cases_new,'g-',t(cind_max),cases_max,'ko',t,cases_7d_avg,'b-');
ylabel('New Cases');

% plot the cumulative cases
yyaxis right;
plot(t,cases_cum);
ylabel('Cumulative Cases');

% plot format and labeling
ax=gca;ax.YAxis(2).Exponent=0;
lgd_max=['Maximum Cases ',num2str(cases_max),' on ',datestr(t(cind_max))];
lgd_cum=['Cumulative Cases ',num2str(cases_cum(end))];
lgd={'New Cases',lgd_max,'New Cases 7-day moving avg',lgd_cum};
legend(lgd);
legend('boxoff');
legend('location','nw');
title([cc,' Covid-19 Cases New and Cumulative until ',datestr(t(end))]);
xlabel('Date');

Plot death data

% find the maximum number of new deaths
[deaths_max,dind_max]=max(deaths_new);

% plot the new deaths and 7-day moving average of new deaths
deaths_7d_avg=smooth(deaths_new,7);
subplot(2,1,2);grid on;
yyaxis left;
plot(t,deaths_new,'g-',t(dind_max),deaths_max,'ko',t,deaths_7d_avg,'b-');
ylabel('New Deaths');

% plot the cumulative deaths
yyaxis right;
plot(t,deaths_cum);
ylabel('Cumulative Deaths');

% plot format and labeling
ax=gca;ax.YAxis(2).Exponent=0;
lgd_max=['Maximum Deaths ',num2str(deaths_max),' on ',datestr(t(dind_max))];
lgd_cum=['Cumulative Deaths ',num2str(deaths_cum(end))];
lgd={'New Deaths',lgd_max,'New Deaths 7-day moving avg',lgd_cum};
legend(lgd);
legend('boxoff');
legend('location','nw');
title([cc,' Covid-19 Deaths New and Cumulative until ',datestr(t(end))]);
xlabel('Date');

Last Update
7/25/2021 11:26:26 PM