mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Got the bigger portfolio working
This commit is contained in:
parent
fec6fab42a
commit
7c943b8c1c
6 changed files with 33 additions and 8 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$/recommendations" isTestSource="false" />
|
||||
</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" />
|
||||
</component>
|
||||
<component name="PyNamespacePackagesService">
|
||||
|
|
|
|||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Property(Definitions):
|
|||
if len(response["rows"]) > 1:
|
||||
newest_response = [
|
||||
r for r in response["rows"] if
|
||||
r["inspection-date"] == max([x["inspection-date"] for x in response["rows"]])
|
||||
r["lodgement-datetime"] == max([x["lodgement-datetime"] for x in response["rows"]])
|
||||
]
|
||||
if len(newest_response) > 1:
|
||||
raise Exception("More than one result found for this address - investigate me")
|
||||
|
|
@ -113,6 +113,11 @@ class Property(Definitions):
|
|||
response["rows"] = newest_response
|
||||
|
||||
self.data = response["rows"][0]
|
||||
# For the moment, if we don't have a UPRN, we don't do anything about it, however we'll handle this in
|
||||
# the future by using the Ordnance Survey places API
|
||||
if not self.data["uprn"]:
|
||||
logger.warning("We do not have a UPRN for this property")
|
||||
else:
|
||||
self.uprn = int(self.data["uprn"])
|
||||
|
||||
def set_coordinates(self, coordinates):
|
||||
|
|
@ -482,7 +487,12 @@ class Property(Definitions):
|
|||
"""
|
||||
|
||||
if self.uprn is None:
|
||||
raise ValueError("URPN is not set, run search_address_epc")
|
||||
logger.warning("We do not have a UPRN for this property - this needs to be implemented")
|
||||
self.in_conservation_area = False
|
||||
self.is_listed = False
|
||||
self.is_heritage = False
|
||||
self.restricted_measures = True
|
||||
return
|
||||
|
||||
# We get the file name for the uprn
|
||||
filtered_df = uprn_filenames[(uprn_filenames['lower'] <= self.uprn) & (uprn_filenames['upper'] >= self.uprn)]
|
||||
|
|
@ -549,8 +559,10 @@ class Property(Definitions):
|
|||
|
||||
if self.data["property-type"] == "House":
|
||||
self.number_of_floors = estimate_floors(self.floor_area, self.number_of_rooms)
|
||||
elif self.data["property-type"] == "Flat":
|
||||
elif self.data["property-type"] in ["Flat", "Bungalow"]:
|
||||
self.number_of_floors = 1
|
||||
elif self.data["property-type"] == "Maisonette":
|
||||
self.number_of_floors = 2
|
||||
else:
|
||||
raise NotImplementedError("Implement me")
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,10 @@ 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()
|
||||
|
||||
starting_epc_data = data_processor.get_component_features(suffix="_STARTING")
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@ def app():
|
|||
+ a_data["rows"]
|
||||
)
|
||||
|
||||
# TODO: For the moment, don't use park homes
|
||||
final_csv_data = pd.DataFrame(
|
||||
[{"address": x["address"], "postcode": x["postcode"], "Notes": None} for x in final_data]
|
||||
[{"address": x["address"], "postcode": x["postcode"], "Notes": None} for x
|
||||
in final_data if
|
||||
x["property-type"] not in ["Park home"]]
|
||||
)
|
||||
|
||||
final_csv_data = pd.concat([starting_csv, final_csv_data]).reset_index(drop=True)
|
||||
|
|
@ -69,3 +72,4 @@ def app():
|
|||
"goal_value": "B",
|
||||
"trigger_file_path": filename
|
||||
}
|
||||
print(body)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ from recommendations.recommendation_utils import (
|
|||
get_recommended_part, get_wall_u_value
|
||||
)
|
||||
from recommendations.config import PARTIALLY_FILLED_PERCENTAGE_ASSUMPTION
|
||||
from utils.logger import setup_logger
|
||||
|
||||
logger = setup_logger()
|
||||
|
||||
|
||||
class WallRecommendations(Definitions):
|
||||
|
|
@ -125,7 +128,9 @@ class WallRecommendations(Definitions):
|
|||
|
||||
return
|
||||
|
||||
raise NotImplementedError("Not implemented yet")
|
||||
logger.error("Not implemented yet")
|
||||
return
|
||||
# NotImplementedError("Not implemented yet")
|
||||
|
||||
def find_cavity_insulation(self, u_value, insulation_thickness):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue