mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
remocing temp code which created a bug
This commit is contained in:
parent
1bd7c4ef17
commit
3410123491
3 changed files with 78 additions and 3 deletions
|
|
@ -411,9 +411,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
|
||||
# We check for an energy assessment we have performed on this property:
|
||||
energy_assessment = get_latest_assessment_by_uprn(session, uprn if uprn is not None else epc_searcher.uprn)
|
||||
|
||||
if not energy_assessment["epc"]:
|
||||
continue
|
||||
|
||||
# Create a record in db
|
||||
property_id, is_new = create_property(
|
||||
session, body.portfolio_id, epc_searcher.address_clean, epc_searcher.postcode_clean,
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ NON_INVASIVE_SPECIFIC_MEASURES = [
|
|||
"draught_proofing",
|
||||
"mixed_glazing", # This covers partial double glazing and secondary glazing
|
||||
"cavity_extract_and_refill",
|
||||
# Indicates that there is one (need to handle the case where there are multiple)
|
||||
# extension that requires cavity wall insulation
|
||||
"extension_cavity_wall_insulation",
|
||||
]
|
||||
|
||||
# This allows us to extend high level categories for measures such as "wall_insulation" to the specific measures
|
||||
|
|
@ -78,6 +81,7 @@ class PlanTriggerRequest(BaseModel):
|
|||
already_installed_file_path: Optional[str] = None
|
||||
patches_file_path: Optional[str] = None
|
||||
non_invasive_recommendations_file_path: Optional[str] = None
|
||||
valuation_file_path: Optional[str] = None
|
||||
exclusions: Optional[conlist(str, min_items=1)] = None
|
||||
inclusions: Optional[conlist(str, min_items=1)] = None
|
||||
|
||||
|
|
|
|||
73
etl/customers/remote_assessments/app.py
Normal file
73
etl/customers/remote_assessments/app.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
import pandas as pd
|
||||
from utils.s3 import save_csv_to_s3
|
||||
|
||||
PORTFOLIO_ID = 111
|
||||
USER_ID = 8
|
||||
|
||||
|
||||
def app():
|
||||
"""
|
||||
This application is used to initialise and run remote assessments
|
||||
:return:
|
||||
"""
|
||||
|
||||
asset_list = [
|
||||
{
|
||||
"uprn": 100050770761,
|
||||
"address": "12 Sheardown Street",
|
||||
"postcode": "DN4 0BH"
|
||||
}
|
||||
]
|
||||
asset_list = pd.DataFrame(asset_list)
|
||||
|
||||
# Store the asset list in s3
|
||||
filename = f"{USER_ID}/{PORTFOLIO_ID}/asset_list.csv"
|
||||
save_csv_to_s3(
|
||||
dataframe=asset_list,
|
||||
bucket_name="retrofit-plan-inputs-dev",
|
||||
file_name=filename
|
||||
)
|
||||
|
||||
non_invasive_recommendations = [
|
||||
{
|
||||
"uprn": 100050770761,
|
||||
"recommendations": [
|
||||
{
|
||||
"type": "extension_cavity_wall_insulation",
|
||||
"sap_points": 2,
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
# Store non-invasive recommendations in S3
|
||||
non_invasive_recommendations_filename = f"{USER_ID}/{PORTFOLIO_ID}/non_invasive_recommendations.csv"
|
||||
save_csv_to_s3(
|
||||
dataframe=pd.DataFrame(non_invasive_recommendations),
|
||||
bucket_name="retrofit-plan-inputs-dev",
|
||||
file_name=non_invasive_recommendations_filename
|
||||
)
|
||||
|
||||
valuation_data = [{100050770761: 67_000}]
|
||||
# Store valuation data to s3
|
||||
valuation_filename = f"{USER_ID}/{PORTFOLIO_ID}/valuation.csv"
|
||||
save_csv_to_s3(
|
||||
dataframe=pd.DataFrame(valuation_data),
|
||||
bucket_name="retrofit-plan-inputs-dev",
|
||||
file_name=valuation_filename
|
||||
)
|
||||
|
||||
body = {
|
||||
"portfolio_id": str(PORTFOLIO_ID),
|
||||
"housing_type": "Private",
|
||||
"goal": "Increasing EPC",
|
||||
"goal_value": "C",
|
||||
"trigger_file_path": filename,
|
||||
"already_installed_file_path": "",
|
||||
"patches_file_path": "",
|
||||
"non_invasive_recommendations_file_path": non_invasive_recommendations_filename,
|
||||
"valuation_file_path": valuation_filename,
|
||||
"scenario_name": "Full package remote assessment",
|
||||
"multi_plan": True,
|
||||
"budget": None,
|
||||
}
|
||||
print(body)
|
||||
Loading…
Add table
Reference in a new issue