Extracing building level info

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-08 14:22:29 +01:00
parent f5eab413c2
commit c4768c8534
2 changed files with 19 additions and 4 deletions

View file

@ -60,6 +60,7 @@ class Property:
# Surplus information, that can be provided as optional inputs, by a customer
n_bathrooms = None
n_bedrooms = None
building_id = None # Used to group properties together into a single building
def __init__(
self,
@ -193,12 +194,14 @@ class Property:
return {
"n_bathrooms": n_bathrooms,
"n_bedrooms": n_bedrooms,
"building_id": kwargs.get("building_id", None),
}
def parse_kwargs(self, kwargs):
# We extract the elements from kwargs that we recognise. Anything additional is ignored
self.n_bathrooms = kwargs.get("n_bathrooms", 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):
"""

View file

@ -263,7 +263,6 @@ async def trigger_plan(body: PlanTriggerRequest):
bucket_name=get_settings().DATA_BUCKET, file_key="sap_change_model/cleaning_dataset.parquet",
)
# TODO: insert building id
input_properties = []
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
@ -366,9 +365,22 @@ async def trigger_plan(body: PlanTriggerRequest):
for p in input_properties:
p.get_components(cleaned, photo_supply_lookup, floor_area_decile_thresholds, energy_consumption_client)
p.get_spatial_data(uprn_filenames)
# Call Google Solar API
# TODO: Complete me
solar_performance = solar_api_client.get(longitude=p.spatial["longitude"], latitude=p.spatial["latitude"])
building_ids = [
{
"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")
recommendations = {}