Bb import scripts#87
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the pyseed client to support additional SEED API endpoints related to Portfolio Manager meter downloads and organization access-level imports, and adjusts Portfolio Manager report downloading to save to a caller-provided filepath.
Changes:
- Added new SEED API endpoint mappings for Portfolio Manager meter download and organization access-level name/instance import flows.
- Updated
download_pm_reportto save directly to a provided filepath instead of creating its ownreports/output path. - Added new
SeedClienthelper methods for uploading meter datafiles, downloading meter exports from Portfolio Manager, and updating organization access-level names/instances.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
pyseed/seed_client_base.py |
Adds new URL mappings for Portfolio Manager meter download and org access-level import endpoints. |
pyseed/seed_client.py |
Updates PM report download behavior and adds new helper methods for meters import/download and org access-level updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1908
to
+1950
| def retrieve_portfolio_manager_meters( | ||
| self, | ||
| username: str, | ||
| password: str, | ||
| pm_property_ids: list[str], | ||
| start_date: date, | ||
| endtime_date: date, | ||
| save_file_name: Path, | ||
| ) -> dict: | ||
| """Connect to portfolio manager and download an individual meters data in Excel format | ||
|
|
||
| Args: | ||
| username (str): ESPM login username | ||
| password (str): ESPM password | ||
| pm_property_ids (list(str)): property whoms meters to download | ||
| start_date (date): start_date from meter readings | ||
| endtime_date (date): end_date from meter readings | ||
| save_file_name (Path): Location to save the file, preferably an absolute path | ||
|
|
||
| Returns: | ||
| dict: Did the file download? | ||
| """ | ||
| if save_file_name.exists(): | ||
| raise Exception(f"Save filename already exists, save to a new file name: {save_file_name}") | ||
|
|
||
| response = self.client.post( | ||
| "portfolio_manager_meter_download", | ||
| json={ | ||
| "username": username, | ||
| "password": password, | ||
| "property_ids": pm_property_ids, | ||
| "start_date": start_date.strftime("%m/%d/%Y"), | ||
| "end_date": endtime_date.strftime("%m/%d/%Y"), | ||
| }, | ||
| ) | ||
| result = {"status": "error"} | ||
| # save the file to the location that was passed | ||
| # note that the data are returned directly (the ESPM URL directly downloads the file) | ||
| if isinstance(response, bytes): | ||
| with open(save_file_name, "wb") as f: | ||
| f.write(response) | ||
| result["status"] = "success" | ||
| return result |
Comment on lines
+2035
to
+2073
| def update_organizations_access_level_names(self, access_level_names: list[str]) -> list: | ||
| return self.client.post( | ||
| endpoint="update_org_access_level_names", | ||
| json={"access_level_names": access_level_names}, | ||
| url_args={"PK": self.client.org_id}, | ||
| ) | ||
|
|
||
| def update_organizations_access_level_instances(self, file: str): | ||
| # upload file | ||
| with open(file, "rb") as f: | ||
| response = self.client.put( | ||
| None, | ||
| required_pk=False, | ||
| url_args={"PK": self.client.org_id}, | ||
| endpoint="upload_org_access_level_instances_file", | ||
| files={ | ||
| "file": ( | ||
| file, | ||
| f, | ||
| "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", | ||
| ), | ||
| }, | ||
| ) | ||
|
|
||
| if not response["success"]: | ||
| raise ValueError("could not upload access level instances") | ||
|
|
||
| # start saving the file | ||
| response = self.client.post( | ||
| endpoint="start_org_access_level_instances_file_save", | ||
| url_args={"PK": self.client.org_id}, | ||
| json={"filename": response["tempfile"]}, | ||
| ) | ||
| progress_key = response.get("progress_key", None) | ||
|
|
||
| # wait until save is complete | ||
| result = self.track_progress_result(progress_key) | ||
|
|
||
| return result |
Comment on lines
+1917
to
+1924
| """Connect to portfolio manager and download an individual meters data in Excel format | ||
|
|
||
| Args: | ||
| username (str): ESPM login username | ||
| password (str): ESPM password | ||
| pm_property_ids (list(str)): property whoms meters to download | ||
| start_date (date): start_date from meter readings | ||
| endtime_date (date): end_date from meter readings |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
kflemin
added a commit
that referenced
this pull request
Apr 21, 2026
* Fix release notes (#55) * fix release notes * update compatability matrix * Add cross cycles inventory, column profiles, delete inventory, and show only populated columns (#58) * update dependencies * add in various methods, column list profiles support, cross cycle data, etc * fix mypy * add trigger only show populated * coerce ints * remove extra pring * fix a couple docstrings that were defaulted * Add in dependabot checks (#59) * add in dependabot checks * fix precommit * Update dependabot.yml * deps: bump tox from 4.24.2 to 4.26.0 (#60) Bumps [tox](https://github.com/tox-dev/tox) from 4.24.2 to 4.26.0. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@4.24.2...4.26.0) --- updated-dependencies: - dependency-name: tox dependency-version: 4.26.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump pytest-cov from 6.0.0 to 6.1.1 (#61) Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 6.0.0 to 6.1.1. - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v6.0.0...v6.1.1) --- updated-dependencies: - dependency-name: pytest-cov dependency-version: 6.1.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump pytest-xdist from 3.6.1 to 3.7.0 (#62) Bumps [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) from 3.6.1 to 3.7.0. - [Release notes](https://github.com/pytest-dev/pytest-xdist/releases) - [Changelog](https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-xdist@v3.6.1...v3.7.0) --- updated-dependencies: - dependency-name: pytest-xdist dependency-version: 3.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump pytest from 8.3.5 to 8.4.0 (#64) Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.5 to 8.4.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.3.5...8.4.0) --- updated-dependencies: - dependency-name: pytest dependency-version: 8.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump mypy from 1.15.0 to 1.16.0 (#63) * deps: bump mypy from 1.15.0 to 1.16.0 Bumps [mypy](https://github.com/python/mypy) from 1.15.0 to 1.16.0. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.15.0...v1.16.0) --- updated-dependencies: - dependency-name: mypy dependency-version: 1.16.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * catch progress_data none --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicholas Long <nicholas.long@nrel.gov> * deps: bump mypy from 1.16.0 to 1.16.1 (#66) Bumps [mypy](https://github.com/python/mypy) from 1.16.0 to 1.16.1. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.16.0...v1.16.1) --- updated-dependencies: - dependency-name: mypy dependency-version: 1.16.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump pytest-cov from 6.1.1 to 6.2.1 (#65) Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 6.1.1 to 6.2.1. - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v6.1.1...v6.2.1) --- updated-dependencies: - dependency-name: pytest-cov dependency-version: 6.2.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump tox from 4.26.0 to 4.27.0 (#67) Bumps [tox](https://github.com/tox-dev/tox) from 4.26.0 to 4.27.0. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@4.26.0...4.27.0) --- updated-dependencies: - dependency-name: tox dependency-version: 4.27.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump pytest from 8.4.0 to 8.4.1 (#68) Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.4.0 to 8.4.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.4.0...8.4.1) --- updated-dependencies: - dependency-name: pytest dependency-version: 8.4.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update dependabot config (#69) * deps: bump the prod-deps group across 1 directory with 4 updates (#74) Bumps the prod-deps group with 4 updates in the / directory: [mypy](https://github.com/python/mypy), [pre-commit](https://github.com/pre-commit/pre-commit), [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) and [tox](https://github.com/tox-dev/tox). Updates `mypy` from 1.16.1 to 1.17.1 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.16.1...v1.17.1) Updates `pre-commit` from 4.2.0 to 4.3.0 - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](pre-commit/pre-commit@v4.2.0...v4.3.0) Updates `pytest-xdist` from 3.7.0 to 3.8.0 - [Release notes](https://github.com/pytest-dev/pytest-xdist/releases) - [Changelog](https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-xdist@v3.7.0...v3.8.0) Updates `tox` from 4.27.0 to 4.28.4 - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@4.27.0...4.28.4) --- updated-dependencies: - dependency-name: mypy dependency-version: 1.17.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: pre-commit dependency-version: 4.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: pytest-xdist dependency-version: 3.8.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: tox dependency-version: 4.28.4 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ci: bump the actions-deps group across 1 directory with 2 updates (#75) Bumps the actions-deps group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/checkout` from 4 to 5 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v5) Updates `actions/download-artifact` from 4 to 5 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: actions/download-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump tox from 4.28.4 to 4.29.0 in the prod-deps group (#76) Bumps the prod-deps group with 1 update: [tox](https://github.com/tox-dev/tox). Updates `tox` from 4.28.4 to 4.29.0 - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@4.28.4...4.29.0) --- updated-dependencies: - dependency-name: tox dependency-version: 4.29.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * deps: bump the prod-deps group with 2 updates (#78) Bumps the prod-deps group with 2 updates: [pytest](https://github.com/pytest-dev/pytest) and [tox](https://github.com/tox-dev/tox). Updates `pytest` from 8.4.1 to 8.4.2 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.4.1...8.4.2) Updates `tox` from 4.29.0 to 4.30.2 - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@4.29.0...4.30.2) --- updated-dependencies: - dependency-name: pytest dependency-version: 8.4.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod-deps - dependency-name: tox dependency-version: 4.30.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ci: bump actions/setup-python from 5 to 6 in the actions-deps group (#77) Bumps the actions-deps group with 1 update: [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/setup-python` from 5 to 6 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicholas Long <nicholas.long@nrel.gov> * deps: bump the prod-deps group across 1 directory with 2 updates (#80) Bumps the prod-deps group with 2 updates in the / directory: [mypy](https://github.com/python/mypy) and [pytest-cov](https://github.com/pytest-dev/pytest-cov). Updates `mypy` from 1.17.1 to 1.18.1 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.17.1...v1.18.1) Updates `pytest-cov` from 6.2.1 to 7.0.0 - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v6.2.1...v7.0.0) --- updated-dependencies: - dependency-name: mypy dependency-version: 1.18.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: pytest-cov dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add element create (#86) * Fix meter import and Add property filtering * Add element create * Format * Format * add test * precommit * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * bump version and update copyrights and names (#88) * Bb import scripts (#87) * Fix meter import and Add property filtering * Add endpoints for bb scripts * Tox * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * adding test --------- Co-authored-by: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicholas Long <nicholas.long@nrel.gov> Co-authored-by: Hannah Eslinger <hannah.eslinger@nlr.gov> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.