From 3ab1e94ea14fa3b8fcdbde795cec7d98c4535b31 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 4 Mar 2025 12:48:46 +0000 Subject: [PATCH] debugging asset list for ealing without wall --- .idea/Model.iml | 2 +- .idea/misc.xml | 2 +- asset_list/AssetList.py | 24 ++++++++++++----- asset_list/app.py | 39 ++++++++-------------------- asset_list/mappings/property_type.py | 3 ++- 5 files changed, 32 insertions(+), 38 deletions(-) diff --git a/.idea/Model.iml b/.idea/Model.iml index df6c4faa..96ad7a95 100644 --- a/.idea/Model.iml +++ b/.idea/Model.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 50cad4ca..fb10c6b0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,7 +3,7 @@ - + diff --git a/asset_list/AssetList.py b/asset_list/AssetList.py index 306edd99..d4288114 100644 --- a/asset_list/AssetList.py +++ b/asset_list/AssetList.py @@ -575,13 +575,18 @@ class AssetList: # We handle cleaning for walls, in the instance that the landlord provides us with EPC data and # we see instances of "average thermal transmittance" in the description - self.standardised_asset_list[self.landlord_wall_construction] = np.where( - self.standardised_asset_list[self.landlord_wall_construction].str.lower().str.contains( - "average thermal transmittance" - ) == True, - "new build - average thermal transmittance", - self.standardised_asset_list[self.landlord_wall_construction] - ) + if self.landlord_wall_construction is not None: + self.standardised_asset_list[self.landlord_wall_construction] = np.where( + self.standardised_asset_list[self.landlord_wall_construction].str.lower().str.contains( + "average thermal transmittance" + ) == True, + "new build - average thermal transmittance", + self.standardised_asset_list[self.landlord_wall_construction] + ) + else: + # We want to make sure that we have a column for wall construction + self.landlord_wall_construction = "landlord_wall_construction" + self.standardised_asset_list[self.landlord_wall_construction] = None # Clear our build year column # We attempt to process the year built column @@ -625,6 +630,11 @@ class AssetList: if str(date_str).isdigit() & (len(str(date_str)) == 4): return int(date_str) + # Remove any non-numeric characters + date_str = re.sub(r"\D", "", str(date_str)) + if str(date_str).isdigit() & (len(str(date_str)) == 4): + return int(date_str) + raise NotImplementedError("Unhandled format for year built - implement me") self.standardised_asset_list[self.landlord_year_built] = self.standardised_asset_list[ diff --git a/asset_list/app.py b/asset_list/app.py index 84999e93..45839157 100644 --- a/asset_list/app.py +++ b/asset_list/app.py @@ -246,40 +246,23 @@ def app(): # - We want: fully insulated property (all wall types), EPC D or below (floors should be solid) # - Or the insulation required is loft/cavity (floors should be solid) - data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Colchester" - data_filename = "Warmfront data- Colchester Borough Homes (Complete).xlsx" - sheet_name = "Sheet1" - postcode_column = 'Full Address.1' - fulladdress_column = "Full Address" + # Ealing + data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Ealing/Programme data - 04032025" + data_filename = "Ealing BC - Property Plus Tenure 25.02.2025.xlsx" + sheet_name = "IGNORE - FULL MAIN" + postcode_column = 'Postcode' + fulladdress_column = "Address" address1_column = None address1_method = "first_word" address_cols_to_concat = [] missing_postcodes_method = None - landlord_year_built = "Build Date" + landlord_year_built = "Year Built" landlord_os_uprn = None - landlord_property_type = "Property Type" - landlord_wall_construction = "Wallinsul" - landlord_heating_system = "HeatSorc" + landlord_property_type = "Property Type Code" + landlord_wall_construction = None + landlord_heating_system = None landlord_existing_pv = None - landlord_property_id = "Property Reference" - - # For Westward - # data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Westward" - # data_filename = "WESTWARD - completed list..xlsx" - # sheet_name = "Sheet1" - # postcode_column = "WFT EDIT Postcode" - # fulladdress_column = "Address" - # address1_column = None - # address1_method = "house_number_extraction" - # address_cols_to_concat = [] - # missing_postcodes_method = None - # landlord_year_built = "Build date" - # landlord_os_uprn = "UPRN" - # landlord_property_type = "Location type" - # landlord_wall_construction = "Wall Construction (EPC)" - # landlord_heating_system = "Heat Source" - # landlord_existing_pv = "PV (Y/N)" - # landlord_property_id = "Place ref" + landlord_property_id = "Property Ref" # Maps addresses to uprn in problematic cases manual_uprn_map = {} diff --git a/asset_list/mappings/property_type.py b/asset_list/mappings/property_type.py index 2612f058..ce3cce27 100644 --- a/asset_list/mappings/property_type.py +++ b/asset_list/mappings/property_type.py @@ -21,5 +21,6 @@ PROPERTY_MAPPING = { 'Flat': 'flat', 'House': 'house', 'Maisonette': 'maisonette', - 'Stairwell': 'other' + 'Stairwell': 'other', + 'MAISON': 'maisonette' }