260705_2
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
"""B04 지표면 분석 요청·응답 검증 모델."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from config.config_system import (
|
||||
SURFACE_MODEL_PRECOMPUTE,
|
||||
SURFACE_MODEL_SOURCE_FILTERS,
|
||||
)
|
||||
|
||||
_ALLOWED_FILTERS = set(SURFACE_MODEL_SOURCE_FILTERS) | {"ransac"}
|
||||
_ALLOWED_METHODS = set(SURFACE_MODEL_PRECOMPUTE)
|
||||
|
||||
|
||||
class SurfaceAnalyzeRequest(BaseModel):
|
||||
"""지표면 분석 실행 요청."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
input_file_id: int = Field(gt=0, description="구조화 대상 원본 LAS input_files.id")
|
||||
source_filters: list[str] | None = Field(
|
||||
default=None, description="실행할 지면 필터 (미지정 시 config 기본값)"
|
||||
)
|
||||
methods: list[str] | None = Field(
|
||||
default=None, description="생성할 지표면 표현 (미지정 시 config 기본값)"
|
||||
)
|
||||
force: bool = Field(default=False, description="캐시 무시 후 강제 재계산")
|
||||
|
||||
def resolved_filters(self) -> list[str]:
|
||||
filters = self.source_filters or list(SURFACE_MODEL_SOURCE_FILTERS)
|
||||
invalid = [f for f in filters if f not in _ALLOWED_FILTERS]
|
||||
if invalid:
|
||||
raise ValueError(f"허용되지 않은 지면 필터입니다: {invalid}")
|
||||
return filters
|
||||
|
||||
def resolved_methods(self) -> list[str]:
|
||||
methods = self.methods or list(SURFACE_MODEL_PRECOMPUTE)
|
||||
invalid = [m for m in methods if m not in _ALLOWED_METHODS]
|
||||
if invalid:
|
||||
raise ValueError(f"허용되지 않은 지표면 표현입니다: {invalid}")
|
||||
return methods
|
||||
|
||||
|
||||
class SurfaceModelSummary(BaseModel):
|
||||
"""저장된 지표면 모델 요약."""
|
||||
|
||||
id: int
|
||||
model_type: str
|
||||
status: str
|
||||
resolution_m: float | None = None
|
||||
model_file_path: str | None = None
|
||||
created_at: str | None = None
|
||||
|
||||
|
||||
class SurfaceAnalyzeResponse(BaseModel):
|
||||
"""지표면 분석 실행 결과."""
|
||||
|
||||
status: str = "success"
|
||||
project_id: str
|
||||
ground_summary: dict[str, Any]
|
||||
manifest_status: str
|
||||
surface_model_ids: list[int]
|
||||
|
||||
|
||||
class SurfaceModelListResponse(BaseModel):
|
||||
"""프로젝트 지표면 모델 목록 응답."""
|
||||
|
||||
status: str = "success"
|
||||
project_id: str
|
||||
models: list[SurfaceModelSummary]
|
||||
Reference in New Issue
Block a user