mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
major refactor of handling of epc data and starting to set up extract_attributes
This commit is contained in:
parent
37cc43adb1
commit
ecc9d99540
2 changed files with 22 additions and 18 deletions
|
|
@ -226,7 +226,14 @@ class AssetList:
|
|||
"energy-consumption-current": "epc_heat_demand",
|
||||
}
|
||||
FIND_EPC_DATA_NAMES = {
|
||||
|
||||
"heating_text": "epc_estiamted_heating_kwh",
|
||||
"hot_water_text": "epc_estimated_hotwater_kwh",
|
||||
'Assessor’s name': "epc_assessor_name",
|
||||
"Assessor's Telephone": "epc_assessor_telephone",
|
||||
"Assessor's Email": "epc_assessor_email",
|
||||
"Accreditation scheme": "epc_assessor_accreditation",
|
||||
"Assessor’s ID": "epc_assessor_id",
|
||||
"Solar photovoltaics": "epc_solar_pv"
|
||||
}
|
||||
|
||||
DATETIME_REMAP = {
|
||||
|
|
@ -265,7 +272,8 @@ class AssetList:
|
|||
"Any further surveyor notes", 'Surveyors Name'
|
||||
]
|
||||
|
||||
#### Mapping for wall construction
|
||||
# Attributes - these are columns that we produce, calcualted based on other pieces of data
|
||||
ATTRIBUTE_HAS_SOLAR = "attribute_has_solar"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -615,9 +623,6 @@ class AssetList:
|
|||
columns=self.rename_map
|
||||
)
|
||||
|
||||
def create_lookup_mappings(self):
|
||||
pass
|
||||
|
||||
def merge_data(self, df: pd.DataFrame):
|
||||
"""
|
||||
Used to insert data into the standardised asset list, based on the domna property id
|
||||
|
|
@ -632,3 +637,11 @@ class AssetList:
|
|||
self.standardised_asset_list = self.standardised_asset_list.merge(
|
||||
df, how="left", on=self.DOMNA_PROPERTY_ID
|
||||
)
|
||||
|
||||
def extract_attributes(self):
|
||||
# Used to extracty the typical attributes that we use to identify viable work
|
||||
|
||||
self.standardised_asset_list[self.ATTRIBUTE_HAS_SOLAR] = (
|
||||
self.standardised_asset_list[self.FIND_EPC_DATA_NAMES["Solar photovoltaics"]] |
|
||||
~self.standardised_asset_list[self.EPC_API_DATA_NAMES["photo-supply"]].isin(["0.0", 0, None, ""])
|
||||
)
|
||||
|
|
|
|||
|
|
@ -522,25 +522,16 @@ def app():
|
|||
)
|
||||
|
||||
epc_df = epc_df.merge(
|
||||
find_my_epc_data[
|
||||
[
|
||||
asset_list.DOMNA_PROPERTY_ID, "heating_text", "hot_water_text", 'Assessor’s name',
|
||||
"Assessor's Telephone", "Assessor's Email", "Accreditation scheme",
|
||||
"Assessor’s ID", "Solar photovoltaics"
|
||||
]
|
||||
].rename(
|
||||
columns={
|
||||
"Solar photovoltaics": "Has Solar PV",
|
||||
"heating_text": "Heating Estimated kWh",
|
||||
"hot_water_text": "Hot Water Estimated kWh",
|
||||
}
|
||||
),
|
||||
find_my_epc_data[[asset_list.DOMNA_PROPERTY_ID] + list(asset_list.FIND_EPC_DATA_NAMES.keys())]
|
||||
.rename(columns=asset_list.FIND_EPC_DATA_NAMES),
|
||||
how="left",
|
||||
on=asset_list.DOMNA_PROPERTY_ID
|
||||
)
|
||||
|
||||
asset_list.merge_data(epc_df)
|
||||
|
||||
asset_list.extract_attributes()
|
||||
|
||||
asset_list["Has Solar PV"] = asset_list["Has Solar PV"] | ~asset_list["photo-supply"].isin(["0.0", 0, None, ""])
|
||||
asset_list = asset_list.drop(columns=["photo-supply"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue