From 34464267dcea14ac20e643988580721e43ac1851 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 19 Aug 2024 13:48:18 +0100 Subject: [PATCH] added get_asset_list --- etl/ownership/Ownership.py | 19 +++++++++++++++++++ .../projects/midlands_portfolio/app.py | 3 +++ 2 files changed, 22 insertions(+) diff --git a/etl/ownership/Ownership.py b/etl/ownership/Ownership.py index 25ba7cea..8221f8f7 100644 --- a/etl/ownership/Ownership.py +++ b/etl/ownership/Ownership.py @@ -109,6 +109,9 @@ class Ownership: self.portfolio_properties_filepath = ( f"ownership/{self.project_name}/{self.run_timestamp}/portfolio_properties.xlsx" ) + self.portfolio_epc_data_filepath = ( + f"ownership/{self.project_name}/{self.run_timestamp}/portfolio_epc_data.xlsx" + ) # Data self.epc_data = None @@ -999,3 +1002,19 @@ class Ownership: bucket_name=self.bucket, file_key=self.portfolio_epc_data_filepath, ) + + def get_asset_list(self): + """ + From the EPC data, creates the asset list + :return: + """ + + asset_list = self.portfolio_epc_data[["UPRN", "ADDRESS1", "POSTCODE"]].copy().rename( + columns={ + "UPRN": "uprn", + "ADDRESS1": "address", + "POSTCODE": "postcode" + } + ) + + return asset_list diff --git a/etl/ownership/projects/midlands_portfolio/app.py b/etl/ownership/projects/midlands_portfolio/app.py index 2165dc94..905ff0e4 100644 --- a/etl/ownership/projects/midlands_portfolio/app.py +++ b/etl/ownership/projects/midlands_portfolio/app.py @@ -122,3 +122,6 @@ def app(): ownership_instance.pipeline(column_filters=epc_column_filters) # Create the project, if a portfolio doesn't exist for the project name + + # Create the asset list and the body of the portfolio + asset_list = ownership_instance.get_asset_list()