File tree Expand file tree Collapse file tree 3 files changed +9
-42
lines changed
Expand file tree Collapse file tree 3 files changed +9
-42
lines changed Original file line number Diff line number Diff line change 1414
1515LOGGER = 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
1821class 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"
Original file line number Diff line number Diff line change 2020LOGGER = logging .getLogger ("services.location.jhu" )
2121PID = 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
2427class 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 ))
131120async def get_category (category ):
132121 """
Original file line number Diff line number Diff line change 1515
1616LOGGER = 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
1922class 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-
121110def get_grouped_locations_dict (data ):
122111 """
123112 Helper function to group history for locations into one dict.
You can’t perform that action at this time.
0 commit comments