mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
simplying router for recommendation engine wip
This commit is contained in:
parent
f8a4884deb
commit
1fdbdbad07
3 changed files with 4 additions and 9 deletions
2
.idea/Model.iml
generated
2
.idea/Model.iml
generated
|
|
@ -7,7 +7,7 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.10 (model_data)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.10 (backend)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (model_data)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (backend)" project-jdk-type="Python SDK" />
|
||||||
<component name="PythonCompatibilityInspectionAdvertiser">
|
<component name="PythonCompatibilityInspectionAdvertiser">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -209,26 +209,21 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
if not input_properties:
|
if not input_properties:
|
||||||
return Response(status_code=204)
|
return Response(status_code=204)
|
||||||
|
|
||||||
logger.info("Getting EPC data")
|
logger.info("Getting EPC, coordinates and conservation area data")
|
||||||
for p in input_properties:
|
for p in input_properties:
|
||||||
p.search_address_epc()
|
p.search_address_epc()
|
||||||
p.set_year_built()
|
p.set_year_built()
|
||||||
|
|
||||||
logger.info("Getting coordinates")
|
|
||||||
# This is placeholder, until the full dataset is loaded into the database
|
|
||||||
for p in input_properties:
|
|
||||||
coordinate_data = [x for x in open_uprn_data if x['UPRN'] == int(p.data['uprn'])][0]
|
coordinate_data = [x for x in open_uprn_data if x['UPRN'] == int(p.data['uprn'])][0]
|
||||||
p.set_coordinates(coordinate_data)
|
p.set_coordinates(coordinate_data)
|
||||||
|
|
||||||
logger.info("Check if property is in conservation area")
|
|
||||||
for p in input_properties:
|
|
||||||
in_conservation_area = [x for x in in_conservation_area_data if x['uprn'] == int(p.data['uprn'])][0].get(
|
in_conservation_area = [x for x in in_conservation_area_data if x['uprn'] == int(p.data['uprn'])][0].get(
|
||||||
"is_in_conservation_area"
|
"is_in_conservation_area"
|
||||||
)
|
)
|
||||||
p.set_is_in_conservation_area(in_conservation_area)
|
p.set_is_in_conservation_area(in_conservation_area)
|
||||||
|
|
||||||
# The materials data could be cached or local so we don't need to make
|
# The materials data could be cached or local so we don't need to make
|
||||||
# consistent requrests to the backend for
|
# consistent requests to the backend for
|
||||||
# the same data
|
# the same data
|
||||||
# TODO: It might not be the best choice to store the materials data in a database table since thi
|
# TODO: It might not be the best choice to store the materials data in a database table since thi
|
||||||
# table probably won't be very large and won't be updated that often. It might be better to
|
# table probably won't be very large and won't be updated that often. It might be better to
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue