import pandas as pd
from backend.ml_models.Valuation import PropertyValuation
from backend.app.utils import sap_to_epc

# Read in the survey data
surveys = pd.read_excel(
    "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Cambridge/Survey Data.xlsx",
    sheet_name="Survey data",
)

increases = []
for _, x in surveys.iterrows():
    current_epc = sap_to_epc(x["Pre SAP"])
    target_epc = sap_to_epc(x["Scenario 1 Post SAP"])
    current_value = x["Valuation"]

    val = PropertyValuation.estimate_valuation_improvement(
        current_value,
        current_epc,
        target_epc,
        total_cost=None
    )
    avg_increase = val["average_increase"]
    increases.append(round(avg_increase))
