mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
fixing string non-invasive recs
This commit is contained in:
parent
5764175e32
commit
85f73eda5c
1 changed files with 16 additions and 2 deletions
|
|
@ -325,12 +325,26 @@ def extract_propert_on_site_recommendations(config, already_installed, non_invas
|
|||
x for x in non_invasive_recommendations if
|
||||
(x["uprn"] == uprn)
|
||||
), {})
|
||||
|
||||
# We patch the non-invasive recs that are ['cavity_extract_and_refill']
|
||||
else:
|
||||
property_non_invasive_recommendations = next((
|
||||
x for x in non_invasive_recommendations if
|
||||
(x["address"] == config["address"]) and (x["postcode"] == config["postcode"])
|
||||
), {})
|
||||
|
||||
if isinstance(property_non_invasive_recommendations["recommendations"], str):
|
||||
import ast
|
||||
property_non_invasive_recommendations["recommendations"] = ast.literal_eval(
|
||||
property_non_invasive_recommendations["recommendations"]
|
||||
)
|
||||
transformed = []
|
||||
for rec in property_non_invasive_recommendations["recommendations"]:
|
||||
if isinstance(rec, str):
|
||||
transformed.append({"type": rec, })
|
||||
|
||||
property_non_invasive_recommendations["recommendations"] = str(transformed)
|
||||
|
||||
return property_already_installed, property_non_invasive_recommendations
|
||||
|
||||
|
||||
|
|
@ -469,8 +483,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
epcs_for_scoring = kwh_client.transform(data=kwh_client.prepare_epc(input_properties), cleaned=cleaned)
|
||||
|
||||
kwh_preds = model_api.predict_all(
|
||||
df=epcs_for_scoring,
|
||||
kwh_preds = model_api.paginated_predictions(
|
||||
data=epcs_for_scoring,
|
||||
bucket=get_settings().DATA_BUCKET,
|
||||
model_prefixes=["heating_kwh_predictions", "hotwater_kwh_predictions"],
|
||||
extract_ids=False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue