Summarise a Calico load as a four-count reconciliation report 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-13 15:09:39 +00:00
parent 8510ddf161
commit 87eecc6400
2 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,25 @@
from dataclasses import dataclass
from typing import List
from domain.condition.records.calico.calico_property import CalicoProperty
@dataclass(frozen=True)
class LoadReport:
"""The reconciliation a Calico load emits so nothing vanishes silently
(ADR-0064): how many observations were loaded versus dropped, and why."""
loaded: int
unmatched_to_portfolio: int
null_uprn: int
blank_placeholder: int
@classmethod
def from_calico_load(
cls,
properties: List[CalicoProperty],
blank_placeholder_count: int,
unmatched_reference_count: int,
null_uprn_references: List[str],
) -> "LoadReport":
raise NotImplementedError

View file

@ -0,0 +1,38 @@
from applications.condition.load_report import LoadReport
from domain.condition.records.calico.calico_asset_condition import CalicoAssetCondition
from domain.condition.records.calico.calico_property import CalicoProperty
def _property(uprn: int, reference: int, covering: str) -> CalicoProperty:
return CalicoProperty(
uprn=uprn,
assets=[
CalicoAssetCondition(
asset_reference=reference, path="Roof Covering", covering_type=covering
)
],
)
def test_load_report_summarises_the_four_reconciliation_counts():
# Arrange
properties = [
_property(100093305101, 443, "Concrete Tiles"),
_property(100093388053, 444, "Natural Slate"),
]
# Act
report = LoadReport.from_calico_load(
properties=properties,
blank_placeholder_count=1239,
unmatched_reference_count=5,
null_uprn_references=["999", "888"],
)
# Assert
assert report == LoadReport(
loaded=2,
unmatched_to_portfolio=5,
null_uprn=2,
blank_placeholder=1239,
)