From 7b0fd45fe207e8ad993e04e7a2f4319f01427e96 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 6 May 2025 19:56:36 +0100 Subject: [PATCH] handling retrieveing find my epc when we're passing a flat --- backend/engine/engine.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/engine/engine.py b/backend/engine/engine.py index faa1ed94..408d044e 100644 --- a/backend/engine/engine.py +++ b/backend/engine/engine.py @@ -509,10 +509,18 @@ async def model_engine(body: PlanTriggerRequest): # if we have a remote assment data type, we pull the additional data and include it if body.event_type == "remote_assessment": logger.info("Retrieving find my epc data") - for k in ["address", "address1"]: - epc_searcher.newest_epc[k] = epc_searcher.address_clean + try: + property_non_invasive_recommendations, patch = RetrieveFindMyEpc.get_from_epc( + epc_searcher.newest_epc + ) + except Exception as e: + logger.error(f"Failed to retrieve without cleaning address {e}") + for k in ["address", "address1"]: + epc_searcher.newest_epc[k] = epc_searcher.address_clean + property_non_invasive_recommendations, patch = RetrieveFindMyEpc.get_from_epc( + epc_searcher.newest_epc + ) - property_non_invasive_recommendations, patch = RetrieveFindMyEpc.get_from_epc(epc_searcher.newest_epc) # If we have a property type, this means when we pull the epc data, we might need to make a patch epc_records = patch_epc(patch, epc_records)