From b47c90f9cd05fb89b72a3a4b9b76582a32e80ac3 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 29 Jun 2026 14:52:20 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20an=20address=20to=20its=20unambiguous?= =?UTF-8?q?=20historic=20EPC=20UPRN=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- repositories/historic_epc/historic_epc_resolver.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repositories/historic_epc/historic_epc_resolver.py b/repositories/historic_epc/historic_epc_resolver.py index 8a2781ce6..789b4dc35 100644 --- a/repositories/historic_epc/historic_epc_resolver.py +++ b/repositories/historic_epc/historic_epc_resolver.py @@ -38,4 +38,11 @@ class HistoricEpcResolver: ) -> Optional[tuple[str, str, float]]: """``(uprn, matched_address, lexiscore)`` for an unambiguous rank-1 match, else None (no data / ambiguous tie / zero score).""" - raise NotImplementedError + matches = self.match(user_address, postcode) + uprn = matches.unambiguous_uprn() + if not uprn or uprn == "nan": + return None + top = matches.top() + if top is None: + return None + return uprn, top.record.address, top.lexiscore