From 47b97fce0a6eec4fe15a967f1721e18908bffccf Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 7 Mar 2024 21:46:44 +0000 Subject: [PATCH] fixing eco3 matching for ha63 --- .../ha_15_32/ha_analysis_batch_3.py | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 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 aebf0506..bab5cdab 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -174,6 +174,7 @@ class DataLoader: "HA16": 7, "HA24": 12, "HA50": 4, + "HA63": 15, "HA107": 51, "HA48": 0 } @@ -182,6 +183,7 @@ class DataLoader: "HA25": 154, "HA41": 26, "HA50": 5, + "HA63": 0 } def __init__(self, directories, december_figures_filepath, use_cache, rebuild): @@ -1746,6 +1748,25 @@ class DataLoader: "FREDRICK ROAD", "Frederick Road" ) + # For denmark street, remove the space from the house number + eco3_list["NO "] = np.where( + eco3_list["Street / Block Name"] == "DENMARK STREET", + eco3_list["NO "].str.replace(" ", ""), + eco3_list["NO "] + ) + + eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace( + "OLD HOSPITAL MEWS HOSPITAL WALK", "Old Hospital Mews" + ) + + eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace( + "Portland House, Portland Street", "Portland House" + ) + + eco3_list["Street / Block Name"] = eco3_list["Street / Block Name"].str.replace( + "MIDDLE MARKET STREET", "Middle Market Road" + ) + return eco3_list def merge_eco3_to_assets(self, asset_list, eco3_list, ha_name): @@ -1791,7 +1812,7 @@ class DataLoader: if isinstance(house_number, str): house_number = house_number.lower().strip() - if not any(df["matching_address"].str.contains(str(house_number))): + if not any(df["HouseNo"].str.contains(str(house_number))): if "flat" in str(house_number): house_number = house_number.split("flat")[1].strip() @@ -1839,10 +1860,6 @@ class DataLoader: f"Unmatched addresses for {ha_name} is not as expected, got {len(missed)} unmatched" ) - # 41 - missed_df = eco3_list[eco3_list["eco3_list_row_id"].isin(missed)] - missed_df.head(1)["Street / Block Name"] - matching_lookup = pd.DataFrame(matching_lookup) # Check dupes as this will cause problems later on if matching_lookup["asset_list_row_id"].duplicated().any():