diff --git a/backend/engine/engine.py b/backend/engine/engine.py index f4bffb17..fa1f191c 100644 --- a/backend/engine/engine.py +++ b/backend/engine/engine.py @@ -484,12 +484,19 @@ async def model_engine(body: PlanTriggerRequest): plan_input["uprn"] = np.where(plan_input["estimated"].isin([1, True]), None, plan_input["uprn"]) # We handle the landlord property type and built form plan_input["property_type"] = plan_input["landlord_property_type"].copy() - plan_input["built_form"] = plan_input["landlord_built_form"].copy() + if "landlord_built_form" in plan_input.columns: + plan_input["built_form"] = plan_input["landlord_built_form"].copy() + else: + plan_input["built_form"] = None plan_input["property_type"] = np.where( plan_input["property_type"] == "unknown", plan_input["epc_property_type"], plan_input["property_type"] ) + + if "epc_archetype" not in plan_input.columns: + plan_input["epc_archetype"] = None + plan_input["built_form"] = np.where( plan_input["built_form"] == "unknown", plan_input["epc_archetype"], plan_input["built_form"] )