Kamaropoulos / COVID19Py

A tiny Python package for easy access to up-to-date Coronavirus (COVID-19, SARS-CoV-2) cases data.
https://pypi.org/project/COVID19Py/
GNU General Public License v3.0
84 stars 57 forks source link

Request information on a list of countries through the bridge pattern #116

Closed calto05 closed 2 years ago

calto05 commented 3 years ago

What I added was two classes COUNTRIES and ALT_SOURCE. COUNTRIES stores a list of countries which can have their covid19 data requested all at once. ALT_SOURCE stores an instance of COVID19 where you can provide a different url and data_source for information. The goal with connecting these two classes by the bridge pattern is so you can have any combination of countries, requesting data through any data_source. This should help if a user wants to switch data sources if response times are low or not working on one data source. Being able to request information from a list of countries is also a convenience. A dictionary of entities called _country_lists stores instances of COUNTRIES identified by a string name. createCountryList allows for the creation of a new country list, and getMultipleCountries returns the data for a list of countries from an existing COUNTRIES entitiy in _country_lists. Please note as stated in my pull request cfd86a5, where I applied the singleton pattern this pull request is not compatible as it creates multiple instance of COVID19.