handle typing error for addreses class

This commit is contained in:
Khalim Conn-Kowlessar 2026-02-11 12:41:37 +00:00
parent d4064da365
commit 866166c022
6 changed files with 37 additions and 14 deletions

View file

@ -1,5 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Default" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>

View file

@ -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

View file

@ -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'
}

View file

@ -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'
}

View file

@ -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

View file

@ -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 = []