-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule_info.txt
157 lines (147 loc) · 7.1 KB
/
module_info.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
NAME
covidphi
DESCRIPTION
Filename:
covidphi.py
Description:
A module that can be used to return specific Philippine COVID info. The info
are based from DOH (Department of Health) at https://www.doh.gov.ph/.
Database source:
DOH:
https://drive.google.com/drive/folders/10VkiUA8x7TS2jkibhSZK1gmWxFM-EoZP
On this Repository:
"doc/Department of Health/DOH COVID Data Drop Case Information.csv"
Example:
Print a list of dict in the last 7 days confirmed cases in PHI.
import covidphi
covid = covidphi.DangerousCovid()
cases = covid.cases(days=7)
print(cases)
print('Confirmed cases in the last 7 days:')
for c in cases:
print(f'{c["Date"]}, {c["Count"]}')
See sample.py for more examples.
CLASSES
builtins.object
DangerousCovid
class DangerousCovid(builtins.object)
| DangerousCovid(doh_file='../doc/Department of Health/DOH COVID Data Drop Case Information.csv', address_file='../doc/Others/address reference.csv', psgc_file='../doc/Philippine Standard Geographic Code/PSGC Publication Dec2019.csv') |
| Methods defined here:
|
| __init__(self, doh_file='../doc/Department of Health/DOH COVID Data Drop Case Information.csv', address_file='../doc/Others/address reference.csv', psgc_file='../doc/Philippine Standard Geographic Code/PSGC Publication Dec2019.csv') | Initialize self. See help(type(self)) for accurate signature.
|
| cases(self, region=None, province=None, city=None, municipality=None, days=None, cumulative=False, active=False) | Returns a list of dict for confirmed cases. It can be filtered by
| region, province, city, last days, cumulative and whether or not it is active.
| If region, province and city name filters are all defined, only the region
| will be used. If province and city are defined, only the province is used.
|
| :param region: region name
| :param province: province name
| :param city: city name
| :param municipality: municipality name
| :param days: number of days from latest
| :param cumulative: a total count which includes the previous counts
| :param active: if true it will extract all cases except deaths and recoveries
| :return: a list of dict
|
| cities(self, covid=True)
| Returns a list of cities depending on the parameter covid. If covid
| is true then cities with covid will be returned, otherwise cities
| without covid cases will be returned. Default covid is true.
|
| :covid: if true it will return cities with covid else without covid
| :return: a list of cities
|
| data(self)
| Returns all data in the case information database
| :return: a list of dict, where the key in dict is the header
|
| deaths(self, region=None, province=None, days=None, cumulative=False)
| :param region: region name
| :param province: province name
| :param days: number of days from latest
| :param cumulative: a total count which includes the previous counts
| :return: a list of dict
|
| municipalities(self, covid=True)
| Returns a list of municipalities depending on the parameter covid. If covid
| is true then municipalities with covid will be returned, otherwise municipalities
| without covid cases will be returned. Default covid is true.
|
| :covid: if true it will return municipalities with covid else without covid
| :return: a list of municipalities
|
| patients(self, date=True, cityortown=False, province=False, geo=False)
| Returns patient info including address and geo data i.e latitude/longitude.
|
| :param date: if true, the date publicly announced as confirmed case will be extracted
| :param cityortown: if true, the city or municipality of patient will be extracted
| :param province: if true, the province of patient will be extracted
| :param geo: if true, the latitude and longitude of patient will be extracted
| :return: a list of dict [{'Patient': code, 'date: yyy-mm-dd ...}, {}, ...]
|
| provinces(self, covid=True)
| Returns a list of provinces depending on the parameter covid. If covid
| is true then provinces with covid will be extracted, otherwise provinces
| without covid cases will be extracted. Default covid is true.
|
| :covid: if true it will return provinces with covid else without covid
| :return: a list of provinces
|
| recoveries(self, region=None, province=None, days=None, cumulative=False)
| :param region: region name
| :param province: province name
| :param days: number of days from latest
| :param cumulative: a total count which includes the previous counts
| :return: a list of dict
|
| regions(self)
| Returns a list of all regions in Philippines.
|
| :return: a list of regions
|
| repatriate(self, cumulative=False)
| Returns a list of dict of confirmed cases that has repatriate
| value in DOH RegionRes column. These patients are sent back to
| their home country.
|
| :param cumulative: If true, cumulative sum from daily results will
| be returned otherwise daily result count will be returned.
| :return: A list of dict [{'Date': '2020-05-20', 'Count': 24}, {..} ..]
|
| unique_date(self, header='DateRepConf')
| When calculating confirmed cases, use the DateRepConf column. For
| recoveries use the DateRepRem. For deaths use DateRepRem too.
|
| :header: name of column with dates to use, default is confirmed date
| :return: a list of unique string date ordered in ascending order
|
| validation(self, cumulative=False)
| Returns a list of dict of confirmed cases that are still for
| validation. This is an entry in DOH RegionRes column where
| the value is empty.
|
| :param cumulative: If true, cumulative sum from daily results will
| be returned otherwise daily result count will be returned.
| :return: A list of dict [{'Date': '2020-05-20', 'Count': 24}, {..} ..]
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| save_to_file(output_file, data)
| Save data to file in csv format.
|
| :param output_file: a csv filename to save the data
| :param data: a list of dict
| :return: None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
DATA
version = 'covidphi v0.16'