Source code for openworld_radio_twin.providers.base
from dataclasses import dataclass, field
from openworld_radio_twin.models import BuildingFeature
SCENE_BOUNDARY_POLICY = "fully_contained_in_square_enu_domain"
[docs]
class BuildingProviderError(RuntimeError):
"""A remote building provider could not return a valid query result."""
[docs]
@dataclass(frozen=True)
class BuildingQueryResult:
buildings: list[BuildingFeature]
provider: str
release: str | None = None
warnings: list[str] = field(default_factory=list)
boundary_excluded_count: int = 0
source_selection: dict[str, object] = field(default_factory=dict)
@property
def source_count(self) -> int:
return len(self.buildings) + self.boundary_excluded_count
@property
def source_provenance(self) -> dict[str, str]:
"""Flat source identity for HTTP and per-case provenance records."""
return {
f"building_source_{key}": str(value) for key, value in self.source_selection.items()
}