Model/backend/ml_models/Valuation.py
2023-11-30 12:08:24 +00:00

22 lines
707 B
Python

class PropertyValuation:
"""
This is a placeholder class for the property valuation model
"""
UPRN_VALUE_LOOKUP = {
15038202: {"current_value": 202000, "increase_percentage": 0.05725},
37024763: {"current_value": 213000, "increase_percentage": 0.025},
}
@classmethod
def estimate(cls, property_instance, target_epc):
data = cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn)
if not data:
raise ValueError("Have not implemented valuation for this property")
new_valuation = (1 + data["increase_percentage"]) * data["current_value"]
increase = round(new_valuation - data["current_value"], 2)
return increase