mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
made adjustment to force any already installed properties to be included in a plan
This commit is contained in:
parent
f918858a34
commit
6f1159e871
5 changed files with 56 additions and 13 deletions
|
|
@ -5,7 +5,7 @@ from backend.app.db.connection import db_read_session
|
|||
from backend.app.db.models.portfolio import PropertyModel, PropertyDetailsEpcModel
|
||||
from backend.app.db.models.recommendations import Plan
|
||||
|
||||
PORTFOLIO_ID = 433
|
||||
PORTFOLIO_ID = 435
|
||||
|
||||
with db_read_session() as session:
|
||||
# Get all properties from PropertyDetailsEpcModel, where estimated is True, for portfolio 419
|
||||
|
|
@ -49,12 +49,13 @@ sal = sal.drop_duplicates(subset=['epc_os_uprn'])
|
|||
estimated_to_refresh = sal[sal["epc_os_uprn"].isin(estimated_uprns_list)].copy()
|
||||
|
||||
SCENARIOS = [
|
||||
871, # EPC C - fabric first, no solid floor, ashp 3.0
|
||||
863, # EPC B, No EWI/IWI, No Solid Floor, ASHP 3.0 COP
|
||||
862, # EPC B - No solid floor, ASHP COP 3.0
|
||||
861, # EPC C, No EWI/IWI, No Solid Floor, ASHP 3.0 COP
|
||||
859, # EPC C - no solid floor, ashp 3.0
|
||||
885, # EPC B - fabric first, no solid floor, ashp 3.0
|
||||
# 871, # EPC C - fabric first, no solid floor, ashp 3.0
|
||||
# 863, # EPC B, No EWI/IWI, No Solid Floor, ASHP 3.0 COP
|
||||
# 862, # EPC B - No solid floor, ASHP COP 3.0
|
||||
# 861, # EPC C, No EWI/IWI, No Solid Floor, ASHP 3.0 COP
|
||||
# 859, # EPC C - no solid floor, ashp 3.0
|
||||
# 885, # EPC B - fabric first, no solid floor, ashp 3.0
|
||||
908, 909, 910
|
||||
]
|
||||
|
||||
# Get all plans, associated to these properties - the property IDs are in estimated_epc_ids
|
||||
|
|
|
|||
|
|
@ -459,3 +459,33 @@ modelled_epc_band_comparison = reduced_sample["SAP Band"].value_counts(
|
|||
right_on="SAP Band",
|
||||
suffixes=("_reduced_sample", "_overall")
|
||||
)
|
||||
|
||||
# Testing measures
|
||||
m1 = pd.read_excel(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/Final SAL/EPC C - no "
|
||||
"solid floor, ashp 3.0 - 20250113 final.xlsx"
|
||||
)
|
||||
m2 = pd.read_excel(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/Final SAL/EPC C - no "
|
||||
"solid floor, no EWI or IWI, ashp 3.0 - 20250113 final.xlsx"
|
||||
)
|
||||
|
||||
compare = m1.merge(
|
||||
m2,
|
||||
left_on="uprn",
|
||||
right_on="uprn",
|
||||
suffixes=("_ewi_iwi", "_no_ewi_iwi")
|
||||
)
|
||||
|
||||
# Which properties get done under the no EWI/IWI scenario that do not under the EWI/IWI scenario
|
||||
only_no_ewi_iwi = compare[
|
||||
(compare["total_retrofit_cost_ewi_iwi"] == 0) &
|
||||
(compare["total_retrofit_cost_no_ewi_iwi"] != 0)
|
||||
]
|
||||
|
||||
(m1["total_retrofit_cost"] > 0).sum()
|
||||
(m2["total_retrofit_cost"] > 0).sum()
|
||||
|
||||
with_ewi_projects = compare[compare["total_retrofit_cost_no_ewi_iwi"] > 0]
|
||||
|
||||
z = with_ewi_projects[pd.isnull(with_ewi_projects["total_retrofit_cost_ewi_iwi"])]
|
||||
|
|
|
|||
|
|
@ -86,6 +86,18 @@ class Recommendations:
|
|||
|
||||
inclusions_full = [MEASURE_MAP[x] if x in MEASURE_MAP else x for x in self.inclusions]
|
||||
exclusions_full = [MEASURE_MAP[x] if x in MEASURE_MAP else x for x in self.exclusions]
|
||||
|
||||
# if we have already installed measures, we need to include them so they get factored into the baseline
|
||||
# this is something we'll likely need to remove
|
||||
if self.property_instance.already_installed:
|
||||
# We make sure that any already installed measures are included
|
||||
for rec in self.property_instance.already_installed:
|
||||
if rec not in inclusions_full:
|
||||
inclusions_full.append(rec)
|
||||
|
||||
# We remove them from the exclusions if they are there
|
||||
exclusions_full = [e for e in exclusions_full if e not in self.property_instance.already_installed]
|
||||
|
||||
# We need to unlist any lists, but we should check if they're lists first
|
||||
inclusions_full = [
|
||||
item for sublist in inclusions_full for item in (sublist if isinstance(sublist, list) else [sublist])
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ from collections import defaultdict
|
|||
# SCENARIOS = [389]
|
||||
PORTFOLIO_ID = 435 # Peabody
|
||||
SCENARIOS = [
|
||||
908,
|
||||
909,
|
||||
# 910,
|
||||
# 908,
|
||||
# 909,
|
||||
910,
|
||||
]
|
||||
scenario_names = {
|
||||
908: "EPC C - no solid floor, ashp 3.0",
|
||||
909: "EPC C - no solid floor, no EWI or IWI, ashp 3.0",
|
||||
# 910: "EPC B - no solid floor, no EWI, ashp 3.0"
|
||||
# 908: "EPC C - no solid floor, ashp 3.0",
|
||||
# 909: "EPC C - no solid floor, no EWI or IWI, ashp 3.0",
|
||||
910: "EPC B - no solid floor, no EWI, ashp 3.0"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue