Merge pull request #969 from Hestia-Homes/feature/match-on-lmk

hot fix
This commit is contained in:
KhalimCK 2026-04-10 15:18:46 +01:00 committed by GitHub
commit 4ea7ef0e80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 43 additions and 5 deletions

View file

@ -652,7 +652,8 @@ async def model_engine(body: PlanTriggerRequest):
epc_records["original_epc"]["estimated"] = False
prepared_epc = EPCRecord(
epc_records=epc_records, run_mode="newdata", cleaning_data=cleaning_data, address_metadata=addr
epc_records=epc_records, run_mode="newdata", cleaning_data=cleaning_data,
# address_metadata=addr Switched off to remove injecting landlord inputs
)
input_properties.append(
@ -724,6 +725,10 @@ async def model_engine(body: PlanTriggerRequest):
# 1) EPC expired 2) Missing EPC 3) Different information from landlord vs EPC
needs_rebaselining = p.epc_is_expired | p.epc_is_estimated | (len(p.epc_record.landlord_differences) > 0)
# Hack - skip
if "SAP05" in p.epc_record.walls_description:
continue
if needs_rebaselining:
p.create_base_difference_epc_record(cleaned_lookup=cleaned)
scoring_data = p.base_difference_record.df.copy()

View file

@ -580,7 +580,22 @@ class EPCRecord:
if existing is not None and v is not None and abs(existing - v) > 1: # 1m tolerance
self.landlord_differences[k] = v
else:
if v != self._prepared_epc.get(k) and (not pd.isnull(v)) and (not pd.isnull(self._prepared_epc.get(k))):
# Check if something has been cleaned. We want to avoid triggering re-baselining if we cleaned
# a value. In the address meta, it will possibly contain the original value, so we'd pick up a
# diference if the original value was something to be cleaned, we clean that value and then end up
# comparing the original value to the new clean one
cleaned_value = self._prepared_epc.get(k)
original_value = self.original_epc.get(k.replace("_", "-"))
# We check if the value has been cleaned
if cleaned_value != original_value:
# The thing we want to compare against, is the original value
compare_to = original_value
else:
compare_to = cleaned_value
if v != compare_to and (not pd.isnull(v)) and (not pd.isnull(self._prepared_epc.get(k))):
self.landlord_differences[k] = v
self._prepared_epc.update(self.landlord_differences)

View file

@ -778,6 +778,12 @@ class RetrieveFindMyEpc:
'Air or ground source heat pump': ["air_source_heat_pump"],
"Add PV Battery": ["solar_pv_battery"],
"Add PV diverter": ["solar_pv_diverter"], # Don't have a recommendation yet
"Draughtproof single-glazed windows": ["double_glazing"],
"Upgrade heating controls": ["roomstat_programmer_trvs", "time_temperature_zone_control"],
"Low energy lighting recommendation": ["low_energy_lighting"],
"Install cavity wall insulation": ["cavity_wall_insulation"],
"Install solar water heating": ["solar_water_heating"],
'Install photovoltaics, 25% of roof area': ["solar_pv"],
}
survey = True

View file

@ -140,6 +140,9 @@ class HeatingRecommender:
# All heat systems are in here so we identify whether two of these are true
# MainHeatAttributes.HEAT_SYSTEMS
if "sap05" in self.property.main_heating["clean_description"].lower():
return False
n_trues = 0
for heat_system in MainHeatAttributes.HEAT_SYSTEMS:
if self.property.main_heating[f"has_{heat_system.replace(' ', '_')}"]:
@ -318,6 +321,9 @@ class HeatingRecommender:
:param measures: A list of measures for the recommendations
"""
if "sap05" in self.property.main_heating["clean_description"].lower():
return
measures = MEASURE_MAP["heating"] if measures is None else measures
# if we have a non-invasive ashp recommendation, we get the configuration directly from the property instance

View file

@ -100,6 +100,9 @@ class LightingRecommendations:
:return:
"""
if "sap05" in self.property.lighting["clean_description"].lower():
return
if self.property.lighting["low_energy_proportion"] >= 1:
return

View file

@ -18,7 +18,9 @@ class SecondaryHeating:
def recommend(self, phase: int):
# Reset
self.recommendation = []
if self.property.epc_record.secondheat_description in ["None", None]:
if self.property.epc_record.secondheat_description in ["None", None] or (
"sap05" in self.property.epc_record.secondheat_description.lower()
):
# No secondary heating system, so no recommendation to remove it
return

View file

@ -169,7 +169,7 @@ class WallRecommendations(Definitions):
if (
(insulation_thickness in ["average", "above average"])
or self.property.walls["is_filled_cavity"]
or self.property.walls["clean_description"] is None
or self.property.walls["clean_description"] in [None, "Sap05:walls"]
) and ("cavity_extract_and_refill" not in measures
):
return

View file

@ -45,7 +45,8 @@ class WindowsRecommendations:
measures = MEASURE_MAP["windows"] if measures is None else measures
# If we have no windows recs, leave
if not any(x in measures for x in MEASURE_MAP["windows"]):
if not any(x in measures for x in MEASURE_MAP["windows"]) or "sap05" in self.property.windows[
"clean_description"].lower():
return
if self.property.windows["glazing_type"] in ["triple", "high performance"]: