mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
integrating windows recommendations into engine api
This commit is contained in:
parent
7282800240
commit
c6247f331a
6 changed files with 26 additions and 9 deletions
2
.idea/Model.iml
generated
2
.idea/Model.iml
generated
|
|
@ -7,7 +7,7 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (model_data)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (backend)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyNamespacePackagesService">
|
||||
|
|
|
|||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -3,7 +3,7 @@
|
|||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.10 (backend)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (model_data)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (backend)" project-jdk-type="Python SDK" />
|
||||
<component name="PythonCompatibilityInspectionAdvertiser">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -544,9 +544,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
valuations = PropertyValuation.estimate(property_instance=p, target_epc=new_epc)
|
||||
|
||||
property_valuation_increases.append(
|
||||
valuations["average_increased_value"] - valuations["current_value"]
|
||||
)
|
||||
property_valuation_increases.append(valuations["average_increase"])
|
||||
|
||||
# Commit the session after each batch
|
||||
session.commit()
|
||||
|
|
|
|||
|
|
@ -178,10 +178,21 @@ def create_recommendation_scoring_data(
|
|||
if recommendation["type"] == "windows_glazing":
|
||||
scoring_dict["MULTI_GLAZE_PROPORTION_ENDING"] = 100
|
||||
scoring_dict["WINDOWS_ENERGY_EFF_ENDING"] = "Average"
|
||||
if scoring_dict["glazing_type_ENDING"] in ["multiple", "double"]:
|
||||
|
||||
is_secondary_glazing = recommendation["is_secondary_glazing"]
|
||||
|
||||
if scoring_dict["glazing_type_ENDING"] == "multiple":
|
||||
pass
|
||||
elif scoring_dict["glazing_type_ENDING"] == "single":
|
||||
scoring_dict["glazing_type_ENDING"] = "secondary" if is_secondary_glazing else "double"
|
||||
elif scoring_dict["glazing_type_ENDING"] == "double":
|
||||
scoring_dict["glazing_type_ENDING"] = "multiple" if is_secondary_glazing else "double"
|
||||
elif scoring_dict["glazing_type_ENDING"] == "secondary":
|
||||
scoring_dict["glazing_type_ENDING"] = "secondary" if is_secondary_glazing else "multiple"
|
||||
elif scoring_dict["glazing_type_ENDING"] in ["triple", "high performance"]:
|
||||
scoring_dict["glazing_type_ENDING"] = "multiple"
|
||||
else:
|
||||
raise NotImplementedError("Implement me")
|
||||
raise ValueError("Invalid glazing type - implement me")
|
||||
|
||||
if recommendation["type"] not in [
|
||||
"mechanical_ventilation", "sealing_open_fireplace", "low_energy_lighting",
|
||||
|
|
|
|||
|
|
@ -93,7 +93,13 @@ class PropertyValuation:
|
|||
value = cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn)
|
||||
|
||||
if not value:
|
||||
raise ValueError("Have not implemented valuation for this property")
|
||||
return {
|
||||
"current_value": None,
|
||||
"lower_bound_increased_value": None,
|
||||
"upper_bound_increased_value": None,
|
||||
"average_increased_value": None,
|
||||
"average_increase": None
|
||||
}
|
||||
|
||||
current_epc = property_instance.data["current-energy-rating"]
|
||||
# We get the spectrum of ratings between the current and target EPC
|
||||
|
|
@ -119,4 +125,5 @@ class PropertyValuation:
|
|||
"lower_bound_increased_value": value * (1 + min_increase),
|
||||
"upper_bound_increased_value": value * (1 + max_increase),
|
||||
"average_increased_value": value * (1 + avg_increase),
|
||||
"average_increase": value * (1 + avg_increase) - value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class WindowsRecommendations:
|
|||
"starting_u_value": None,
|
||||
"new_u_value": None,
|
||||
"sap_points": None,
|
||||
**cost_result
|
||||
**cost_result,
|
||||
"is_secondary_glazing": is_secondary_glazing
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue