From 2890ff13cdf6cb7d1bdb3aa6624b2821327d0b80 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 27 Aug 2024 14:48:40 +0100 Subject: [PATCH] fixed new bug In added --- backend/SearchEpc.py | 6 ++++-- etl/customers/orbit/archetypes.py | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/SearchEpc.py b/backend/SearchEpc.py index fd6ea032..5f101d81 100644 --- a/backend/SearchEpc.py +++ b/backend/SearchEpc.py @@ -329,10 +329,12 @@ class SearchEpc: best_match = process.extractOne( address, [", ".join([r["address"], r["posttown"]]) for r in rows], score_cutoff=0 ) + # Get all of the scores + rows_filtered = [r for r in rows if ", ".join([r["address"], r["posttown"]]) == best_match[0]] else: best_match = process.extractOne(address, [r["address"] for r in rows], score_cutoff=0) - # Get all of the scores - rows_filtered = [r for r in rows if r["address"] == best_match[0]] + # Get all of the scores + rows_filtered = [r for r in rows if r["address"] == best_match[0]] if rows_filtered: return rows_filtered diff --git a/etl/customers/orbit/archetypes.py b/etl/customers/orbit/archetypes.py index e0f5e995..73665bcb 100644 --- a/etl/customers/orbit/archetypes.py +++ b/etl/customers/orbit/archetypes.py @@ -89,6 +89,13 @@ def main(): address1 = address.split(",")[0] + asset_type_map = { + "HOUSE": "House", + "BUNGALOWS": "Bungalow", + "FLATS": "Flat", + "MAISONETTES": "Maisonette", + } + searcher = SearchEpc( address1=address1, postcode=home["Address - Postcode"], @@ -96,7 +103,7 @@ def main(): os_api_key="", full_address=address, ) - searcher.ordnance_survey_client.property_type = None + searcher.ordnance_survey_client.property_type = asset_type_map[home["Asset Type"]] searcher.ordnance_survey_client.built_form = None searcher.find_property(skip_os=True)