From acc45eae646745e8190a3a6f051061418dcfb944 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 5 Jun 2024 12:11:59 +0100 Subject: [PATCH] debugging mds without optimisation --- backend/app/plan/router.py | 15 +++++++++++---- etl/customers/eon/pilot_asset_list.py | 10 +++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index f6c01715..e0add281 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -661,10 +661,14 @@ async def build_mds(body: MdsRequest): epc_searcher.find_property(skip_os=True) if config["address"] == "35b High Street": - print("Performing temporary patch") + print("Performing temporary patch on 35b High Street") epc_searcher.newest_epc["uprn"] = 10002911892 epc_searcher.full_sap_epc["uprn"] = 10002911892 + if config["address"] == "Cobnut Barn": + print("Performing temporary patch on Cobnut Barn") + epc_searcher.newest_epc["uprn"] = 10013924689 + # Create a record in db # TODO: If we productionise the creation of this mds report, we will need to store this in the db # property_id, is_new = create_property( @@ -750,8 +754,12 @@ async def build_mds(body: MdsRequest): mds = Mds(property_instance=p, materials=materials, optimise_measures=optimise_measures) mds_recommendations, property_representative_recommendations, errors = mds.build() - if any([len(x) for x in errors.values()]): - raise Exception("Errors occurred during MDS build") + if isinstance(errors, list): + if errors: + raise Exception("Errors occurred during MDS build") + else: + if any([len(x) for x in errors.values()]): + raise Exception("Errors occurred during MDS build") recommendations[p.id] = mds_recommendations representative_recommendations[p.id] = property_representative_recommendations @@ -778,7 +786,6 @@ async def build_mds(body: MdsRequest): recommendations_scoring_data.extend(data) else: - recommendations_scoring_data.append( p.simulate_all_representative_recommendations(property_representative_recommendations) ) diff --git a/etl/customers/eon/pilot_asset_list.py b/etl/customers/eon/pilot_asset_list.py index b7c529e3..05e459cb 100644 --- a/etl/customers/eon/pilot_asset_list.py +++ b/etl/customers/eon/pilot_asset_list.py @@ -229,7 +229,8 @@ def app(): "35a High Street", "35b High Street", "Flat Over 20 Holborough Road", - "Flat above 7 Malling Road" + "Flat above 7 Malling Road", + "Cobnut Barn", ]: print(config["Address"]) uprn = None @@ -292,3 +293,10 @@ def app(): "measures": measures, "budget": None, } + + +output = [] +for r in self.results: + output.append(r["DPA"]) + +output = pd.DataFrame(output)