Redefine api structure
Add future methods Update documentation
This commit is contained in:
parent
72b90557ff
commit
01281e4b31
@ -17,7 +17,7 @@ import threading
|
||||
import hub_api.helpers.session_helper as sh
|
||||
from hub_api.control.session import SessionStart, SessionEnd, KeepSessionAlive
|
||||
from hub_api.control.uptime import Uptime
|
||||
from hub_api.monthly_energy_balance.retrofit_results import RetrofitResults
|
||||
from hub_api.persistence.retrofit_results import RetrofitResults
|
||||
from hub_api.workflow.insel_montly_energy_balance import InselMonthlyEnergyBalance
|
||||
from hub_api.workflow.costs import Costs
|
||||
from hub_api.workflow.energy_plus import EnergyPlus
|
||||
@ -36,8 +36,8 @@ api.add_resource(SessionStart, '/v1.4/session/start')
|
||||
api.add_resource(SessionEnd, '/v1.4/session/end')
|
||||
api.add_resource(KeepSessionAlive, '/v1.4/session/keep-alive')
|
||||
|
||||
# monthly_energy_balance
|
||||
api.add_resource(RetrofitResults, '/v1.4/monthly-energy-balance/retrofit-results')
|
||||
# persistence
|
||||
api.add_resource(RetrofitResults, '/v1.4/persistence/retrofit-results')
|
||||
|
||||
# energy plus
|
||||
api.add_resource(IdfGenerator, '/v1.4/energy-plus/idf-generator')
|
||||
|
@ -144,7 +144,7 @@ paths:
|
||||
schema:
|
||||
$ref: '#/components/schemas/unauthorized'
|
||||
|
||||
/v1.4/monthly-energy-balance/retrofit-results:
|
||||
/v1.4/persistence/retrofit-results:
|
||||
post:
|
||||
security:
|
||||
- session_id: [ ]
|
||||
@ -162,10 +162,10 @@ paths:
|
||||
description: Cities list
|
||||
example: { "cities": [{ "Montreal current status": ["149_part_0_zone_0", "1_part_0_zone_0"]}]}
|
||||
tags:
|
||||
- Buildings monthly energy balance monthly_energy_balance
|
||||
summary: Retrieve the monthly energy balance results for the given monthly_energy_balance in the given cities
|
||||
- Buildings monthly energy balance persistence
|
||||
summary: Retrieve the monthly energy balance results for the given persistence in the given cities
|
||||
operationId: retrofit_results
|
||||
description: Retrieve the monthly energy balance results for the given monthly_energy_balance in the given cities
|
||||
description: Retrieve the monthly energy balance results for the given persistence in the given cities
|
||||
responses:
|
||||
'200':
|
||||
description: Succeed
|
||||
|
@ -13,7 +13,7 @@ class RetrofitResults(Resource, Config):
|
||||
|
||||
def post(self):
|
||||
"""
|
||||
API call for requesting a specified list of enriched monthly_energy_balance
|
||||
API call for requesting a specified list of enriched persistence
|
||||
"""
|
||||
session_id = request.headers.get('session_id', None)
|
||||
token = request.headers.get('token', None)
|
||||
@ -34,8 +34,8 @@ class RetrofitResults(Resource, Config):
|
||||
city_name = next(iter(results))
|
||||
for building_results in results[city_name]:
|
||||
values = []
|
||||
for value in building_results['insel monthly_energy_balance']:
|
||||
for value in building_results['insel persistence']:
|
||||
key = next(iter(value))
|
||||
values.append({key: json.loads(value[key])})
|
||||
building_results['insel monthly_energy_balance'] = values
|
||||
building_results['insel persistence'] = values
|
||||
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)
|
Loading…
Reference in New Issue
Block a user