From 866166c022cc703d5026cff255d0b264b58d893a Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 11 Feb 2026 12:41:37 +0000 Subject: [PATCH] handle typing error for addreses class --- .idea/inspectionProfiles/profiles_settings.xml | 1 + asset_list/app.py | 18 +++++++++--------- asset_list/mappings/roof.py | 14 +++++++++++++- asset_list/mappings/walls.py | 8 +++++++- asset_list/utils.py | 6 +++--- backend/addresses/Addresses.py | 4 ++++ 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml index 105ce2da..dd4c951e 100644 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -1,5 +1,6 @@ + diff --git a/asset_list/app.py b/asset_list/app.py index 30172121..13a6a025 100644 --- a/asset_list/app.py +++ b/asset_list/app.py @@ -69,24 +69,24 @@ def app(): Property UPRN """ - data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Aspire" - data_filename = "ASPIRE ASSET LIST.xlsx" - sheet_name = "Asset List" - postcode_column = "Postcode" + data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/West Kent" + data_filename = "West Kent Asset List.xlsx" + sheet_name = "Sheet1" + postcode_column = "POSTCODE" address1_column = None address1_method = "house_number_extraction" - fulladdress_column = "Address" + fulladdress_column = "ADDRESS" address_cols_to_concat = [] missing_postcodes_method = None landlord_year_built = None landlord_os_uprn = None - landlord_property_type = "Property Type" + landlord_property_type = "PROPERTY TYPE" landlord_built_form = None - landlord_wall_construction = None - landlord_roof_construction = None + landlord_wall_construction = "wall combined" + landlord_roof_construction = "HEATING SYSTEM" landlord_heating_system = None landlord_existing_pv = None - landlord_property_id = "LLUPRN" + landlord_property_id = "UPRN" landlord_sap = None outcomes_filename = None outcomes_sheetname = None diff --git a/asset_list/mappings/roof.py b/asset_list/mappings/roof.py index cf829a5f..70cc8742 100644 --- a/asset_list/mappings/roof.py +++ b/asset_list/mappings/roof.py @@ -308,6 +308,18 @@ ROOF_CONSTRUCTION_MAPPINGS = { 'Flat: No Insulation': 'flat uninsulated', 'AnotherDwellingAbove: Unknown, PitchedNormalLoftAccess: 250mm': 'another dwelling above', 'PitchedNormalLoftAccess: 175mm': 'pitched insulated', - 'AnotherDwellingAbove: 300mm': 'another dwelling above' + 'AnotherDwellingAbove: 300mm': 'another dwelling above', + + 'Another dwelling above, As built': 'another dwelling above', + 'Pitched (slates or tiles) no loft access, 400mm+': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 400mm+': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 300mm': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 75mm': 'pitched less than 100mm insulation', + 'Pitched (slates or tiles) no loft access, 300mm': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 270mm': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 100mm': 'pitched insulated', + 'Pitched (slates or tiles) no loft access, 200mm': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 200mm': 'pitched insulated', + 'Pitched (slates or tiles) access to loft, 50mm': 'pitched less than 100mm insulation' } diff --git a/asset_list/mappings/walls.py b/asset_list/mappings/walls.py index 1bb02a9a..1a252b33 100644 --- a/asset_list/mappings/walls.py +++ b/asset_list/mappings/walls.py @@ -363,6 +363,12 @@ WALL_CONSTRUCTION_MAPPINGS = { 'Timber Frame, As Built': 'timber frame unknown insulation', 'Solid Brick, Internal Insulation': 'insulated solid brick', 'Granite or Whinstone, As Built': 'granite or whinstone unknown insulation', - 'Solid Brick, External': 'insulated solid brick' + 'Solid Brick, External': 'insulated solid brick', + + 'Cavity, Filled cavity': 'filled cavity', + 'Solid Brick, As built': 'solid brick unknown insulation', + 'System built, As built': 'system built unknown insulation', + 'Timber frame, As built': 'timber frame unknown insulation', + 'Cavity, As built': 'cavity unknown insulation' } diff --git a/asset_list/utils.py b/asset_list/utils.py index 8746c03a..d83a35f2 100644 --- a/asset_list/utils.py +++ b/asset_list/utils.py @@ -220,7 +220,7 @@ def get_data( searcher.find_property(skip_os=True) # Check if we have a flat or appartment - if searcher.newest_epc is None and uprn is None: + if not searcher.newest_epc and uprn is None: # Try again: if SearchEpc.get_house_number(address=str(house_number), postcode=postcode) is None: # Backup @@ -252,12 +252,12 @@ def get_data( searcher.find_property(skip_os=True) # As a final resort, we estimate the EPC - if property_type is not None and searcher.newest_epc is None: + if property_type is not None and not searcher.newest_epc: searcher.ordnance_survey_client.property_type = property_type searcher.ordnance_survey_client.built_form = built_form searcher.find_property(skip_os=True) - if searcher.newest_epc is None: + if not searcher.newest_epc: no_epc.append(home[row_id_name]) continue diff --git a/backend/addresses/Addresses.py b/backend/addresses/Addresses.py index 22822c6b..e81fef50 100644 --- a/backend/addresses/Addresses.py +++ b/backend/addresses/Addresses.py @@ -1,3 +1,4 @@ +from typing import Iterator from backend.addresses.Address import Address @@ -12,6 +13,9 @@ class Addresses: def __len__(self) -> int: return len(self._addresses) + def __iter__(self) -> Iterator[Address]: + return iter(self._addresses) + @classmethod def from_plan_input(cls, plan_input: list[dict], body) -> "Addresses": addresses = []