ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 323 forks source link

Introduce the Factory pattern via LocationServiceFactory as a way to … #465

Closed hughie-coles closed 3 years ago

hughie-coles commented 3 years ago

I am introducing a LocationServiceFactory to abstract the creation of different LocationServices. Each location has a name associated, and we use this as the key for each instance.

Data sources can come and go (or existing ones can change). This makes the LocationService a part of the code that is subject to change. By abstracting the creation of these services, we enable the addition and changing of the list of data sources