handling the case of landlord property id being missing

This commit is contained in:
Khalim Conn-Kowlessar 2025-02-24 16:52:42 +00:00
parent 99a0948e2b
commit 5391afeaaa
2 changed files with 32 additions and 28 deletions

View file

@ -378,7 +378,7 @@ class AssetList:
self.keep_variables = []
# Finally, we handle the case where the landlord's property ID is actually the OS UPRN
if self.landlord_uprn == self.landlord_property_id:
if (self.landlord_uprn == self.landlord_property_id) and (self.landlord_property_id is not None):
self.standardised_asset_list[self.STANDARD_UPRN] = self.standardised_asset_list[self.landlord_uprn].copy()
# Update the reference to landlord UPRn
self.landlord_uprn = self.STANDARD_UPRN

View file

@ -240,39 +240,43 @@ 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"
ADDRESS1_COLUMN = None
ADDRESS1_METHOD = "first_word"
ADDRESS_COLS_TO_CONCAT = []
MISSING_POSTCODES_METHOD = None
PROPERTY_YEAR_BUILT = "Build Date"
UPRN_COLUMN = None
PROPERTY_TYPE_COLUMN = None
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"
address1_column = None
address1_method = "first_word"
address_cols_to_concat = []
missing_postcodes_method = None
landlord_year_built = "Build Date"
landlord_os_uprn = None
landlord_property_type = "Property Type"
landlord_wall_construction = "Wallinsul"
landlord_heating_system = "HeatSorc"
landlord_existing_pv = None
landlord_property_id = None
# Maps addresses to uprn in problematic cases
MANUAL_UPRN_MAP = {}
asset_list = AssetList(
local_filepath=os.path.join(DATA_FOLDER, DATA_FILENAME),
local_filepath=os.path.join(data_folder, data_filename),
header=0,
sheet_name=SHEET_NAME,
address1_colname=ADDRESS1_COLUMN,
postcode_colname=POSTCODE_COLUMN,
landlord_property_id="UPRN",
full_address_colname=FULLADDRESS_COLUMN,
full_address_cols_to_concat=ADDRESS_COLS_TO_CONCAT,
missing_postcodes_method=MISSING_POSTCODES_METHOD,
address1_extraction_method=ADDRESS1_METHOD,
landlord_year_built=PROPERTY_YEAR_BUILT,
landlord_uprn=UPRN_COLUMN,
landlord_property_type=PROPERTY_TYPE_COLUMN,
landlord_wall_construction="Wall Construction (EPC)",
landlord_heating_system="Heat Source",
landlord_existing_pv="PV (Y/N)"
sheet_name=sheet_name,
address1_colname=address1_column,
postcode_colname=postcode_column,
landlord_property_id=landlord_property_id,
full_address_colname=fulladdress_column,
full_address_cols_to_concat=address_cols_to_concat,
missing_postcodes_method=missing_postcodes_method,
address1_extraction_method=address1_method,
landlord_year_built=landlord_year_built,
landlord_uprn=landlord_os_uprn,
landlord_property_type=landlord_property_type,
landlord_wall_construction=landlord_wall_construction,
landlord_heating_system=landlord_heating_system,
landlord_existing_pv=landlord_existing_pv
)
asset_list.init_standardise()