feat: add local surface review triage
This commit is contained in:
@@ -600,6 +600,61 @@ def build_lidar_router(
|
||||
detail="K1 local-surface timeline не прошёл проверку целостности",
|
||||
) from exc
|
||||
|
||||
@router.get("/local-surfaces/{model_id}/review")
|
||||
def get_k1_local_surface_review(model_id: str) -> dict[str, object]:
|
||||
if _LOCAL_SURFACE_ID.fullmatch(model_id) is None:
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="K1 local-surface review не найден",
|
||||
)
|
||||
model_root = local_surface_root_provider()
|
||||
source_root = e10_source_root_provider()
|
||||
if model_root is None or not model_root.is_dir():
|
||||
raise HTTPException(
|
||||
status_code=503,
|
||||
detail="K1 local-surface storage не настроен",
|
||||
)
|
||||
if source_root is None or not source_root.is_dir():
|
||||
raise HTTPException(
|
||||
status_code=503,
|
||||
detail="E10 LiDAR source storage не настроен",
|
||||
)
|
||||
model_path = model_root / model_id
|
||||
if not model_path.is_dir():
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="K1 local-surface model не найден",
|
||||
)
|
||||
try:
|
||||
model = K1LocalSurfaceV1(model_path)
|
||||
try:
|
||||
source_pack_id = model.identity.get("source_pack_id")
|
||||
if (
|
||||
not isinstance(source_pack_id, str)
|
||||
or _E10_PACK_ID.fullmatch(source_pack_id) is None
|
||||
):
|
||||
raise LidarGroundError("K1 local-surface source id is invalid")
|
||||
source_path = source_root / source_pack_id
|
||||
if not source_path.is_dir():
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail="Связанный E10 LiDAR source не найден",
|
||||
)
|
||||
source = E10LidarFieldSource(source_path)
|
||||
try:
|
||||
return model.review_detail(source)
|
||||
finally:
|
||||
source.close()
|
||||
finally:
|
||||
model.close()
|
||||
except HTTPException:
|
||||
raise
|
||||
except (LidarGroundError, OSError) as exc:
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail="K1 local-surface review не прошёл проверку целостности",
|
||||
) from exc
|
||||
|
||||
@router.get("/local-surfaces/{model_id}/frames/{frame_index}")
|
||||
def get_k1_local_surface_frame(
|
||||
model_id: str,
|
||||
|
||||
Reference in New Issue
Block a user