PPTX Template Fill-in Functionality
Created by: john525
Hi, I have added a new directory "pna" in bpeng, with the following new files: pna.py - handles generation of V1 ASHP PNA (ASHP-v1 specific) template.py - handles filling our PPTX template (extensible to other kinds of PNA) discrete_bar_graph.py - generates a pseudo "bar graph" by dynamically coloring in N cells of a table field_format.py - a few helper functions for text formatting
Higher up there is also a new folder dev-templates that contains a PPTX template we can use for python-pptx (local development only, we will have to set up stable versioned links for PPTX templates to be downloaded from in production)
Under the main bpeng test directory, I have added a file pna/test_basic.py that tests the PPTX generation.
To review this PR, cd to your bpengine directory and then:
git checkout pna_updates
Then make a virtual environment using python3 (e.g. virtualenv asdf && source asdf/bin/activate) and install all bpengine dependencies:
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-conda.txt
python3
Then within that python3 shell, you can run:
from tests.pna.test_basic import test
test()
If everything works right, you should get some print statements to stdout, the last of which will be a path to a temporary file. You can then do
exit()
open /tmp/bpeng/74b7dc6f-635b-4a58-8210-aa907c414316/PNS_81_Prospect_Street.pptx
But obviously, replacing that specific path with the path that is printed out from the test function.
Check out the result PPT - if everything looks good, go into tests/pna/test_basic.py and try messing around with some of the input parameters that are passed to the function generate_ashp_pna() to see if it still generates a PPTX that looks correct. Then exit and re-enter the python shell, re-import the test function, and run it again to get a new path to a new PPTX file
If you get any errors importing the module or running the test script, comment them here