mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added plan name to export
This commit is contained in:
parent
0333f33123
commit
3d18827961
2 changed files with 5 additions and 3 deletions
|
|
@ -150,6 +150,7 @@ class DbMethods:
|
|||
self.session.query(
|
||||
Recommendation,
|
||||
PlanModel.scenario_id,
|
||||
PlanModel.name
|
||||
)
|
||||
.join(
|
||||
PlanRecommendations,
|
||||
|
|
@ -171,6 +172,7 @@ class DbMethods:
|
|||
for col in Recommendation.__table__.columns
|
||||
},
|
||||
"scenario_id": r.scenario_id,
|
||||
"plan_name": r.name,
|
||||
}
|
||||
for r in recs_query
|
||||
]
|
||||
|
|
|
|||
|
|
@ -59,17 +59,17 @@ def process_export(payload: ExportRequest, session: Session) -> Dict[Union[str,
|
|||
continue
|
||||
|
||||
measures_df: pd.DataFrame = scenario_recs[
|
||||
["property_id", "measure_type", "estimated_cost"]
|
||||
["property_id", "measure_type", "plan_name", "estimated_cost"]
|
||||
].drop_duplicates()
|
||||
|
||||
pivot = measures_df.pivot(
|
||||
index="property_id",
|
||||
index=["property_id", "plan_name"],
|
||||
columns="measure_type",
|
||||
values="estimated_cost",
|
||||
).reset_index()
|
||||
|
||||
pivot["total_retrofit_cost"] = (
|
||||
pivot.drop(columns=["property_id"]).sum(axis=1)
|
||||
pivot.drop(columns=["property_id", "plan_name"]).sum(axis=1)
|
||||
)
|
||||
|
||||
post_sap = (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue