From 01281e4b3111c683eca3ca8cbf7f416a5d713175 Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 21 Jul 2023 11:48:00 -0400 Subject: [PATCH] Redefine api structure Add future methods Update documentation --- bootstrap.py | 6 +++--- hub_api/docs/openapi-specs.yml | 8 ++++---- .../retrofit_results.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) rename hub_api/{monthly_energy_balance => persistence}/retrofit_results.py (86%) diff --git a/bootstrap.py b/bootstrap.py index c66de77..547f0a4 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -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') diff --git a/hub_api/docs/openapi-specs.yml b/hub_api/docs/openapi-specs.yml index fd37220..b972a41 100644 --- a/hub_api/docs/openapi-specs.yml +++ b/hub_api/docs/openapi-specs.yml @@ -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 diff --git a/hub_api/monthly_energy_balance/retrofit_results.py b/hub_api/persistence/retrofit_results.py similarity index 86% rename from hub_api/monthly_energy_balance/retrofit_results.py rename to hub_api/persistence/retrofit_results.py index 9939db3..665f1a4 100644 --- a/hub_api/monthly_energy_balance/retrofit_results.py +++ b/hub_api/persistence/retrofit_results.py @@ -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)