A collection of Philippine data for COVID-19 purposes. It also includes python module to retrieve certain data such as confirmed cases and others. Here is some basic interactive Philippine covid-19 plots built using bokeh. There is also a racing bar chart for confirmed cases on provinces and Metro Manila cities and town.
Folder: doc\Department of Health
This file contains confirmed cases based from "DOH COVID Data Drop_ yyyymmdd - 04 Case Information.csv" file. There are added columns in this file for covidphi module purposes. More DOH data can be found at this google page. There is an image that needs to be opened to get the link to the readme file where the link to the excel and csv files is written.
DOH address: https://www.doh.gov.ph/
Folder: doc\Philippine Standard Geographic Code
This file contains location code, name, geographic level [Region, Province, City and others], population and others. You can download the latest official data in excel format in PSA (Philippine Statistics Authority) site. You can also find the last 2 updates in excel format in this repo at doc/Philippine Standard Geographic Code/Rererences
PSA address: https://psa.gov.ph/classification/psgc/
Folder: doc\Others
This file contains basic geographic info such as island group [Luzon, Visaya, Mindanao], region, province, city, municipality, latitude/longitude of people with confirmed cases. The latitude/longitude data are taken from Google Maps Platform specifically the Geocoding API. Together with "DOH COVID Data Drop Case Information.csv" this file can be used to plot location on the map of confirmed cases for up to city and municipality level. I will try to update this daily when there is new confirmed cases reports from DOH.
You may download python at https://www.python.org/downloads/. Latest version like 3.8.2 is better.
a. Press the button "Clone or Download" located at the top right of this page.
b. Select DOWNLOAD ZIP.
c. Uncompressed it on your computer.
d. Navigate to src folder and run/experiment with sample.py.
e. You can also place your python script in src folder.
Folder: src
This module is using the data file "DOH COVID Data Drop Case Information.csv" and "PSGC Publication Dec2019.csv" to return info based on the methods called. covid19phi class and methods info can be found here.
import covidphi
covid = covidphi.DangerousCovid()
cases = covid.cases(days=7)
print('Daily Confirmed cases in the last 7 days:')
for c in cases:
print(f'{c["Date"]}, {c["Count"]}')
Daily Confirmed cases in the last 7 days:
2020-05-28, 539
2020-05-27, 380
2020-05-26, 350
2020-05-25, 284
2020-05-24, 258
2020-05-23, 180
2020-05-22, 163
import covidphi
covid = covidphi.DangerousCovid()
print(f'Cumulative confirmed cases:')
cc = covid.cases(province=None, days=None, cumulative=True)
for c in cc:
print(f'{c["Date"]}, {c["Count"]}')
Cumulative confirmed cases:
2020-05-28, 15588
2020-05-27, 15049
2020-05-26, 14669
2020-05-25, 14319
2020-05-24, 14035
2020-05-23, 13777
2020-05-22, 13597
2020-05-21, 13434
2020-05-20, 13221
2020-05-19, 12942
...
import covidphi
covid = covidphi.DangerousCovid()
print('Daily Recoveries:')
rec = covid.recoveries(region=None, province=None, days=None, cumulative=False)
for r in rec:
print(f'{r["Date"]}, {r["Count"]}')
Daily Recoveries:
2020-05-28, 92
2020-05-27, 94
2020-05-26, 89
2020-05-25, 74
2020-05-24, 72
2020-05-23, 85
2020-05-22, 92
2020-05-21, 68
2020-05-20, 89
2020-05-19, 114
...
import covidphi
covid = covidphi.DangerousCovid()
print('Daily Deaths:')
dea = covid.deaths(region=None, province=None, days=None, cumulative=False)
for d in dea:
print(f'{d["Date"]}, {d["Count"]}')
Daily Deaths:
2020-05-24, 5
2020-05-23, 6
2020-05-22, 11
2020-05-21, 4
2020-05-20, 5
2020-05-19, 6
2020-05-18, 7
...
import covidphi
covid = covidphi.DangerousCovid()
days, prov = 14, 'Bulacan'
print(f'Confirmed cases at {prov} in the last {days} days:')
cc = covid.cases(province=prov, days=days)
for c in cc:
print(f'{c["Date"]}, {c["Count"]}')
Confirmed cases at Bulacan in the last 14 days:
2020-05-24, 2
2020-05-23, 3
2020-05-22, 0
2020-05-21, 0
2020-05-20, 1
2020-05-19, 4
2020-05-18, 0
2020-05-17, 1
2020-05-16, 2
2020-05-15, 2
2020-05-14, 3
2020-05-13, 0
2020-05-12, 1
2020-05-11, 4
import covidphi
covid = covidphi.DangerousCovid()
days, prov = 14, 'Bulacan'
print(f'Cumulative confirmed cases at {prov} in the last {days} days:')
cc = covid.cases(province=prov, days=days, cumulative=True)
for c in cc:
print(f'{c["Date"]}, {c["Count"]}')
Cumulative confirmed cases at Bulacan in the last 14 days:
2020-05-24, 161
2020-05-23, 159
2020-05-22, 156
2020-05-21, 156
2020-05-20, 156
2020-05-19, 155
2020-05-18, 151
2020-05-17, 151
2020-05-16, 150
2020-05-15, 148
2020-05-14, 146
2020-05-13, 143
2020-05-12, 143
2020-05-11, 142
import covidphi
covid = covidphi.DangerousCovid()
print('Cumulative deaths in Philippines:')
death = covid.deaths(province=None, days=None, cumulative=True)
for d in death:
print(f'{d["Date"]}, {d["Count"]}')
Cumulative deaths in Philippines:
2020-05-04, 623
2020-05-03, 607
2020-05-02, 603
2020-05-01, 579
2020-04-30, 568
2020-04-29, 558
2020-04-28, 530
...
import covidphi
covid = covidphi.DangerousCovid()
print(f'Patients info with geo location:')
persons = covid.patients(date=True, cityortown=False, province=False, geo=True)
for p in persons:
print(p)
Patients info with geo location:
{'Patient': 'C404174', 'Date': '2020-01-30', 'Latitude': 9.3129297, 'Longitude': 123.3021299}
{'Patient': 'C462688', 'Date': '2020-02-03', 'Latitude': 9.3129297, 'Longitude': 123.3021299}
{'Patient': 'C387710', 'Date': '2020-02-05', 'Latitude': 9.573142899999999, 'Longitude': 123.7629465}
{'Patient': 'C377460', 'Date': '2020-03-06', 'Latitude': 14.5176184, 'Longitude': 121.0508645}
{'Patient': 'C498051', 'Date': '2020-03-06', 'Latitude': 14.5864844, 'Longitude': 121.114876}
{'Patient': 'C130591', 'Date': '2020-03-07', 'Latitude': 14.5864844, 'Longitude': 121.114876}
{'Patient': 'C178743', 'Date': '2020-03-08', 'Latitude': 14.554729, 'Longitude': 121.0244452}
...
import covidphi
covid = covidphi.DangerousCovid()
print(f'Cumulative active confirmed cases in Philippines:')
print('Active means excluding deaths and recoveries.')
cc = covid.cases(province=None, days=None, cumulative=True, active=True)
for c in cc:
print(f'{c["Date"]}, {c["Count"]}')
Cumulative active confirmed cases in Philippines:
Active means excluding deaths and recoveries.
2020-05-05, 7639
2020-05-04, 7443
2020-05-03, 7182
2020-05-02, 6891
2020-05-01, 6735
2020-04-30, 6456
2020-04-29, 6186
...
import covidphi
covid = covidphi.DangerousCovid()
print(f'Cumulative active confirmed cases in Metro Manila or NCR in the last 7 days:')
print('Active means excluding deaths and recoveries.')
region_name = 'National Capital Region (NCR)'
cc = covid.cases(region=region_name, province=None, days=7, cumulative=True, active=True)
for c in cc:
print(c)
Cumulative active confirmed cases in Metro Manila or NCR in the last 7 days:
Active means excluding deaths and recoveries.
{'Date': '2020-05-04', 'Region': 'National Capital Region (NCR)', 'Count': 4892}
{'Date': '2020-05-03', 'Region': 'National Capital Region (NCR)', 'Count': 4770}
{'Date': '2020-05-02', 'Region': 'National Capital Region (NCR)', 'Count': 4653}
{'Date': '2020-05-01', 'Region': 'National Capital Region (NCR)', 'Count': 4604}
{'Date': '2020-04-30', 'Region': 'National Capital Region (NCR)', 'Count': 4475}
{'Date': '2020-04-29', 'Region': 'National Capital Region (NCR)', 'Count': 4325}
{'Date': '2020-04-28', 'Region': 'National Capital Region (NCR)', 'Count': 4131}
import covidphi
covid = covidphi.DangerousCovid()
date_today = datetime.today().strftime('%Y-%m-%d')
print(f'Provinces without COVID19 cases as of {date_today}:')
for p in covid.provinces(covid=False):
print(p)
Provinces without COVID19 cases as of 2020-05-20:
Agusan Del Sur
Apayao
Aurora
Basilan
Batanes
Biliran
Dinagat Islands
Eastern Samar
Kalinga
Masbate
Mountain Province
Quirino
Siquijor
Southern Leyte
Surigao Del Sur
Tawi-Tawi
Zamboanga Del Norte
Zamboanga Sibugay
import covidphi
covid = covidphi.DangerousCovid()
print('Regions:')
regions = covid.regions()
for r in regions:
print(r)
Regions:
Bangsamoro Autonomous Region in Muslim Mindanao (BARMM)
Cordillera Administrative Region (CAR)
MIMAROPA Region
National Capital Region (NCR)
Region I (Ilocos Region)
Region II (Cagayan Valley)
Region III (Central Luzon)
Region IV-A (CALABARZON)
Region IX (Zamboanga Peninsula)
Region V (Bicol Region)
Region VI (Western Visayas)
Region VII (Central Visayas)
Region VIII (Eastern Visayas)
Region X (Northern Mindanao)
Region XI (Davao Region)
Region XII (SOCCSKSARGEN)
Region XIII (Caraga)
import covidphi
covid = covidphi.DangerousCovid()
all_data = covid.data() # a list of dict
covid.save_to_file('mycopy.csv', all_data)
import covidphi
covid = covidphi.DangerousCovid()
ct = covid.cities(covid=True)
print('Cities with confirmed cases:')
for c in ct:
print(c)
Cities with confirmed cases:
Batangas City
City of Alaminos
City of Angeles
City of Antipolo
City of Bacolod
City of Bacoor
City of Baguio
...
import covidphi
covid = covidphi.DangerousCovid()
ct = covid.cities(covid=False)
print('Cities without confirmed cases:')
for c in ct:
print(c)
Cities without confirmed cases:
City of Bago
City of Bayawan
City of Baybay
City of Bayugan
City of Bislig
City of Bogo
City of Borongan
City of Cabadbaran
...
import covidphi
covid = covidphi.DangerousCovid()
print('Cumulative confirmed cases in Quezon city in the last 14 days:')
cc = covid.cases(city='quezon city', days=14, cumulative=True)
for c in cc:
print(f'{c["Date"]}, {c["Count"]}')
Cumulative confirmed cases in Quezon city in the last 14 days:
2020-05-04, 1367
2020-05-03, 1351
2020-05-02, 1341
2020-05-01, 1340
2020-04-30, 1326
2020-04-29, 1308
2020-04-28, 1280
2020-04-27, 1245
2020-04-26, 1217
2020-04-25, 1199
2020-04-24, 1183
2020-04-23, 1167
2020-04-22, 1147
2020-04-21, 1138
See sample.py in src folder for more examples.
Folder: src
This file contains example codes on how to use the module covidphi.
- Department of Health
https://www.doh.gov.ph/ - Philippine Statistics Authority
https://psa.gov.ph/classification/psgc/ - Bokeh
https://bokeh.org/ - Flourish Studio
https://flourish.studio/