File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def get_data(category):
2727
2828 # The normalized locations.
2929 locations = []
30-
30+ keys = []
3131 for item in data :
3232 # Filter out all the dates.
3333 dates = dict (filter (lambda element : date_util .is_date (element [0 ]), item .items ()))
@@ -40,7 +40,10 @@ def get_data(category):
4040
4141 # Latest data insert value.
4242 latest = list (history .values ())[- 1 ];
43-
43+ if item ['Province/State' ] == "" :
44+ keys .append (country )
45+ else :
46+ keys .append (item ['Province/State' ])
4447 # Normalize the item and append to locations.
4548 locations .append ({
4649 # General info.
@@ -66,7 +69,7 @@ def get_data(category):
6669
6770 # Return the final data.
6871 return {
69- 'locations' : locations ,
72+ 'locations' : dict ( zip ( keys , locations )) ,
7073 'latest' : latest ,
7174 'last_updated' : datetime .utcnow ().isoformat () + 'Z' ,
7275 'source' : 'https://github.com/ExpDev07/coronavirus-tracker-api' ,
You can’t perform that action at this time.
0 commit comments