From 53b2ca05b628f656855ccb119aa0d6079fa8284f Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 29 Jul 2024 15:31:19 +0100 Subject: [PATCH] inserting county --- backend/app/plan/router.py | 4 ++++ etl/xml_survey_extraction/app.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 563134ea..ced67bfe 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -241,6 +241,10 @@ def create_epc_records(epc_searcher: SearchEpc, energy_assessment: dict): epc = energy_assessment["epc"] energy_assessment_date = epc["inspection-date"].strftime("%Y-%m-%d") + # We insert county into the epc, since right now this isn't something that we pull out from the energy + # assessment + epc["county"] = epc_searcher.newest_epc["county"] + # We check if the energy assessment is newer than the newest EPC if pd.to_datetime(energy_assessment_date) > pd.to_datetime(epc_searcher.newest_epc["inspection-date"]): # In this case, our energy assessment is newer than the EPCs available for this property diff --git a/etl/xml_survey_extraction/app.py b/etl/xml_survey_extraction/app.py index c4f6091f..18f84ba2 100644 --- a/etl/xml_survey_extraction/app.py +++ b/etl/xml_survey_extraction/app.py @@ -29,6 +29,8 @@ def main(): # The data is stored in a folder called {surveyors}/{project_code}/{uprn} # We'll need to get the uprn from the folder name, which we can do with EpcSearcher class + # TODO: Pull out county, as in create_epc_records in the router, we pull it from the latest EPC, but we should + # be able to deduce it from just the address # energy_assessments = list_files_and_subfolders_in_s3_folder( bucket_name=BUCKET, folder_name=f"{SURVEYORS}/{PROJECT_CODE}/"