base structs as agreed upon
This commit is contained in:
parent
c26d9222bd
commit
8e33bd1b3f
@ -10,6 +10,10 @@ from typing import List
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
# TODO: needs a global variable to store the landmarks accross function calls
|
||||
# linked_tour = []
|
||||
|
||||
|
||||
# Assuming frontend is calling like this :
|
||||
#"http://127.0.0.1:8000/process?param1={param1}¶m2={param2}"
|
||||
@app.post("/optimizer_coords/{start_lat}/{start_lon}/{finish_lat}/{finish_lon}")
|
||||
@ -50,11 +54,22 @@ def main1(start_lat: float, start_lon: float, preferences: Preferences = Body(..
|
||||
|
||||
# Second stage optimization
|
||||
refined_tour = refine_optimization(landmarks, base_tour, max_walking_time*60+detour, True)
|
||||
|
||||
|
||||
# TODO: should look something like this
|
||||
# # set time to reach and transform into fully functional linked list
|
||||
# linked_tour += link(refined_tour)
|
||||
# return {
|
||||
# 'city_name': 'Paris',
|
||||
# 'n_stops': len(linked_tour),
|
||||
# 'first_landmark_uuid': linked_tour[0].uuid,
|
||||
# }
|
||||
|
||||
return refined_tour
|
||||
|
||||
|
||||
|
||||
|
||||
# input city, country in the form of 'Paris, France'
|
||||
@app.post("/test2/{city_country}")
|
||||
def test2(city_country: str, preferences: Preferences = Body(...)) -> List[Landmark]:
|
||||
@ -67,4 +82,9 @@ def test2(city_country: str, preferences: Preferences = Body(...)) -> List[Landm
|
||||
|
||||
|
||||
|
||||
@app.get("/landmark/{landmark_uuid}")
|
||||
def get_landmark(landmark_uuid: str) -> Landmark:
|
||||
#cherche dans linked_tour et retourne le landmark correspondant
|
||||
pass
|
||||
|
||||
|
||||
|
@ -1,20 +1,30 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .landmarktype import LandmarkType
|
||||
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
# Output to frontend
|
||||
class Landmark(BaseModel) :
|
||||
# Unique ID of a given landmark
|
||||
uuid: str = Field(default_factory=uuid4) # TODO implement this ASAP
|
||||
|
||||
# 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
|
||||
location : tuple
|
||||
osm_type : str
|
||||
osm_id : int
|
||||
attractiveness : int
|
||||
must_do : bool
|
||||
n_tags : int
|
||||
time_to_reach : Optional[int] = 0
|
||||
|
||||
|
||||
image_url : Optional[str] = None # TODO future
|
||||
description : Optional[str] = None # TODO future
|
||||
duration : Optional[int] = 0 # TODO future
|
||||
|
||||
# Additional properties depending on specific tour
|
||||
must_do : bool
|
||||
is_secondary : Optional[bool] = False # TODO future
|
||||
|
||||
time_to_reach_next : Optional[int] = 0 # TODO fix this in existing code
|
||||
next_uuid : Optional[str] = None # TODO implement this ASAP
|
||||
|
Loading…
x
Reference in New Issue
Block a user