mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Resolve a UPRN to its historic EPC record by exact match 🟩
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
4bbcdb6a61
commit
f9f80f7184
1 changed files with 11 additions and 2 deletions
|
|
@ -35,8 +35,17 @@ class HistoricEpcResolver:
|
|||
)
|
||||
|
||||
def record_for_uprn(self, uprn: str, postcode: str) -> Optional[HistoricEpc]:
|
||||
"""The postcode shard's certificate for ``uprn``, or None."""
|
||||
return None
|
||||
"""The postcode shard's certificate for ``uprn``, or None on a miss.
|
||||
|
||||
Exact UPRN equality only — the prediction path must never import a
|
||||
fuzzy address match's attributes as if observed (ADR-0054)."""
|
||||
if not uprn:
|
||||
return None
|
||||
records: list[HistoricEpc] = self._repo.get_for_postcode(Postcode(postcode))
|
||||
certs: list[HistoricEpc] = [r for r in records if r.uprn == uprn]
|
||||
if not certs:
|
||||
return None
|
||||
return max(certs, key=lambda r: r.lodgement_date)
|
||||
|
||||
def resolve_uprn(
|
||||
self, user_address: str, postcode: str
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue