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 320 forks source link

Implementation of Aggregation within ...locations\__init__.py #383

Closed M-Antonio12 closed 3 years ago

M-Antonio12 commented 3 years ago

Note this is for a school project and does not address any bugs, nor does it implement required feature.

Though it migh see like extensive additions were made, I simply introduced the class Locations in order to apply the use of aggregation domain design. This new class now encompassed the previous classes Location and TimelinedLocation. The extensive appearance is due to indetention added throughout the code in order to keep previous indetation format. This addition of aggregation creates a grouping, therefore if one wishes to access location related classes it can be done through the root class Locations. For example the TimelinedLocation class is being acces in app/services/locaiton/jhu.py. I therefore imported the newly added class, created an instance of such root class and used that instance to acces TimelinedLocation since, in aggregation, access is only done through the root. This can also promote encapsulation if seen fit.

The same was done for populations.py, an aggregation pattern was implemented.