Part of epic: #32
What
Create pptx_export.py with the ResearchNotePPTX class, GS-style colour palette constants, 16:9 widescreen presentation setup, and the build() / save() scaffold. Individual slide methods will be implemented in follow-up sub-issues (#42, #43).
Implementation
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
# GS-style palette
GS_BLUE = RGBColor(0x00, 0x38, 0x6B)
GS_GOLD = RGBColor(0xC8, 0xA8, 0x50)
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT_GREY = RGBColor(0xF5, 0xF5, 0xF5)
GREEN = RGBColor(0x00, 0x7A, 0x33) # BUY
RED = RGBColor(0xC0, 0x39, 0x2B) # SELL
RATING_COLOURS = {'BUY': GREEN, 'HOLD': LIGHT_GREY, 'SELL': RED}
class ResearchNotePPTX:
SLIDE_W = Inches(13.33) # 16:9 widescreen
SLIDE_H = Inches(7.5)
def __init__(self, note_json: dict, chart_paths: dict = None):
self.note = note_json
self.charts = chart_paths or {}
self.prs = Presentation()
self.prs.slide_width = self.SLIDE_W
self.prs.slide_height = self.SLIDE_H
def build(self) -> Presentation:
"""Build all slides and return presentation object."""
self._add_cover_slide()
self._add_exec_summary_slide()
self._add_thesis_slide()
self._add_financials_slide()
self._add_valuation_slide()
self._add_price_chart_slide()
self._add_peer_comparison_slide()
self._add_risks_slide()
self._add_catalysts_slide()
self._add_appendix_slide()
return self.prs
def save(self, output_path: str) -> None:
self.build().save(output_path)
def _blank_slide(self):
"""Return a blank slide layout."""
blank_layout = self.prs.slide_layouts[6]
return self.prs.slides.add_slide(blank_layout)
def _add_header_bar(self, slide, title: str, subtitle: str = ''):
"""Add GS-blue header bar with white title text to any slide."""
...
# Stub methods to be implemented in follow-up issues
def _add_cover_slide(self): ...
def _add_exec_summary_slide(self): ...
def _add_thesis_slide(self): ...
def _add_financials_slide(self): ...
def _add_valuation_slide(self): ...
def _add_price_chart_slide(self): ...
def _add_peer_comparison_slide(self): ...
def _add_risks_slide(self): ...
def _add_catalysts_slide(self): ...
def _add_appendix_slide(self): ...
Dependencies
Acceptance Criteria
Part of epic: #32
What
Create
pptx_export.pywith theResearchNotePPTXclass, GS-style colour palette constants, 16:9 widescreen presentation setup, and thebuild()/save()scaffold. Individual slide methods will be implemented in follow-up sub-issues (#42, #43).Implementation
Dependencies
Acceptance Criteria
pptx_export.pyexists and is importableResearchNotePPTX(note_json).save('test.pptx')runs without error.pptxis 16:9 widescreen (13.33 x 7.5 inches)python-pptxadded torequirements.txt_blank_slide()and_add_header_bar()helpers implemented and tested