mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
cleaned up the temp filling of missing uprn
This commit is contained in:
parent
19951b9ca1
commit
c11eb1abaa
2 changed files with 4 additions and 13 deletions
|
|
@ -482,6 +482,7 @@ class SearchEpc:
|
|||
estimated_epc[key] = estimated_value
|
||||
|
||||
estimated_epc["postcode"] = self.postcode
|
||||
estimated_epc["uprn"] = self.uprn
|
||||
# Indicate that this epc was estimated
|
||||
estimated_epc["estimated"] = True
|
||||
|
||||
|
|
|
|||
|
|
@ -79,10 +79,9 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
os_api_key=get_settings().ORDNANCE_SURVEY_API_KEY
|
||||
)
|
||||
epc_searcher.find_property()
|
||||
# Create a record in db - TODO: Create this using the epc address and postcode and validate with
|
||||
# uprn
|
||||
# Create a record in db
|
||||
property_id, is_new = create_property(
|
||||
session, portfolio_id=body.portfolio_id, address=config['address'], postcode=config['postcode']
|
||||
session, body.portfolio_id, epc_searcher.address_clean, epc_searcher.postcode_clean
|
||||
)
|
||||
# if a new record was not created, we don't produduce recommendations
|
||||
if not is_new:
|
||||
|
|
@ -108,9 +107,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
if not input_properties:
|
||||
return Response(status_code=204)
|
||||
|
||||
logger.info("Getting EPC, and spatial data")
|
||||
logger.info("Getting spatial data")
|
||||
for p in input_properties:
|
||||
p.search_address_epc()
|
||||
p.set_year_built()
|
||||
p.get_spatial_data(uprn_filenames)
|
||||
|
||||
|
|
@ -151,9 +149,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
# Finally, we'll prepare data for predicting the impact on SAP
|
||||
data_processor = DataProcessor(None, newdata=True)
|
||||
data_processor.insert_data(pd.DataFrame([p.get_model_data()]))
|
||||
# TODO: Temp
|
||||
if data_processor.data["UPRN"].values[0] == "":
|
||||
data_processor.data["UPRN"] = 0
|
||||
|
||||
data_processor.pre_process()
|
||||
|
||||
|
|
@ -515,11 +510,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
update_or_create_property_spatial_details(session, p.uprn, p.spatial)
|
||||
|
||||
# TODO: TEMP
|
||||
if p.data["uprn"] == "":
|
||||
print("Get rid of me!")
|
||||
p.data["uprn"] = 0
|
||||
|
||||
property_data = p.get_full_property_data()
|
||||
update_property_data(
|
||||
session, property_id=p.id, portfolio_id=body.portfolio_id, property_data=property_data
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue