Files
NODEDC_MISSION_CORE/src/k1link/missions/live_status.py
T
DCCONSTRUCTIONS 7878937691 feat(viewer): unify spatial clipping, planning and observation surfaces
Share spatial clipping and height slices across live planning and recorded observations. Refine scene navigation, report serialization and viewer presentation.
2026-10-29 09:10:01 +03:00

31 lines
1.4 KiB
Python

"""Polling projection: no route geometry, point indices or calculation history.
Full evidence remains in the existing report API and immutable stored reports.
Select fields before copying; traversing the whole report defeats this boundary.
"""
import copy
FIELDS = ("id", "profile", "plugin_id", "state", "planning_phase", "tracking_state",
"tracking_established", "message", "query_session_id", "distance_m", "query_points")
def status_document(run):
result = {key: run[key] for key in FIELDS if key in run}
result["schema_version"] = "missioncore.planning-live-status/v1"
draft = run["draft"]
result["draft"] = {key: draft[key] for key in
("id", "revision", "name", "updated_at_utc", "vehicle_id", "zone")
if key in draft}
result["draft"]["route"] = {key: draft["route"][key] for key in
("start_index", "end_index", "direction", "length_m")
if key in draft["route"]}
match = run.get("result")
result["result"] = None if match is None else {
key: match[key] for key in ("status", "overlap", "inlier_rmse_m", "reasons")
if key in match}
policy = run.get("route_relocalization_policy")
if policy is not None:
result["route_relocalization_policy"] = {
key: policy[key] for key in ("version", "query_radius_m") if key in policy}
return copy.deepcopy(result)