Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/services/location/jhu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ...utils import date as date_util
from ...utils import httputils
from . import LocationService
from ...utils.baseurls import BaseUrl

LOGGER = logging.getLogger("services.location.jhu")
PID = os.getpid()
Expand All @@ -41,7 +42,7 @@ async def get(self, loc_id): # pylint: disable=arguments-differ


# Base URL for fetching category.
BASE_URL = "https://raw.githubusercontent.com/CSSEGISandData/2019-nCoV/master/csse_covid_19_data/csse_covid_19_time_series/"
BASE_URL = BaseUrl.JHU


@cached(cache=TTLCache(maxsize=4, ttl=1800))
Expand Down Expand Up @@ -226,3 +227,4 @@ def parse_history(key: tuple, locations: list, index: int):
LOGGER.debug(f"iteration data merge error: {index} {key}")

return location_history

10 changes: 10 additions & 0 deletions app/utils/baseurls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import enum

class BaseUrl(str, enum.Enum):
"""
A base url available for retrieving data.
"""

JHU = "https://raw.githubusercontent.com/CSSEGISandData/2019-nCoV/master/csse_covid_19_data/csse_covid_19_time_series/"
CSBS = "https://facts.csbs.org/covid-19/covid19_county.csv"
NYT = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"