1- import libgeohash
21from typing import Any , AnyStr , Dict , List
32
43from ..schema import Property , PropertyLocation , PropertiesPage , LocalStatistics , GlobalStatistics , Statistics , \
5- PriceStatistics , LocationBoundingBox , Point
4+ PriceStatistics
65
76
87class PropertyMapper :
@@ -54,12 +53,11 @@ def map(local_statistics: List[LocalStatistics], global_statistics: GlobalStatis
5453class LocalStatisticsMapper :
5554
5655 @staticmethod
57- def map (price_statistics : PriceStatistics , geohash : AnyStr , bounding_box : LocationBoundingBox ) -> LocalStatistics :
56+ def map (price_statistics : PriceStatistics , geohash : AnyStr ) -> LocalStatistics :
5857
5958 mapped = LocalStatistics ()
6059 mapped .price = price_statistics
6160 mapped .geohash = geohash
62- mapped .bounding_box = bounding_box
6361
6462 return mapped
6563
@@ -86,23 +84,3 @@ def map(min_price, max_price, avg_price) -> PriceStatistics:
8684 mapped .avg = avg_price
8785
8886 return mapped
89-
90-
91- class LocationBoundingBoxMapper :
92-
93- @staticmethod
94- def map (geohash : AnyStr ) -> LocationBoundingBox :
95-
96- reversed_geohash = libgeohash .bbox (geohash )
97-
98- mapped = LocationBoundingBox ()
99- top_right = Point ()
100- top_right .latitude = reversed_geohash .get ('n' )
101- top_right .longitude = reversed_geohash .get ('e' )
102- mapped .top_right = top_right
103- bottom_left = Point ()
104- bottom_left .latitude = reversed_geohash .get ('s' )
105- bottom_left .longitude = reversed_geohash .get ('w' )
106- mapped .bottom_left = bottom_left
107-
108- return mapped
0 commit comments