From 2a4d16162abc8bcda788950d44a0762148e8904d Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 27 Feb 2024 18:01:29 +0000 Subject: [PATCH] Added ha7 --- .../ha_15_32/ha_analysis_batch_3.py | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py index a8f0bfa9..889ae776 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -49,8 +49,19 @@ PROPERTY_TYPE_LOOKUP = { } }, "HA7": { - "property_type": {}, - "built_form": {} + "property_type": { + "House": "House", + "Flat": "Flat", + "Bungalow": "Bungalow", + "Maisonette": "Maisonette", + }, + "built_form": { + "Semi Detached": "Semi-Detached", + "Mid Terrace": "Mid-Terrace", + "End Terrace": "End-Terrace", + "Detached": "Detached", + "End Terraced": "End-Terrace", + } }, "HA14": { "property_type": { @@ -1042,6 +1053,9 @@ def get_property_type_and_built_form(property_meta, ha_name): elif ha_name == "HA6": property_type = PROPERTY_TYPE_LOOKUP[ha_name]["property_type"][property_meta["Dwelling type"]] built_form = property_meta["built_form"] + elif ha_name == "HA7": + property_type = PROPERTY_TYPE_LOOKUP[ha_name]["property_type"][property_meta["Archetype"]] + built_form = PROPERTY_TYPE_LOOKUP[ha_name]["built_form"][property_meta["Property Type"]] elif ha_name == "HA14": if property_meta["Asset Type Description"] == "Block - Repair": # We try and deduce if it's a flat or house, depending on if it has "room" or "flats" in the address @@ -1106,9 +1120,6 @@ def get_epc_data( outputs = {} for ha_name, data_assets in loader.data.items(): - if ha_name == "HA39": - continue - if not pull_data: # Then we retrieve the data from S3 processed_ha_results = read_pickle_from_s3( @@ -1135,7 +1146,6 @@ def get_epc_data( scoring_data = [] nodata = [] failed_model_rows = [] - # Failed at index 13691 for index, property_meta in tqdm(asset_list.iterrows(), total=len(asset_list)): if property_meta["matching_postcode"] is None: @@ -1906,8 +1916,6 @@ def app(): loader.load() loader.ha_facts_and_figures() - loader.facts_and_figures.to_csv("facts_and_figures.csv", index=False) - # We load in the additional data required to perform the analysis cleaned = read_from_s3( s3_file_name="cleaned_epc_data/cleaned.bson",