diff --git a/app/location/__init__.py b/app/location/__init__.py index 6fd8cd23..70f9464b 100644 --- a/app/location/__init__.py +++ b/app/location/__init__.py @@ -92,35 +92,5 @@ def serialize(self, timelines = False): key: value.serialize() for (key, value) in self.timelines.items() }}) - # Return the serialized location. - return serialized - -class CSBSLocation(Location): - """ - A CSBS (county) location. - """ - def __init__(self, id, state, county, coordinates, last_updated, confirmed, deaths): - super().__init__( - id, 'US', county, coordinates, last_updated, confirmed, deaths, recovered=0 - ) - - self.state = state - self.county = county - - def serialize(self, timelines=False): - """ - Serializes the location into a dict. - - :returns: The serialized location. - :rtype: dict - """ - serialized = super().serialize() - - # Update with new fields. - serialized.update({ - 'state': self.state, - 'county': self.county, - }) - # Return the serialized location. return serialized \ No newline at end of file diff --git a/app/location/csbs.py b/app/location/csbs.py new file mode 100644 index 00000000..bab09e3d --- /dev/null +++ b/app/location/csbs.py @@ -0,0 +1,37 @@ +from . import Location + +class CSBSLocation(Location): + """ + A CSBS (county) location. + """ + def __init__(self, id, state, county, coordinates, last_updated, confirmed, deaths): + super().__init__( + # General info. + id, 'US', state, coordinates, last_updated, + + # Statistics. + confirmed=confirmed, + deaths=deaths, + recovered=0 + ) + + self.state = state + self.county = county + + def serialize(self, timelines=False): + """ + Serializes the location into a dict. + + :returns: The serialized location. + :rtype: dict + """ + serialized = super().serialize() + + # Update with new fields. + serialized.update({ + 'state': self.state, + 'county': self.county, + }) + + # Return the serialized location. + return serialized \ No newline at end of file diff --git a/app/services/location/csbs.py b/app/services/location/csbs.py index 0ed239a3..e63804af 100644 --- a/app/services/location/csbs.py +++ b/app/services/location/csbs.py @@ -1,6 +1,6 @@ from . import LocationService -from ...location import CSBSLocation from ...coordinates import Coordinates +from ...location.csbs import CSBSLocation class CSBSLocationService(LocationService): """