mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
preparing southern asset lists
This commit is contained in:
parent
8a656cbff8
commit
7c3d8caea4
5 changed files with 53 additions and 37 deletions
|
|
@ -1996,24 +1996,6 @@ class AssetList:
|
||||||
self.standardised_asset_list[col]
|
self.standardised_asset_list[col]
|
||||||
)
|
)
|
||||||
|
|
||||||
blocks_of_flats = self.standardised_asset_list[
|
|
||||||
self.standardised_asset_list[self.STANDARD_PROPERTY_TYPE] == "block of flats"
|
|
||||||
]
|
|
||||||
|
|
||||||
non_blocks_of_flats = self.standardised_asset_list[
|
|
||||||
self.standardised_asset_list[self.STANDARD_PROPERTY_TYPE] != "block of flats"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Produce some aggregate figures
|
|
||||||
self.work_type_figures = {
|
|
||||||
**non_blocks_of_flats["cavity_reason"].value_counts().to_dict(),
|
|
||||||
**{
|
|
||||||
k + " (Block of flats)": v for k, v in
|
|
||||||
blocks_of_flats["solar_reason"].value_counts().to_dict().items()
|
|
||||||
},
|
|
||||||
**self.standardised_asset_list["solar_reason"].value_counts().to_dict()
|
|
||||||
}
|
|
||||||
|
|
||||||
# We prepare outcomes for output
|
# We prepare outcomes for output
|
||||||
if self.outcomes is not None:
|
if self.outcomes is not None:
|
||||||
logger.info("Preparing outcomes for output")
|
logger.info("Preparing outcomes for output")
|
||||||
|
|
@ -2044,6 +2026,26 @@ class AssetList:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_work_figures(self):
|
||||||
|
blocks_of_flats = self.standardised_asset_list[
|
||||||
|
self.standardised_asset_list[self.STANDARD_PROPERTY_TYPE] == "block of flats"
|
||||||
|
]
|
||||||
|
|
||||||
|
non_blocks_of_flats = self.standardised_asset_list[
|
||||||
|
self.standardised_asset_list[self.STANDARD_PROPERTY_TYPE] != "block of flats"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Produce some aggregate figures
|
||||||
|
self.work_type_figures = {
|
||||||
|
**non_blocks_of_flats["cavity_reason"].value_counts().to_dict(),
|
||||||
|
**{
|
||||||
|
k + " (Block of flats)": v for k, v in
|
||||||
|
blocks_of_flats["solar_reason"].value_counts().to_dict().items()
|
||||||
|
},
|
||||||
|
**self.standardised_asset_list["solar_reason"].value_counts().to_dict()
|
||||||
|
}
|
||||||
|
pprint(self.work_type_figures)
|
||||||
|
|
||||||
def fill_landlord_block_reference(self, has_blocks_of_flats):
|
def fill_landlord_block_reference(self, has_blocks_of_flats):
|
||||||
if not has_blocks_of_flats:
|
if not has_blocks_of_flats:
|
||||||
return
|
return
|
||||||
|
|
@ -3245,6 +3247,8 @@ class AssetList:
|
||||||
scheme_col = "AFFORDABLE WARMTH"
|
scheme_col = "AFFORDABLE WARMTH"
|
||||||
elif "Scheme" in master_data.columns:
|
elif "Scheme" in master_data.columns:
|
||||||
scheme_col = "Scheme"
|
scheme_col = "Scheme"
|
||||||
|
elif "Affordable Warmth" in master_data.columns:
|
||||||
|
scheme_col = "Affordable Warmth"
|
||||||
else:
|
else:
|
||||||
scheme_col = "OFFICE USE ONLY"
|
scheme_col = "OFFICE USE ONLY"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,26 +59,26 @@ def app():
|
||||||
Property UPRN
|
Property UPRN
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Southern - Optivo list
|
# Southern - Jan list
|
||||||
data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Southern/New Programme"
|
data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Southern/New Programme/Jan 2025 List"
|
||||||
data_filename = "OPTIVO List for Warmfront.xlsx"
|
data_filename = "SOUTHERN ASSETS January 2025 Additions Query 21.03.2025.xlsx"
|
||||||
sheet_name = "AddressProfilingResults"
|
sheet_name = "Jan 2025 additions"
|
||||||
postcode_column = 'PostCode'
|
postcode_column = 'Post Code'
|
||||||
fulladdress_column = "Address"
|
fulladdress_column = None
|
||||||
address1_column = None
|
address1_column = "NO."
|
||||||
address1_method = "house_number_extraction"
|
address1_method = None
|
||||||
address_cols_to_concat = []
|
address_cols_to_concat = ["NO.", "Street / Block Name", "Town/Area"]
|
||||||
missing_postcodes_method = None
|
missing_postcodes_method = None
|
||||||
landlord_year_built = "Age"
|
landlord_year_built = None
|
||||||
landlord_os_uprn = None
|
landlord_os_uprn = None
|
||||||
landlord_property_type = None
|
landlord_property_type = "Archetype" # Using the inspections property type
|
||||||
landlord_built_form = None
|
landlord_built_form = "Archetype"
|
||||||
landlord_wall_construction = "Walls"
|
landlord_wall_construction = None
|
||||||
landlord_roof_construction = "Roofs"
|
landlord_roof_construction = None
|
||||||
landlord_heating_system = "Heating"
|
landlord_heating_system = None
|
||||||
landlord_existing_pv = None
|
landlord_existing_pv = None
|
||||||
landlord_property_id = "OrganisationReference"
|
landlord_property_id = "SH Property Reference"
|
||||||
landlord_sap = "SAP (9.92)"
|
landlord_sap = None
|
||||||
outcomes_filename = [
|
outcomes_filename = [
|
||||||
os.path.join(data_folder, "RT - Southern Housing Group - JJC.xlsx"),
|
os.path.join(data_folder, "RT - Southern Housing Group - JJC.xlsx"),
|
||||||
os.path.join(data_folder, "RT - SOUTHERN OUTCOMES - SCIS Merged.xlsx"),
|
os.path.join(data_folder, "RT - SOUTHERN OUTCOMES - SCIS Merged.xlsx"),
|
||||||
|
|
@ -634,6 +634,7 @@ def app():
|
||||||
# We now flag the status of the property
|
# We now flag the status of the property
|
||||||
asset_list.label_property_status()
|
asset_list.label_property_status()
|
||||||
asset_list.analyse_geographies()
|
asset_list.analyse_geographies()
|
||||||
|
asset_list.get_work_figures()
|
||||||
|
|
||||||
# Store as an excel
|
# Store as an excel
|
||||||
filename = os.path.join(data_folder, ".".join(data_filename.split(".")[:-1])) + " - Standardised.xlsx"
|
filename = os.path.join(data_folder, ".".join(data_filename.split(".")[:-1])) + " - Standardised.xlsx"
|
||||||
|
|
|
||||||
|
|
@ -340,4 +340,6 @@ HEATING_MAPPINGS = {
|
||||||
'Electric Storage Systems: Integrated storage+direct-acting heater': 'electric storage heaters',
|
'Electric Storage Systems: Integrated storage+direct-acting heater': 'electric storage heaters',
|
||||||
'Boiler: D rated Combi': 'gas condensing combi',
|
'Boiler: D rated Combi': 'gas condensing combi',
|
||||||
'Heat Pump: (from database)': 'air source heat pump',
|
'Heat Pump: (from database)': 'air source heat pump',
|
||||||
|
'Community Heating Systems: Community CHP and boilers (RdSAP)': 'communal heating',
|
||||||
|
'': 'unknown'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,4 +171,8 @@ ROOF_CONSTRUCTION_MAPPINGS = {
|
||||||
'PitchedNormalLoftAccess: 250mm, PitchedNormalLoftAccess: 50mm': 'pitched insulated',
|
'PitchedNormalLoftAccess: 250mm, PitchedNormalLoftAccess: 50mm': 'pitched insulated',
|
||||||
'AnotherDwellingAbove: Unknown, PitchedNormalLoftAccess: 200mm': 'another dwelling above',
|
'AnotherDwellingAbove: Unknown, PitchedNormalLoftAccess: 200mm': 'another dwelling above',
|
||||||
|
|
||||||
|
'PitchedNormalNoLoftAccess: Unknown': 'pitched no access to loft',
|
||||||
|
'PitchedNormalLoftAccess: Unknown': 'pitched unknown insulation',
|
||||||
|
'AnotherDwellingAbove: Unknown': 'another dwelling above'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import time
|
import time
|
||||||
import numpy as np
|
import random
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from backend.SearchEpc import SearchEpc
|
from backend.SearchEpc import SearchEpc
|
||||||
from etl.find_my_epc.RetrieveFindMyEpc import RetrieveFindMyEpc
|
from etl.find_my_epc.RetrieveFindMyEpc import RetrieveFindMyEpc
|
||||||
|
|
@ -172,7 +172,7 @@ def get_data(
|
||||||
find_epc_data = {}
|
find_epc_data = {}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Error retrieving FindMyEPC data: {e}")
|
raise Exception(f"Error retrieving FindMyEPC data: {e}")
|
||||||
time.sleep(np.random.uniform(0.1, 1))
|
time.sleep(random.sample(range(50, 100), 1)[0] / 100)
|
||||||
|
|
||||||
epc = {
|
epc = {
|
||||||
row_id_name: home[row_id_name],
|
row_id_name: home[row_id_name],
|
||||||
|
|
@ -182,6 +182,11 @@ def get_data(
|
||||||
}
|
}
|
||||||
|
|
||||||
epc_data.append(epc)
|
epc_data.append(epc)
|
||||||
|
|
||||||
|
if len(epc_data) % 50 == 0 and len(epc_data) > 0:
|
||||||
|
logger.info("Sleeping for 10 seconds to avoid hitting API rate limit")
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append(home[row_id_name])
|
errors.append(home[row_id_name])
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue