fixed input as coordinates
Some checks failed
Build and push docker image / Build (pull_request) Failing after 36s
Build and release APK / Build APK (pull_request) Successful in 5m20s
Build web / Build Web (pull_request) Successful in 1m13s

This commit is contained in:
2024-06-04 00:20:54 +02:00
parent bcc91c638d
commit c58c10b057
7 changed files with 274 additions and 80 deletions

View File

@@ -1,4 +1,5 @@
from pydantic import BaseModel
from OSMPythonTools.api import Api
from .landmarktype import LandmarkType
from .preferences import Preferences
@@ -12,19 +13,10 @@ class Landmark(BaseModel) :
name : str
type: LandmarkType # De facto mapping depending on how the query was executed with overpass. Should still EXACTLY correspond to the preferences
location : tuple
# loop through the preferences and assign a score to the landmark
def score(self, preferences: Preferences):
for preference_name, preference in preferences.__dict__.items():
if (preference_name == self.type.landmark_type) :
score = preference.score
if (not score) :
raise Exception(f"Could not determine score for landmark {self.name}")
else :
return score
osm_type : str
osm_id : int
attractiveness : int
must_do : bool
n_tags : int

View File

@@ -3,8 +3,8 @@ from .landmarktype import LandmarkType
class Preference(BaseModel) :
name: str
type: LandmarkType
score: int
type: LandmarkType # should match the attributes of the Preferences class
score: int # score could be from 1 to 5
# Input for optimization
class Preferences(BaseModel) :
@@ -17,11 +17,11 @@ class Preferences(BaseModel) :
# Shopping (diriger plutôt vers des zones / rues commerçantes)
shopping : Preference
# Food (price low or high. Combien on veut dépenser pour manger à midi/soir)
""" # Food (price low or high. Combien on veut dépenser pour manger à midi/soir)
food_budget : Preference
# Tolérance au détour (ce qui détermine (+ ou -) le chemin emprunté)
detour_tol : Preference
detour_tol : Preference"""