Merge pull request #502 from Hestia-Homes/funding-engine

added better logging on dupes and adding new types to material table
This commit is contained in:
KhalimCK 2025-09-28 15:34:56 +01:00 committed by GitHub
commit f20ba59320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -578,6 +578,11 @@ class Funding:
return pps.squeeze()["Cost Savings"]
if measure_type == "flat_roof_insulation":
# Not funding for properties starting at C or above
if self.starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"]:
return 0
pps = filtered_pps_matrix[filtered_pps_matrix["Measure_Type"] == "FRI"]
if pps.shape[0] != 1:
raise ValueError("Invalid FRI category")

View file

@ -45,6 +45,8 @@ class MaterialType(enum.Enum):
scaffolding = "scaffolding"
high_heat_retention_storage_heaters = "high_heat_retention_storage_heaters"
sealing_fireplace = "sealing_fireplace"
roomstat_programmer_trvs = "roomstat_programmer_trvs"
time_temperature_zone_control = "time_temperature_zone_control"
class DepthUnit(enum.Enum):

View file

@ -534,7 +534,10 @@ async def model_engine(body: PlanTriggerRequest):
if input_uprns:
# Check for dupes
if len(input_uprns) != len(set(input_uprns)):
raise ValueError("Duplicate UPRNs in the input data")
# Find the duplicate UPRNs
duplicates = set([x for x in input_uprns if input_uprns.count(x) > 1])
# de-dupe input_uprns
raise ValueError(f"Duplicate UPRNs in the input data: {duplicates}")
# If we have patches or overrides, we should read them in here
patches, already_installed, non_invasive_recommendations, valuation_data = get_request_property_data(body)