more coherent base types
This commit is contained in:
parent
4a291a69c9
commit
14a7f555df
@ -1,6 +1,5 @@
|
||||
from typing import Optional
|
||||
from typing import Optional, Literal
|
||||
from pydantic import BaseModel, Field
|
||||
from .landmarktype import LandmarkType
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
@ -9,7 +8,7 @@ class Landmark(BaseModel) :
|
||||
|
||||
# Properties of the landmark
|
||||
name : str
|
||||
type: LandmarkType # De facto mapping depending on how the query was executed with overpass. Should still EXACTLY correspond to the preferences
|
||||
type: Literal['sightseeing', 'nature', 'shopping']
|
||||
location : tuple
|
||||
osm_type : str
|
||||
osm_id : int
|
||||
@ -24,6 +23,7 @@ class Landmark(BaseModel) :
|
||||
|
||||
# Additional properties depending on specific tour
|
||||
must_do : bool
|
||||
must_avoid : bool
|
||||
is_secondary : Optional[bool] = False # TODO future
|
||||
|
||||
time_to_reach_next : Optional[int] = 0 # TODO fix this in existing code
|
||||
@ -31,3 +31,7 @@ class Landmark(BaseModel) :
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return self.uuid.int
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f'Landmark: [{self.name}, {self.location}, {self.attractiveness}]'
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
class LandmarkType(BaseModel):
|
||||
landmark_type: str
|
@ -1,9 +1,9 @@
|
||||
from pydantic import BaseModel
|
||||
from .landmarktype import LandmarkType
|
||||
from typing import Optional, Literal
|
||||
|
||||
class Preference(BaseModel) :
|
||||
name: str
|
||||
type: LandmarkType # should match the attributes of the Preferences class
|
||||
type: Literal['sightseeing', 'nature', 'shopping']
|
||||
score: int # score could be from 1 to 5
|
||||
|
||||
# Input for optimization
|
||||
@ -17,12 +17,5 @@ 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_budget : Preference
|
||||
|
||||
# Tolérance au détour (ce qui détermine (+ ou -) le chemin emprunté)
|
||||
detour_tol : Preference"""
|
||||
|
||||
|
||||
|
||||
|
||||
max_time_minute: Optional[int] = 6*60
|
||||
detour_tolerance_minute: Optional[int] = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user