File size: 2,259 Bytes
1b141db
 
 
 
 
 
 
 
 
 
 
 
2f91d7e
1b141db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, Literal


SelectionType = Literal[
    "drawn_polygon",
    "rectangle",
    "pin_radius",
    "dxf_boundary",
    "geojson_boundary",
    "kml_boundary",
    "reference_only",
]
CoordinateMode = Literal["wgs84", "local_cad", "anchored_local_cad", "unknown"]
Confidence = Literal["high", "medium", "low"]
OutputLabel = Literal[
    "computed",
    "public_data",
    "cad_derived",
    "user_input",
    "ai_interpretation",
    "site_visit_required",
    "professional_verification_required",
]


@dataclass
class SiteSelection:
    id: str
    selection_type: SelectionType
    coordinate_mode: CoordinateMode
    geometry_geojson: dict[str, Any] | None
    local_geometry: list[tuple[float, float]] | None
    anchor_lat: float | None
    anchor_lon: float | None
    radius_m: float | None
    area_sqm: float | None
    perimeter_m: float | None
    centroid: tuple[float, float] | None
    bbox: tuple[float, float, float, float] | None
    unit_source: str
    accuracy_label: str
    source_files: list[str] = field(default_factory=list)
    selected_boundary_id: str | None = None
    limitations: list[str] = field(default_factory=list)


@dataclass
class BoundaryCandidate:
    id: str
    source_file: str
    layer_name: str
    unit: str
    area_sqm: float
    perimeter_m: float
    vertex_count: int
    is_closed: bool
    bbox: tuple[float, float, float, float]
    confidence_reason: str
    points_m: list[tuple[float, float]] = field(default_factory=list)


@dataclass
class LayerFeature:
    source_file: str
    layer_name: str
    feature_type: str
    interpreted_category: str
    count: int


@dataclass
class EvidenceItem:
    id: str
    category: str
    finding: str
    source_name: str
    source_url: str
    source_type: str
    resolution_or_scope: str
    confidence: Confidence
    limitation: str
    design_implication: str
    verification_needed: str
    output_label: OutputLabel


@dataclass
class ReportBundle:
    board_markdown: str
    evidence_rows: list[EvidenceItem]
    checklist_markdown: str
    diagram_paths: list[str]
    export_path: str | None
    warnings: list[str] = field(default_factory=list)