Skip to content
Prev Previous commit
Next Next commit
Data_Source change for a more Aggregate approach
  • Loading branch information
Solracion committed Jul 21, 2021
commit 7ed67eda268df114cd6faed4bcda58464ff6313a
22 changes: 9 additions & 13 deletions app/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
from ..services.location.csbs import CSBSLocationService
from ..services.location.jhu import JhuLocationService
from ..services.location.nyt import NYTLocationService
from ..services.location import LocationService

# Mapping of services to data-sources.
DATA_SOURCES = {
"jhu": JhuLocationService(),
"csbs": CSBSLocationService(),
"nyt": NYTLocationService(),
}
class DATA_SOURCES:
DATA_SOURCES = {}

def data(self)
self.data_Sources['jhu'] = JhuLocationService()
self.data_Sources['csbs'] = CSBSLocationService()
self.data_Sources['nyt'] = NYTLocationService()

def data_source(source):
"""
Retrieves the provided data-source service.

:returns: The service.
:rtype: LocationService
"""
return DATA_SOURCES.get(source.lower())
def data_source(self, source : str)-> LocationService:
return self.dataSource.get(source.lower())
1 change: 0 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# ############
# FastAPI App
# ############
# this is a test
LOGGER = logging.getLogger("api")

SETTINGS = get_settings()
Expand Down