mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Extracing building level info
This commit is contained in:
parent
f5eab413c2
commit
c4768c8534
2 changed files with 19 additions and 4 deletions
|
|
@ -60,6 +60,7 @@ class Property:
|
||||||
# Surplus information, that can be provided as optional inputs, by a customer
|
# Surplus information, that can be provided as optional inputs, by a customer
|
||||||
n_bathrooms = None
|
n_bathrooms = None
|
||||||
n_bedrooms = None
|
n_bedrooms = None
|
||||||
|
building_id = None # Used to group properties together into a single building
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -193,12 +194,14 @@ class Property:
|
||||||
return {
|
return {
|
||||||
"n_bathrooms": n_bathrooms,
|
"n_bathrooms": n_bathrooms,
|
||||||
"n_bedrooms": n_bedrooms,
|
"n_bedrooms": n_bedrooms,
|
||||||
|
"building_id": kwargs.get("building_id", None),
|
||||||
}
|
}
|
||||||
|
|
||||||
def parse_kwargs(self, kwargs):
|
def parse_kwargs(self, kwargs):
|
||||||
# We extract the elements from kwargs that we recognise. Anything additional is ignored
|
# We extract the elements from kwargs that we recognise. Anything additional is ignored
|
||||||
self.n_bathrooms = kwargs.get("n_bathrooms", None)
|
self.n_bathrooms = kwargs.get("n_bathrooms", None)
|
||||||
self.n_bedrooms = kwargs.get("n_bedrooms", None)
|
self.n_bedrooms = kwargs.get("n_bedrooms", None)
|
||||||
|
self.building_id = kwargs.get("building_id", None)
|
||||||
|
|
||||||
def create_base_difference_epc_record(self, cleaned_lookup: dict):
|
def create_base_difference_epc_record(self, cleaned_lookup: dict):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
bucket_name=get_settings().DATA_BUCKET, file_key="sap_change_model/cleaning_dataset.parquet",
|
bucket_name=get_settings().DATA_BUCKET, file_key="sap_change_model/cleaning_dataset.parquet",
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: insert building id
|
|
||||||
input_properties = []
|
input_properties = []
|
||||||
for config in tqdm(plan_input):
|
for config in tqdm(plan_input):
|
||||||
# We validate each record in the file. If the record is NOT valid, we need to handle this accordingly
|
# We validate each record in the file. If the record is NOT valid, we need to handle this accordingly
|
||||||
|
|
@ -366,9 +365,22 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
for p in input_properties:
|
for p in input_properties:
|
||||||
p.get_components(cleaned, photo_supply_lookup, floor_area_decile_thresholds, energy_consumption_client)
|
p.get_components(cleaned, photo_supply_lookup, floor_area_decile_thresholds, energy_consumption_client)
|
||||||
p.get_spatial_data(uprn_filenames)
|
p.get_spatial_data(uprn_filenames)
|
||||||
# Call Google Solar API
|
|
||||||
# TODO: Complete me
|
building_ids = [
|
||||||
solar_performance = solar_api_client.get(longitude=p.spatial["longitude"], latitude=p.spatial["latitude"])
|
{
|
||||||
|
"building_id": p.building_id, "longitude": p.spatial["longitude"], "latitude": p.spatial["latitude"]
|
||||||
|
} for p in input_properties if p.building_id is not None
|
||||||
|
]
|
||||||
|
if building_ids:
|
||||||
|
# Model the solar potential at the building level
|
||||||
|
print("complete me")
|
||||||
|
else:
|
||||||
|
# Model the solar potential at the property level
|
||||||
|
for p in input_properties:
|
||||||
|
# TODO: Complete me!
|
||||||
|
solar_performance = solar_api_client.get(
|
||||||
|
longitude=p.spatial["longitude"], latitude=p.spatial["latitude"]
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("Getting components and epc recommendations")
|
logger.info("Getting components and epc recommendations")
|
||||||
recommendations = {}
|
recommendations = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue