Skip to content

Add Report Generation to PDF#24

Open
olivia-banks wants to merge 6 commits intoEpiForeSITE:mainfrom
olivia-banks:ob-report
Open

Add Report Generation to PDF#24
olivia-banks wants to merge 6 commits intoEpiForeSITE:mainfrom
olivia-banks:ob-report

Conversation

@olivia-banks
Copy link
Copy Markdown
Member

Screenshot 2026-03-31 at 11 06 48 AM

Added a report generation button that uses the browser's native functionality to produce a PDF, triggered by a button.

@olivia-banks olivia-banks self-assigned this Mar 31, 2026
Copilot AI review requested due to automatic review settings March 31, 2026 17:07
@olivia-banks olivia-banks added this to the MVP milestone Mar 31, 2026
@olivia-banks olivia-banks added the enhancement New feature or request label Mar 31, 2026
@olivia-banks olivia-banks linked an issue Mar 31, 2026 that may be closed by this pull request
@olivia-banks
Copy link
Copy Markdown
Member Author

This has a ton of extra changes because it's based off of #17; the requisite changes are located in:

./src/epicc/__main__.py
./src/epicc/utils/export.py
./src/epicc/web/sidebar.css

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Streamlit “Export Results as PDF” button (via browser print) and introduces print-specific CSS so results can be saved cleanly as a PDF. It also restructures the app into a src/epicc package with new config/model/formats abstractions, plus adds tests for the new formats/model-loading utilities.

Changes:

  • Add export/print flow backed by session state plus @media print CSS rules to hide Streamlit chrome.
  • Refactor the app into src/epicc with new config loading, model base classes, parameter loaders/UI helpers, and built-in model implementations.
  • Add a new epicc.formats layer (YAML/XLSX + template generation) and corresponding pytest coverage.

Reviewed changes

Copilot reviewed 38 out of 45 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
utils/section_renderer.py Removed legacy top-level Streamlit section renderer (migrated into package).
utils/parameter_ui.py Removed legacy sidebar parameter UI helpers (migrated into package).
utils/parameter_loader.py Removed legacy param loader (replaced by new formats + loader in package).
utils/model_loader.py Removed legacy dynamic model discovery/loader (replaced by built-in registry).
styles/sidebar.css Removed old CSS file (moved into package web assets).
tests/epicc/test_model_loader.py Adds tests for epicc.model.load_model.
tests/epicc/test_formats.py Adds tests for format selection + typed reads.
tests/epicc/test_formats_yaml.py Adds unit tests for YAMLFormat read/write.
tests/epicc/test_formats_xlsx.py Adds unit tests for XLSXFormat read/write.
tests/epicc/test_formats_template.py Adds integration tests for template generation to YAML/XLSX.
src/epicc/web/sidebar.css Adds sidebar styling plus print CSS to hide UI chrome and improve PDF output.
src/epicc/utils/section_renderer.py Reintroduces section rendering in the epicc package with block-type dispatch.
src/epicc/utils/parameter_ui.py Reintroduces parameter sidebar renderer/reset logic in the epicc package.
src/epicc/utils/parameter_loader.py New param loader using epicc.formats and a flattening adapter for sidebar UI.
src/epicc/utils/model_loader.py Defines built-in model registry returning TB + measles model instances.
src/epicc/utils/export.py Implements session-state driven “Export Results as PDF” button and print trigger injection.
src/epicc/utils/excel_model_runner.py Refactors imports/formatting; reuses shared flatten_dict.
src/epicc/models/tb_isolation.yaml Adds default parameter YAML for the TB Isolation model.
src/epicc/models/tb_isolation.py Adds packaged TB Isolation Python model implementing BaseSimulationModel.
src/epicc/models/measles_outbreak.yaml Adds default parameter YAML for the Measles Outbreak model.
src/epicc/models/measles_outbreak.py Adds packaged Measles Outbreak Python model implementing BaseSimulationModel.
src/epicc/model/schema.py Introduces Pydantic schema for declarative YAML-based models.
src/epicc/model/base.py Introduces BaseSimulationModel ABC for Python-defined models.
src/epicc/model/init.py Adds load_model() wrapper for reading/validating YAML model configs.
src/epicc/formats/yaml.py Adds YAML format reader/writer implementation.
src/epicc/formats/xlsx.py Adds XLSX format reader/writer implementation including dot-notation nesting.
src/epicc/formats/template.py Adds template generation from Pydantic models (placeholders + defaults).
src/epicc/formats/base.py Adds BaseFormat abstraction for parameter/model file IO.
src/epicc/formats/init.py Adds format registry + read_from_format() validation wrapper.
src/epicc/config/schema.py Adds typed config schema.
src/epicc/config/default.yaml Adds default app configuration YAML.
src/epicc/config/init.py Adds config loader and global CONFIG singleton.
src/epicc/main.py Replaces app.py with packaged Streamlit entrypoint and export integration.
sample/TB Isolation.xlsx Adds sample Excel workbook (binary) for TB isolation.
sample/Measles Outbreak.xlsx Adds sample Excel workbook (binary) for measles outbreak.
sample/~$TB Isolation.xlsx Adds an Excel temporary lock file (binary/PII).
pyproject.toml Updates dependencies (pydantic/ruamel/pytest) and pytest configuration.
models/tb_isolation.py Removes legacy standalone TB isolation model module.
models/measles_outbreak.py Removes legacy standalone measles model module.
config/paths.yaml Removes legacy config file.
config/global_defaults.yaml Removes legacy config file.
config/app.yaml Removes legacy config file.
app.py Removes legacy top-level Streamlit app entrypoint (replaced by src/epicc/__main__.py).
.gitignore Expands ignore patterns (venv, build artifacts, editor files, etc.).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olivia-banks
Copy link
Copy Markdown
Member Author

Blocked by #17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report Generation

2 participants