now working
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m38s
Run linting on the backend code / Build (pull_request) Successful in 26s
Run testing on the backend code / Build (pull_request) Failing after 2m50s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s

This commit is contained in:
2025-01-28 11:52:07 +01:00
parent 4a904c3d3c
commit 2ac8499dfb
9 changed files with 89 additions and 80 deletions

View File

@@ -103,10 +103,10 @@ class ClusterManager:
out = out
)
except Exception as e:
self.logger.error(f"Error fetching landmarks: {e}")
self.logger.error(f"Error fetching clusters: {e}")
if result is None :
self.logger.error(f"Error fetching {cluster_type} clusters, overpass query returned None.")
self.logger.debug(f"Found no {cluster_type} clusters, overpass query returned no datapoints.")
self.valid = False
else :
@@ -134,7 +134,7 @@ class ClusterManager:
# Check that there are is least 1 cluster
if len(set(labels)) > 1 :
self.logger.debug(f"Found {len(set(labels))} different clusters.")
self.logger.info(f"Found {len(set(labels))} different {cluster_type} clusters.")
# Separate clustered points and noise points
self.cluster_points = self.all_points[labels != -1]
self.cluster_labels = labels[labels != -1]
@@ -142,7 +142,7 @@ class ClusterManager:
self.valid = True
else :
self.logger.debug(f"Detected 0 {cluster_type} clusters.")
self.logger.info(f"Found 0 {cluster_type} clusters.")
self.valid = False
else :
@@ -241,11 +241,11 @@ class ClusterManager:
out = 'ids center'
)
except Exception as e:
self.logger.error(f"Error fetching landmarks: {e}")
self.logger.error(f"Error fetching clusters: {e}")
continue
if result is None :
self.logger.error(f"Error fetching landmarks: {e}")
self.logger.error(f"Error fetching clusters: {e}")
continue
for elem in result:

View File

@@ -88,26 +88,26 @@ class LandmarkManager:
self.logger.debug('Fetching sightseeing landmarks...')
current_landmarks = self.fetch_landmarks(bbox, self.amenity_selectors['sightseeing'], preferences.sightseeing.type, preferences.sightseeing.score)
all_landmarks.update(current_landmarks)
self.logger.debug('Fetching sightseeing clusters...')
self.logger.info(f'Found {len(current_landmarks)} sightseeing landmarks')
# special pipeline for historic neighborhoods
neighborhood_manager = ClusterManager(bbox, 'sightseeing')
historic_clusters = neighborhood_manager.generate_clusters()
all_landmarks.update(historic_clusters)
self.logger.debug('Sightseeing clusters done')
# list for nature
if preferences.nature.score != 0:
self.logger.debug('Fetching nature landmarks...')
current_landmarks = self.fetch_landmarks(bbox, self.amenity_selectors['nature'], preferences.nature.type, preferences.nature.score)
all_landmarks.update(current_landmarks)
self.logger.info(f'Found {len(current_landmarks)} nature landmarks')
# list for shopping
if preferences.shopping.score != 0:
self.logger.debug('Fetching shopping landmarks...')
current_landmarks = self.fetch_landmarks(bbox, self.amenity_selectors['shopping'], preferences.shopping.type, preferences.shopping.score)
self.logger.debug('Fetching shopping clusters...')
self.logger.info(f'Found {len(current_landmarks)} shopping landmarks')
# set time for all shopping activites :
for landmark in current_landmarks :
@@ -118,8 +118,6 @@ class LandmarkManager:
shopping_manager = ClusterManager(bbox, 'shopping')
shopping_clusters = shopping_manager.generate_clusters()
all_landmarks.update(shopping_clusters)
self.logger.debug('Shopping clusters done')
landmarks_constrained = take_most_important(all_landmarks, self.n_important)
@@ -174,7 +172,7 @@ class LandmarkManager:
"""
return_list = []
if landmarktype == 'nature' : query_conditions = []
if landmarktype == 'nature' : query_conditions = None
else : query_conditions = ['count_tags()>5']
# caution, when applying a list of selectors, overpass will search for elements that match ALL selectors simultaneously
@@ -185,7 +183,7 @@ class LandmarkManager:
osm_types = ['way', 'relation']
if 'viewpoint' in sel :
query_conditions = []
query_conditions = None
osm_types.append('node')
# Send the overpass query

View File

@@ -56,7 +56,7 @@ class ToiletsManager:
osm_types = ['node', 'way', 'relation']
toilets_list = []
query = self.overpass.build_query(
query = Overpass.build_query(
bbox = bbox,
osm_types = osm_types,
selector = '"amenity"="toilets"',