debugging mds without optimisation

This commit is contained in:
Khalim Conn-Kowlessar 2024-06-05 12:11:59 +01:00
parent 4cc534c333
commit acc45eae64
2 changed files with 20 additions and 5 deletions

View file

@ -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)
)

View file

@ -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)