mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
inserting county
This commit is contained in:
parent
b85fde1b21
commit
53b2ca05b6
2 changed files with 6 additions and 0 deletions
|
|
@ -241,6 +241,10 @@ def create_epc_records(epc_searcher: SearchEpc, energy_assessment: dict):
|
||||||
epc = energy_assessment["epc"]
|
epc = energy_assessment["epc"]
|
||||||
energy_assessment_date = epc["inspection-date"].strftime("%Y-%m-%d")
|
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
|
# 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"]):
|
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
|
# In this case, our energy assessment is newer than the EPCs available for this property
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ def main():
|
||||||
# The data is stored in a folder called {surveyors}/{project_code}/{uprn}
|
# 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
|
# 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(
|
energy_assessments = list_files_and_subfolders_in_s3_folder(
|
||||||
bucket_name=BUCKET, folder_name=f"{SURVEYORS}/{PROJECT_CODE}/"
|
bucket_name=BUCKET, folder_name=f"{SURVEYORS}/{PROJECT_CODE}/"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue