disclosure from data Change detection had only added/removed/unchanged, so a building extended by an annexe dropped below the IoU threshold and was reported twice: once as removed and once as added. That hides exactly the category a change-detection product exists to show and inflates both counts. A "modified" class now covers the band between the modified floor and the unchanged threshold. Matching also ran as a full cross product with no spatial index, unlike the QA matcher beside it: two municipal building layers meant hundreds of millions of geometry intersections. It uses an STRtree and considers larger footprints first, so a big footprint is not left over after a small neighbour claimed its counterpart. The assistant guaranteed honesty about estimated values by rewriting the model's sentences with regular expressions, which only fires when it recognises the phrasing the model happened to produce. estimate_disclosures derives the same statement from the metric metadata, so it holds regardless of how the answer was worded. The prose substitution stays as a second layer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
893 B
Python
32 lines
893 B
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ChangeDetectionRequest(BaseModel):
|
|
source_dataset_id: UUID
|
|
target_dataset_id: UUID
|
|
iou_threshold: float = Field(default=0.8, ge=0.0, le=1.0)
|
|
include_unchanged: bool = True
|
|
|
|
|
|
class ChangeDetectionSummary(BaseModel):
|
|
source_dataset_id: UUID
|
|
target_dataset_id: UUID
|
|
source_feature_count: int
|
|
target_feature_count: int
|
|
added_count: int
|
|
removed_count: int
|
|
# A footprint that was redrawn rather than demolished and rebuilt. Without
|
|
# this class it appeared as one removal plus one addition.
|
|
modified_count: int = 0
|
|
unchanged_count: int
|
|
iou_threshold: float
|
|
modified_iou_threshold: float | None = None
|
|
warnings: list[str] = Field(default_factory=list)
|
|
generated_at: datetime
|
|
geojson: dict
|