change scenario data

This commit is contained in:
Michael Duong 2024-02-20 09:44:51 +00:00
parent 343039233a
commit c53e4ce849
3 changed files with 18 additions and 11 deletions

View file

@ -128,16 +128,19 @@ class Property:
It will be the same starting and ending EPC, as we don't have the expected EPC yet It will be the same starting and ending EPC, as we don't have the expected EPC yet
""" """
difference_record = self.epc_record - self.epc_record # difference_record = self.epc_record - self.epc_record
# TODO: change these lower and replace in the settings file # TODO: change these lower and replace in the settings file
print("CHANGE THE LATEST FIELD TO REMOVE NUMBER HABITABLE ROOMS IF WE WANT TO USE STARTING/ENDING")
fixed_data_col_names = MANDATORY_FIXED_FEATURES + LATEST_FIELD fixed_data_col_names = MANDATORY_FIXED_FEATURES + LATEST_FIELD
print("NEED TO CHANGE THE DASH TO LOWER CASE") print("NEED TO CHANGE THE DASH TO LOWER CASE")
fixed_data_col_names = [x.lower().replace("_", "-") for x in fixed_data_col_names] fixed_data_col_names = [x.lower().replace("_", "-") for x in fixed_data_col_names]
fixed_data = {k.replace("-", "_"): v for k, v in self.data.items() if k in fixed_data_col_names} fixed_data = {k.replace("-", "_"): v for k, v in self.data.items() if k in fixed_data_col_names}
difference_record.append_fixed_data(fixed_data) # difference_record.append_fixed_data(fixed_data)
difference_record = self.epc_record.create_EPCDifferenceRecord(self.epc_record, fixed_data)
self.base_difference_record = TrainingDataset(datasets=[difference_record], cleaned_lookup=cleaned_lookup) self.base_difference_record = TrainingDataset(datasets=[difference_record], cleaned_lookup=cleaned_lookup)
@ -238,12 +241,15 @@ class Property:
# Note: often when the wall is insulatied, the internal/external insulation is not noted so we should # Note: often when the wall is insulatied, the internal/external insulation is not noted so we should
# test the impact of using these booleans # test the impact of using these booleans
if recommendation["type"] == "external_wall_insulation": if recommendation["type"] == "external_wall_insulation":
output["external_insulation"] = True output["external_insulation_ending"] = True
output["internal_insulation"] = False output["internal_insulation_ending"] = False
if recommendation["type"] == "internal_wall_insulation": if recommendation["type"] == "internal_wall_insulation":
output["external_insulation"] = False output["external_insulation_ending"] = False
output["internal_insulation"] = True output["internal_insulation_ending"] = True
if recommendation["type"] == "cavity_wall_insulation":
output['is_filled_cavity_ending'] = True
# TODO: perhaps detrimental # TODO: perhaps detrimental
# When making a recommendation for the wall, we will also update the ventilation # When making a recommendation for the wall, we will also update the ventilation
@ -314,7 +320,7 @@ class Property:
if recommendation["type"] == "low_energy_lighting": if recommendation["type"] == "low_energy_lighting":
output["low_energy_lighting_ending"] = 100 output["low_energy_lighting_ending"] = 100
output["lighting_energy_eff_starting"] = "Very Good" output["lighting_energy_eff_ending"] = "Very Good"
if recommendation["type"] == "windows_glazing": if recommendation["type"] == "windows_glazing":
output["multi_glaze_proportion_ending"] = 100 output["multi_glaze_proportion_ending"] = 100

View file

@ -24,7 +24,8 @@ from etl.epc.settings import (
# TODO: change in setting file # TODO: change in setting file
MANDATORY_FIXED_FEATURES = [x.lower() for x in MANDATORY_FIXED_FEATURES] MANDATORY_FIXED_FEATURES = [x.lower() for x in MANDATORY_FIXED_FEATURES]
LATEST_FIELD = [x.lower() for x in LATEST_FIELD if x.lower() not in ROOM_FEATURES] # LATEST_FIELD = [x.lower() for x in LATEST_FIELD if x.lower() not in ROOM_FEATURES]
LATEST_FIELD = [x.lower() for x in LATEST_FIELD]
COMPONENT_FEATURES = [x.lower() for x in COMPONENT_FEATURES] COMPONENT_FEATURES = [x.lower() for x in COMPONENT_FEATURES]
RDSAP_RESPONSE = RDSAP_RESPONSE.lower() RDSAP_RESPONSE = RDSAP_RESPONSE.lower()
HEAT_DEMAND_RESPONSE = HEAT_DEMAND_RESPONSE.lower() HEAT_DEMAND_RESPONSE = HEAT_DEMAND_RESPONSE.lower()

View file

@ -183,7 +183,7 @@ for scenario_property in scenario_properties:
if "windows" in measure: if "windows" in measure:
for rec in windows_recommendations: for rec in windows_recommendations:
if rec["type"] == "windows": if rec["type"] == "windows_glazing":
windows_recs.append(rec) windows_recs.append(rec)
combi_list = [wall_recs, loft_recs, solar_recs, windows_recs] combi_list = [wall_recs, loft_recs, solar_recs, windows_recs]
@ -240,8 +240,8 @@ all_predictions = model_api.predict_all(
prediction_buckets={ prediction_buckets={
"sap_change_predictions": get_settings().SAP_PREDICTIONS_BUCKET, "sap_change_predictions": get_settings().SAP_PREDICTIONS_BUCKET,
"heat_demand_predictions": get_settings().HEAT_PREDICTIONS_BUCKET, "heat_demand_predictions": get_settings().HEAT_PREDICTIONS_BUCKET,
"carbon_change_predictions": get_settings().CARBON_PREDICTIONS_BUCKET "carbon_change_predictions": get_settings().CARBON_PREDICTIONS_BUCKET,
} },
) )
save_dataframe_to_s3_parquet( save_dataframe_to_s3_parquet(