From 5a451f2f8239aaac05237c93b99c435de83a8652 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 23 Feb 2024 12:20:46 +0000 Subject: [PATCH] fixed logic for missed postcodes for ha6 --- .../ha_15_32/ha_analysis_batch_3.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py index f1709d6e..95ca3901 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -518,6 +518,17 @@ class DataLoader: df = df[df["matching_address"].str.contains(str(house_number))] if df.empty: + + postcode_lower = row["Post Code"].lower() + if postcode_lower in missed_postcodes: + matching_lookup.append( + { + "survey_list_row_id": row["survey_list_row_id"], + "asset_list_row_id": None, + } + ) + continue + print(row["Street / Block Name"]) print(house_number) print(row["Post Code"]) @@ -546,16 +557,6 @@ class DataLoader: df = df.iloc[best_match_index:best_match_index + 1] if df.shape[0] != 1: - postcode_lower = row["Post Code"].lower() - if postcode_lower in missed_postcodes: - matching_lookup.append( - { - "survey_list_row_id": row["survey_list_row_id"], - "asset_list_row_id": None, - } - ) - continue - print(row["Street / Block Name"]) print(house_number) print(row["Post Code"])