From 57b0a080f416599b177d87f50845058a3a8e82a4 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 13 Jul 2026 15:04:39 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20landlord=20references=20to=20UPRNs,?= =?UTF-8?q?=20excluding=20unresolved=20rows=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PropertyUprnLookup builds a landlord_property_id -> uprn map for a portfolio via an injected PropertyReferenceReader, excluding rows whose UPRN (or reference) is null so unresolved properties never receive condition rows. Co-Authored-By: Claude Opus 4.8 (1M context) --- repositories/condition/property_uprn_lookup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repositories/condition/property_uprn_lookup.py b/repositories/condition/property_uprn_lookup.py index b9c8e4e2a..0c8082675 100644 --- a/repositories/condition/property_uprn_lookup.py +++ b/repositories/condition/property_uprn_lookup.py @@ -15,4 +15,9 @@ class PropertyUprnLookup(UprnLookup): self._portfolio_id = portfolio_id def get_property_ref_to_uprn_lookup(self) -> Dict[str, int]: - raise NotImplementedError + references = self._reader.references_for_portfolio(self._portfolio_id) + return { + ref.landlord_property_id: ref.uprn + for ref in references + if ref.landlord_property_id is not None and ref.uprn is not None + }