implemented gbis for the moment

This commit is contained in:
Khalim Conn-Kowlessar 2024-12-18 11:16:35 +00:00
parent ea5e888a82
commit 82cf08eb98
2 changed files with 8 additions and 9 deletions

View file

@ -66,9 +66,7 @@ class Funding:
self.recommendations = property_recommendations
self.measure_types = []
for recs in self.recommendations:
self.measure_types.extend([r["measure_type"] for r in recs])
self.measure_types = list({r["measure_type"] for r in property_recommendations if r["default"]})
# Load in the eco4 project scores matrix
# Filter the matrix on scores relevant to this property
@ -129,12 +127,12 @@ class Funding:
:return:
"""
measure_table = pd.DataFrame([
m[0] for m in self.recommendations if m[0]["measure_type"] in measures
m for m in self.recommendations if m in measures and m["default"]
])
measure_table["post_install_sap"] = measure_table["sap_points"] + self.starting_sap
# We classify the movement
measure_table["Finishing Band"] = measure_table["sap_points"].apply(
measure_table["Finishing Band"] = np.floor(measure_table["post_install_sap"]).apply(
lambda points: self.sap_to_eco_band(points)
)
# Remove any measures that generate zero SAP movement
@ -223,7 +221,7 @@ class Funding:
# General Eligibility
if (
(self.starting_epc in ["G", "D", "E", "F"]) and
len(
any(
[measure in valid_measures for measure in self.measure_types
if measure not in ["cavity_wall_insulation", "loft_insulation"]]
) and
@ -246,7 +244,7 @@ class Funding:
# Low income/flex
if (
(self.starting_sap in ["G", "D", "E", "F"]) and
len([measure in valid_measures for measure in self.measure_types])
any([measure in valid_measures for measure in self.measure_types])
):
# Find the best measure, and can also include CWI/LI but requires the tenant to be
# low inome or on benefits
@ -293,5 +291,5 @@ class Funding:
"""
self.gbis()
self.eco4()
self.whlg()
# self.eco4()
# self.whlg()

View file

@ -380,6 +380,7 @@ def get_eco_project_scores_matrix():
)
df = pd.DataFrame(data)
df.columns = ['Floor Area Segment', 'Starting Band', 'Finishing Band', 'Cost Savings']
df["Cost Savings"] = df["Cost Savings"].astype(float)
return df