Skip to content

Commit 9b7808d

Browse files
author
ExpDev07
committed
updated doc
1 parent e2b6630 commit 9b7808d

File tree

3 files changed

+75
-18
lines changed

3 files changed

+75
-18
lines changed

README.md

Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,95 @@
1212

1313
## Endpoints
1414

15-
All requests must be made to the base url: ``https://coronavirus-tracker-api.herokuapp.com`` (e.g: https://coronavirus-tracker-api.herokuapp.com/all). You can try them out in your browser to further inspect responses.
15+
All requests must be made to the base url: ``https://coronavirus-tracker-api.herokuapp.com/v2/`` (e.g: https://coronavirus-tracker-api.herokuapp.com/v2/locations). You can try them out in your browser to further inspect responses.
1616

17-
Getting confirmed cases, deaths, and recoveries:
17+
### Getting latest amount of total confirmed cases, deaths, and recoveries.
1818
```http
19-
GET /all
19+
GET /v2/latest
2020
```
2121
```json
22-
{ "latest": { ... }, "confirmed": { ... }, "deaths": { ... }, "recovered": { ... } }
22+
{
23+
"latest": {
24+
"confirmed": 197146,
25+
"deaths": 7905,
26+
"recovered": 80840
27+
}
28+
}
2329
```
2430

25-
Getting just confirmed:
31+
### Getting all locations.
2632
```http
27-
GET /confirmed
33+
GET /v2/locations
2834
```
2935
```json
3036
{
31-
"latest": 42767,
32-
"locations": [ ... ],
33-
"last_updated": "2020-03-07T18:08:58.432242Z",
34-
"source": "https://github.com/ExpDev07/coronavirus-tracker-api"
37+
"locations": [
38+
{
39+
"id": 0,
40+
"country": "Thailand",
41+
"country_code": "TH",
42+
"province": "",
43+
"coordinates": {
44+
"latitude": "15",
45+
"longitude": "101"
46+
},
47+
"latest": {
48+
"confirmed": 177,
49+
"deaths": 1,
50+
"recovered": 41
51+
}
52+
},
53+
{
54+
"id": 39,
55+
"country": "Norway",
56+
"country_code": "NO",
57+
"province": "",
58+
"coordinates": {
59+
"latitude": "60.472",
60+
"longitude": "8.4689"
61+
},
62+
"latest": {
63+
"confirmed": 1463,
64+
"deaths": 3,
65+
"recovered": 1
66+
}
67+
}
68+
]
3569
}
3670
```
3771

38-
Getting just deaths:
72+
Additionally, you can also filter by country ([alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
3973
```http
40-
GET /deaths
74+
GET /v2/locations?country_code=US
4175
```
4276

43-
Getting just recoveries:
77+
### Getting a specific location (includes timeline).
4478
```http
45-
GET /recovered
79+
GET /v2/locations/:id
80+
```
81+
```json
82+
{
83+
"location": {
84+
"id": 39,
85+
"country": "Norway",
86+
"country_code": "NO",
87+
"province": "",
88+
"coordinates": { },
89+
"latest": { },
90+
"timelines": {
91+
"confirmed": {
92+
"latest": 1463,
93+
"timeline": {
94+
"2020-03-16T00:00:00Z": 1333,
95+
"2020-03-17T00:00:00Z": 1463
96+
}
97+
},
98+
"deaths": { },
99+
"recovered": { }
100+
}
101+
}
102+
}
103+
}
46104
```
47105

48106
## Data
@@ -112,5 +170,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
112170

113171
## License
114172

115-
The data is available to the public strictly for educational and academic research purposes. Please link to this repo somewhere in your project if you can (not required) :).
173+
The data is available to the public strictly for educational and academic research purposes. Please link to this repo somewhere in your project :).
116174

app/services/location/jhu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def get_category(category):
4949
# The normalized locations.
5050
locations = []
5151

52-
for i, item in enumerate(data):
52+
for item in data:
5353
# Filter out all the dates.
5454
dates = dict(filter(lambda element: date_util.is_date(element[0]), item.items()))
5555

app/utils/countrycodes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@
346346

347347
def country_code(country):
348348
"""
349-
Return two letter country code (Alpha-2) according to
350-
https://en.wikipedia.org/wiki/ISO_3166-1
349+
Return two letter country code (Alpha-2) according to https://en.wikipedia.org/wiki/ISO_3166-1
351350
Defaults to "XX".
352351
"""
353352
if country in is_3166_1:

0 commit comments

Comments
 (0)