Model/etl/customers/vander_elliot/pilot.py
2024-05-09 16:32:22 +01:00

105 lines
2.7 KiB
Python

import pandas as pd
from utils.s3 import save_csv_to_s3
EPC_C_PORTFOLIO_ID = 78
EPC_B_PORTFOLIO_ID = 79
USER_ID = 8
def app():
"""
This code sets up the asset list for the 9 property portfolio for the pilot
:return:
"""
asset_list = [
{
"address": "79 Clare Road",
"postcode": "L20 9LZ",
"uprn": 41018850, # 3 bedroom property
},
{
"address": "Flat 1, 29 Bedford Road",
"postcode": "L4 5PS",
"uprn": 38237316 # Single dewlling converted into two flats
},
{
"address": "Flat 2, 29 Bedford Road",
"postcode": "L4 5PS",
"uprn": 38237317 # Single dewlling converted into two flats
},
# 7 Flats above a domestic unit
{
"address": "Flat 1, 2 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41052320
},
{
"address": "Flat 2, 2 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41052321,
},
{
"address": "Flat 3, 2 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41052322,
},
{
"address": "Flat 4, 2 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41222759,
},
{
"address": "Flat 1, 4 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41222760,
},
{
"address": "Flat 2, 4 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41222761,
},
{
"address": "Flat 3, 4 Linacre Lane",
"postcode": "L20 5AH",
"uprn": 41212534,
},
]
asset_list = pd.DataFrame(asset_list)
# Store the asset list in s3
filename = f"{USER_ID}/{EPC_C_PORTFOLIO_ID}/pilot.csv"
save_csv_to_s3(
dataframe=asset_list,
bucket_name="retrofit-plan-inputs-dev",
file_name=filename
)
# EPC C portoflio
body = {
"portfolio_id": str(EPC_C_PORTFOLIO_ID),
"housing_type": "Private",
"goal": "Increase EPC",
"goal_value": "C",
"trigger_file_path": filename,
"already_installed_file_path": "",
"patches_file_path": "",
"non_invasive_recommendations_file_path": "",
"budget": None,
}
print(body)
# EPC B portoflio
body = {
"portfolio_id": str(EPC_B_PORTFOLIO_ID),
"housing_type": "Private",
"goal": "Increase EPC",
"goal_value": "B",
"trigger_file_path": filename,
"already_installed_file_path": "",
"patches_file_path": "",
"non_invasive_recommendations_file_path": "",
"budget": None,
}
print(body)