| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- from __future__ import annotations
- """路线评估结果模型:RouteLeg路线段与RouteEvaluationResult酒店位置评估。"""
- from typing import Any, Literal
- from pydantic import Field
- from app.schemas.common import AppModel
- RouteDataSource = Literal[
- "amap",
- "haversine_fallback",
- ]
- class RouteLeg(AppModel):
- """酒店与一个景点之间的距离结果。"""
- origin_name: str
- origin_location: str
- destination_name: str
- destination_location: str
- distance_meters: float = Field(ge=0)
- duration_seconds: float | None = Field(
- default=None,
- ge=0,
- )
- source: RouteDataSource = "amap"
- class HotelRouteEvaluation(AppModel):
- """综合酒店自身质量和真实位置后的评分结果。"""
- hotel_id: str
- hotel_name: str
- final_score: float = Field(
- ge=0,
- le=100,
- )
- base_hotel_score: float = Field(
- ge=0,
- le=100,
- )
- centrality_score: float = Field(
- ge=0,
- le=100,
- )
- subway_score: float = Field(
- ge=0,
- le=100,
- )
- average_distance_meters: float | None = None
- maximum_distance_meters: float | None = None
- average_duration_seconds: float | None = None
- nearest_subway_distance_meters: (
- float | None
- ) = None
- route_legs: list[RouteLeg] = Field(
- default_factory=list
- )
- reasons: list[str] = Field(
- default_factory=list
- )
- warnings: list[str] = Field(
- default_factory=list
- )
- hotel: dict[str, Any]
- class RouteEvaluationResult(AppModel):
- """路线评估阶段的最终结果。"""
- evaluated_hotels: list[
- HotelRouteEvaluation
- ] = Field(
- default_factory=list
- )
- reference_attractions: list[str] = Field(
- default_factory=list
- )
- selected_hotel_id: str | None = None
- distance_call_count: int = 0
- around_search_call_count: int = 0
- warnings: list[str] = Field(
- default_factory=list
- )
|