diff --git a/backend/Property.py b/backend/Property.py index bc5660e8..dd92a902 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -1078,7 +1078,12 @@ class Property: elif self.floor["thermal_transmittance"] is not None: self.floor_type = "solid" else: - raise NotImplementedError("Implement this floor type") + # in this case, it's not super clear what the floor type is, so we default - this is a temp + logger.warning( + f"Could not determine floor type, given: '{self.floor['original_description']}', defaulting to " + f"suspended for property {self.uprn}" + ) + self.floor_type = "suspended" @staticmethod def _extract_component( diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 9216eac0..3ec1bf5f 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -120,7 +120,9 @@ async def trigger_plan_entrypoint(body: PlanTriggerRequest): f"Chunk {i} sent to SQS. Rows {index_start}–{index_end}. Message ID: {response.get('MessageId')}" ) - await asyncio.sleep(random.uniform(0.1, 0.5)) # Delay to reduce spike pressure + await asyncio.sleep(0.1) # Small delay to avoid SQS throttling + + # await asyncio.sleep(random.uniform(0.1, 0.5)) # Delay to reduce spike pressure except Exception as e: logger.error("Error during Excel file handling: %s", e) diff --git a/etl/customers/peabody/Nov 2025 Consulting Project/data_prep.py b/etl/customers/peabody/Nov 2025 Consulting Project/data_prep.py index e05d82e4..76871b39 100644 --- a/etl/customers/peabody/Nov 2025 Consulting Project/data_prep.py +++ b/etl/customers/peabody/Nov 2025 Consulting Project/data_prep.py @@ -210,9 +210,9 @@ archetypes = sustainability_data[archetype_variables + ["UPRN"]].dropna().groupb archetypes["Cumulative Count"] = archetypes["Count"].cumsum() archetypes["Cumulative Proportion"] = archetypes["Cumulative Count"] / archetypes["Count"].sum() -archetypes_85 = archetypes[archetypes["Cumulative Proportion"] <= 0.80] -archetypes_85["Archetypes_85_reference"] = archetypes_85.index + 1 -archetypes_85["Archetypes_85_reference"] = "Archetype_Sample_" + archetypes_85["Archetypes_85_reference"].astype(str) +archetypes_95 = archetypes[archetypes["Cumulative Proportion"] <= 0.97] +archetypes_95["Archetypes_95_reference"] = archetypes_95.index + 1 +archetypes_95["Archetypes_95_reference"] = "Archetype_Sample_" + archetypes_95["Archetypes_95_reference"].astype(str) # For the sample, look for invalid looking UPRNs and remove them. sample_from = sustainability_data.copy() @@ -227,13 +227,13 @@ sample_from = sample_from[~pd.isnull(sample_from["UPRN"])] # We now take a sample of the properties that represent 85% of the total properties sample_from = sample_from.merge( - archetypes_85, + archetypes_95, on=archetype_variables, how="inner" ) -# We take 1 random property, by archetype 85 reference -modelling_sample = sample_from.groupby("Archetypes_85_reference").apply( +# We take 1 random property, by archetype reference +modelling_sample = sample_from.groupby("Archetypes_95_reference").apply( lambda x: x.sample(1, random_state=42) ).reset_index(drop=True) @@ -248,7 +248,7 @@ def compare_distributions(full_df, sample_df, column): for col in archetype_variables: print(f"--- {col} ---") - print(compare_distributions(sustainability_data, modelling_sample, col)) + print(compare_distributions(sustainability_data, sample_from, col)) # prepare modelling_sample["domna_property_id"] = modelling_sample.index + 1 @@ -263,7 +263,7 @@ modelling_sample = modelling_sample.rename( } ) -modelling_sample["domna_built_form"] = modelling_sample["domna_built_form"].map( +modelling_sample["landlord_built_form"] = modelling_sample["landlord_built_form"].map( { "MidTerrace": "Mid-Terrace", "EndTerrace": "End-Terrace", @@ -274,7 +274,7 @@ modelling_sample["domna_built_form"] = modelling_sample["domna_built_form"].map( } ) -if pd.isnull(modelling_sample["domna_built_form"]).sum(): +if pd.isnull(modelling_sample["landlord_built_form"]).sum(): raise ValueError("Some built forms are null after mapping") @@ -292,7 +292,7 @@ modelling_sample.to_excel( "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/modelling_sample.xlsx", ) # Save the archetype definitions -archetypes_85.to_excel( +archetypes_95.to_excel( "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Peabody/Nov 2025 Consulting Project/archetypes_85.xlsx", ) # Save the full archetypes diff --git a/etl/find_my_epc/RetrieveFindMyEpc.py b/etl/find_my_epc/RetrieveFindMyEpc.py index 2e23c7e6..e0370725 100644 --- a/etl/find_my_epc/RetrieveFindMyEpc.py +++ b/etl/find_my_epc/RetrieveFindMyEpc.py @@ -684,6 +684,7 @@ class RetrieveFindMyEpc: "Heating controls recommendation": [], "Replace boiler with Band A condensing boiler": ["boiler_upgrade"], "Band A condensing gas boiler": ["boiler_upgrade"], + "Install Band A condensing heating unit": ["boiler_upgrade"], "Solar panel recommendation": [], "Double glazing recommendation": [], "Solid wall insulation recommendation": [],