Skip to content

Commit 7ed67ed

Browse files
committed
Data_Source change for a more Aggregate approach
1 parent 833f870 commit 7ed67ed

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

app/data/__init__.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22
from ..services.location.csbs import CSBSLocationService
33
from ..services.location.jhu import JhuLocationService
44
from ..services.location.nyt import NYTLocationService
5+
from ..services.location import LocationService
56

67
# Mapping of services to data-sources.
7-
DATA_SOURCES = {
8-
"jhu": JhuLocationService(),
9-
"csbs": CSBSLocationService(),
10-
"nyt": NYTLocationService(),
11-
}
8+
class DATA_SOURCES:
9+
DATA_SOURCES = {}
1210

11+
def data(self)
12+
self.data_Sources['jhu'] = JhuLocationService()
13+
self.data_Sources['csbs'] = CSBSLocationService()
14+
self.data_Sources['nyt'] = NYTLocationService()
1315

14-
def data_source(source):
15-
"""
16-
Retrieves the provided data-source service.
17-
18-
:returns: The service.
19-
:rtype: LocationService
20-
"""
21-
return DATA_SOURCES.get(source.lower())
16+
def data_source(self, source : str)-> LocationService:
17+
return self.dataSource.get(source.lower())

app/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# ############
2222
# FastAPI App
2323
# ############
24-
# this is a test
2524
LOGGER = logging.getLogger("api")
2625

2726
SETTINGS = get_settings()

0 commit comments

Comments
 (0)