Merge pull request #678 from Hestia-Homes/portfolio-diagnostics

removing bug which is double removing installed SAP
This commit is contained in:
KhalimCK 2026-01-14 02:14:43 +00:00 committed by GitHub
commit 941be42b83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -1118,7 +1118,7 @@ async def model_engine(body: PlanTriggerRequest):
p=p,
input_measures=input_measures,
budget=body.budget,
target_gain=gain - already_installed_sap,
target_gain=gain,
enforce_heat_pump_insulation=True,
enforce_fabric_first=body.enforce_fabric_first,
already_installed_sap=already_installed_sap, # To be passed to output

View file

@ -11,14 +11,13 @@ from etl.customers.cambridge.surveys import current_epc
with db_session() as session:
# We need installed measures, where the measure type is ewi or iwi
installed_measures = session.query(InstalledMeasure).filter(
InstalledMeasure.measure_type.in_(["external_wall_insulation", "internal_wall_insulation"])
InstalledMeasure.measure_type.in_(["cavity_wall_insulation"])
).all()
# Get the uprns
installed_uprns = [x.uprn for x in installed_measures]
installed_uprns = list(set(installed_uprns))
# This is 21425 properties.
# We then create a portfolio of properties we need to re-run
import pandas as pd
@ -33,7 +32,7 @@ needing_retry = sal[sal["epc_os_uprn"].isin(installed_uprns)]
# Store
needing_retry.to_excel(
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/Final "
"SAL/properties_needing_retry_20260115.xlsx",
"SAL/properties_needing_retry_20260115 - cavity wall insulation.xlsx",
sheet_name="Standardised Asset List",
index=False
)