From 51c8eec2290247d1cc55c5418480ab714b34853b Mon Sep 17 00:00:00 2001 From: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:40:54 -0700 Subject: [PATCH] Version 0.4.2 (#40) * Merge main into develop after release (#21) * Release 0.3.0 (#20) * precommit * Fix delete cycle progress key and race condition (#24) * Release 0.3.0 (#20) * precommit * add progress key to delete cycles * Remove deprecated APIs, fix typos (#23) * Update README.rst * update license (#26) * Updates to support 179d, includes creating property, downloading property reports from ESPM, and updating building search(#22) * adding create_building and update_building methods * modify search_buildings to provide appropriate cycle id * adding client methods for creating extra data columns * add pass throughs for file downloads * updates for audit template workflow * method to download property xlsx --------- Co-authored-by: Alex Swindler Co-authored-by: Nicholas Long Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com> * prep release * increase timeout for server start * increase timeout for server start (#31) * cleanup before release (#32) * configure seed to load small EEEJ dataset for integration test (#33) * add analysis retrieve methods (#34) * Added multiple cycle upload argument (#27) * Added multiple cycle upload argument * Responded to comments and fixed failing tests * Converted to using kwargs * Pre-commit * Cleanup README.rst (#35) * cleanup readme * populate description in pypi * precommit fix * Endpoint to download an Audit Template Report Submission and store in SEED (#36) * start of AT report download method * adding endpoint to download AT report submission and store in SEED * add analysis retrieve methods (#34) * Added multiple cycle upload argument (#27) * Added multiple cycle upload argument * Responded to comments and fixed failing tests * Converted to using kwargs * Pre-commit * Cleanup README.rst (#35) * cleanup readme * populate description in pypi * precommit fix * Endpoint to download an Audit Template Report Submission and store in SEED (#36) * start of AT report download method * adding endpoint to download AT report submission and store in SEED * prep 0.4.1 (#37) * Update CHANGELOG.rst * update release instruction * Update README.rst * Update README.rst * add new method to get AT submission metadata (#39) * Update CHANGELOG.rst * Update setup.cfg --------- Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com> Co-authored-by: Alex Swindler Co-authored-by: Nicholas Long Co-authored-by: Alex Chapin --- CHANGELOG.rst | 7 +++++++ README.rst | 6 ++++-- pyseed/seed_client.py | 27 ++++++++++++++++++++++++++- setup.cfg | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 601c904..f9da408 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog ========= +0.4.2 +----- +What's Changed +************** + +* add new method to get AT submission metadata by @kflemin in https://github.com/SEED-platform/py-seed/pull/39 + 0.4.1 ----- diff --git a/README.rst b/README.rst index e30b241..377e0d3 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,6 @@ py-SEED -======= +=========== + .. image:: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg?branch=develop :target: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg @@ -125,6 +126,7 @@ Full details in LICENSE file. Releasing --------- +* Configure your PyPi with token access `https://pypi.org/manage/account/token/ `_. * Merge down to main * Tag release on GitHub and add in the change log * Release via command line @@ -136,4 +138,4 @@ Releasing pip install twine # make sure to check the dist package for errors in the RST files twine check dist/* - twine upload dist/* + twine upload --repository py-seed dist/* diff --git a/pyseed/seed_client.py b/pyseed/seed_client.py index 15f3e53..b7d175b 100644 --- a/pyseed/seed_client.py +++ b/pyseed/seed_client.py @@ -1427,6 +1427,27 @@ def retrieve_at_building_and_update(self, audit_template_building_id: int, cycle return response + def retrieve_at_submission_metadata(self, audit_template_submission_id: int) -> dict: + """Connect to audit template and retrieve audit report json (metadata only) by submission ID + + Args: + audit_template_submission_id (int): ID of the AT submission report (different than building ID) + + Returns: + dict: Response from the SEED API + """ + + # api/v3/audit_template/pk/get_submission + response = self.client.get( + None, + required_pk=False, + endpoint="audit_template_submission", + url_args={"PK": audit_template_submission_id}, + report_format='json' + ) + + return response + def retrieve_at_submission_and_update(self, audit_template_submission_id: int, cycle_id: int, seed_id: int, report_format: str = 'pdf', filename: str = None) -> dict: """Connect to audit template and retrieve audit report by submission ID @@ -1444,6 +1465,7 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c # api/v3/audit_template/pk/get_submission # accepts pdf or xml + response = self.client.get( None, required_pk=False, @@ -1454,6 +1476,8 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c if response['status'] == 'success': if report_format.lower() == 'pdf': + + # for PDF, store pdf report as inventory document pdf_file = response['content'] if not filename: filename = 'at_submission_report_' + str(audit_template_submission_id) + '.pdf' @@ -1470,7 +1494,8 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c ) response2['pdf_report'] = pdf_file else: - # assume XML + + # assume XML. for XML, update property with BuildingSync # now post to api/v3/properties/PK/update_with_buildingsync xml_file = response['content'] if not filename: diff --git a/setup.cfg b/setup.cfg index 8a18908..1ea6dd7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name=py-seed -version=0.4.1 +version=0.4.2 description=A Python API client for the SEED Platform author=Nicholas Long, Katherine Fleming, Fable Turas, Paul Munday author_email=nicholas.long@nrel.gov, fable@raintechpdx.com, paul@paulmunday.net