Skip to content

Commit 62bc59a

Browse files
committed
removed getAll() and get() from data source files
1 parent 0719d24 commit 62bc59a

File tree

3 files changed

+9
-42
lines changed

3 files changed

+9
-42
lines changed

app/services/location/csbs.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,15 @@
1414

1515
LOGGER = logging.getLogger("services.location.csbs")
1616

17+
# Base URL for fetching data
18+
BASE_URL = "https://facts.csbs.org/covid-19/covid19_county.csv"
19+
1720

1821
class CSBSLocationService(LocationService):
1922
"""
2023
Service for retrieving locations from csbs
2124
"""
2225

23-
async def get_all(self):
24-
# Get the locations.
25-
locations = await get_locations()
26-
return locations
27-
28-
async def get(self, loc_id): # pylint: disable=arguments-differ
29-
# Get location at the index equal to the provided id.
30-
locations = await self.get_all()
31-
return locations[loc_id]
32-
3326
@cached(cache=TTLCache(maxsize=1, ttl=1800))
3427
async def get_locations():
3528
"""
@@ -96,7 +89,3 @@ async def get_locations():
9689

9790
# Return the locations.
9891
return locations
99-
100-
101-
# Base URL for fetching data
102-
BASE_URL = "https://facts.csbs.org/covid-19/covid19_county.csv"

app/services/location/jhu.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,15 @@
2020
LOGGER = logging.getLogger("services.location.jhu")
2121
PID = os.getpid()
2222

23+
# Base URL for fetching category.
24+
BASE_URL = "https://raw.githubusercontent.com/CSSEGISandData/2019-nCoV/master/csse_covid_19_data/csse_covid_19_time_series/"
25+
2326

2427
class JhuLocationService(LocationService):
2528
"""
2629
Service for retrieving locations from Johns Hopkins CSSE (https://github.com/CSSEGISandData/COVID-19).
2730
"""
2831

29-
async def get_all(self):
30-
# Get the locations.
31-
locations = await get_locations()
32-
return locations
33-
34-
async def get(self, loc_id): # pylint: disable=arguments-differ
35-
# Get location at the index equal to provided id.
36-
locations = await self.get_all()
37-
return locations[loc_id]
38-
3932
@cached(cache=TTLCache(maxsize=1, ttl=1800))
4033
async def get_locations():
4134
"""
@@ -123,10 +116,6 @@ async def get_locations():
123116
# ---------------------------------------------------------------
124117

125118

126-
# Base URL for fetching category.
127-
BASE_URL = "https://raw.githubusercontent.com/CSSEGISandData/2019-nCoV/master/csse_covid_19_data/csse_covid_19_time_series/"
128-
129-
130119
@cached(cache=TTLCache(maxsize=4, ttl=1800))
131120
async def get_category(category):
132121
"""

app/services/location/nyt.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,15 @@
1515

1616
LOGGER = logging.getLogger("services.location.nyt")
1717

18+
# Base URL for fetching category.
19+
BASE_URL = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
20+
1821

1922
class NYTLocationService(LocationService):
2023
"""
2124
Service for retrieving locations from New York Times (https://github.com/nytimes/covid-19-data).
2225
"""
2326

24-
async def get_all(self):
25-
# Get the locations.
26-
locations = await get_locations()
27-
return locations
28-
29-
async def get(self, loc_id): # pylint: disable=arguments-differ
30-
# Get location at the index equal to provided id.
31-
locations = await self.get_all()
32-
return locations[loc_id]
33-
3427
@cached(cache=TTLCache(maxsize=1, ttl=1800))
3528
async def get_locations():
3629
"""
@@ -114,10 +107,6 @@ async def get_locations():
114107
# ---------------------------------------------------------------
115108

116109

117-
# Base URL for fetching category.
118-
BASE_URL = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
119-
120-
121110
def get_grouped_locations_dict(data):
122111
"""
123112
Helper function to group history for locations into one dict.

0 commit comments

Comments
 (0)