Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spreadsheet generation for templates #260

Merged
merged 9 commits into from
Jun 20, 2023

Conversation

gtfierro
Copy link
Collaborator

@gtfierro gtfierro commented Jun 4, 2023

I needed to implement this for a demo so here's a first cut at it

from buildingmotif import BuildingMOTIF
from buildingmotif.dataclasses import Library

bm = BuildingMOTIF("sqlite://")
nrel_lib = Library.load(directory="libraries/ashrae/223p/nrel-templates")
templ = nrel_lib.get_template_by_name('sensor')

templ.generate_spreadsheet('sensor.xlsx')

Generates a spreadsheet like this:

Screenshot 2023-06-04 at 3 13 09 PM

@gtfierro gtfierro linked an issue Jun 13, 2023 that may be closed by this pull request
Copy link
Member

@TShapinsky TShapinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I CANT BELIEVE YOUVE DONE THIS.

thanks gabe

buildingmotif/dataclasses/template.py Outdated Show resolved Hide resolved
tests/unit/dataclasses/test_template_dc.py Outdated Show resolved Hide resolved
tests/unit/dataclasses/test_template_dc.py Outdated Show resolved Hide resolved
tests/unit/dataclasses/test_template_dc.py Outdated Show resolved Hide resolved
@gtfierro
Copy link
Collaborator Author

I broke out tests for spreadsheet and CSV generation. It's not currently testing the write-directly-to-file path but I'd like to find a way to avoid duplicating all the test logic to handle that

Move template generation tests to their own file
@gtfierro gtfierro requested a review from TShapinsky June 16, 2023 22:53
@gtfierro
Copy link
Collaborator Author

Tests are now parameterized and a fair bit cleaner in their implementation. I should be touching all of the codepaths as well. This is ready for review!

Copy link
Member

@TShapinsky TShapinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@gtfierro gtfierro merged commit 82413c6 into develop Jun 20, 2023
@gtfierro gtfierro deleted the gtf-add-spreadsheet-generation branch June 20, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to Generate a Spreadsheet from a Template
2 participants