PHU Templates Directory¶
This directory contains Public Health Unit (PHU) specific template customizations.
Usage¶
Each PHU should create a subdirectory here with their organization-specific templates:
phu_templates/
├── my_phu/
│ ├── en_template.py (required for English output)
│ ├── fr_template.py (required for French output)
│ ├── conf.typ (required)
│ └── assets/ (optional - only if templates reference assets)
│ ├── logo.png (optional)
│ └── signature.png (optional)
Running with PHU Templates¶
To use a PHU-specific template, specify the template name with --template:
# Generate English notices
uv run viper students.xlsx en --template my_phu
# Generate French notices
uv run viper students.xlsx fr --template my_phu
This will load templates from phu_templates/my_phu/.
Template File Requirements¶
Core Requirements (Always Required)¶
conf.typ- Typst configuration and utility functions
Language-Specific Requirements (Based on Output Language)¶
-
en_template.py- Required only if generating English notices (--language en)- Must define
render_notice()function - Consulted only when
--language enis specified
- Must define
-
fr_template.py- Required only if generating French notices (--language fr)- Must define
render_notice()function - Consulted only when
--language fris specified
- Must define
Note: A PHU may provide templates for only one language. If a user requests a language your template does not support, the pipeline will fail with a clear error message. If you only support one language, only include that template file (e.g., only en_template.py).
Asset Requirements (Based on Template Implementation)¶
Assets in the assets/ directory are optional and depend entirely on your template implementation:
assets/logo.png- Only required if youren_template.pyorfr_template.pyreferences a logoassets/signature.png- Only required if youren_template.pyorfr_template.pyreferences a signature- Other files - Any additional assets (e.g.,
assets/header.png,assets/seal.pdf) may be included and referenced in your templates
Note: If your template references an asset (e.g., include "assets/logo.png" in Typst), that asset must exist. The pipeline will fail with a clear error if a referenced asset is missing.
Creating a PHU Template¶
If your PHU supports both English and French:
Then customize:
- Replace
assets/logo.pngwith your PHU logo - Replace
assets/signature.pngwith your signature - Modify
en_template.pyandfr_template.pyas needed - Adjust
conf.typfor organization-specific styling
Testing Your Template¶
# Test English generation
uv run viper students.xlsx en --template my_phu
# Test French generation (if you provided fr_template.py)
uv run viper students.xlsx fr --template my_phu
If a language template is missing:
FileNotFoundError: Template module not found: /path/to/phu_templates/my_phu/fr_template.py
Expected fr_template.py in /path/to/phu_templates/my_phu
If an asset referenced by your template is missing:
Git Considerations¶
Important: PHU-specific templates are excluded from version control via .gitignore.
- Templates in this directory will NOT be committed to the main repository
- Each PHU should maintain their templates in their own fork or separate repository
- The
README.mdfile and.gitkeepare the only tracked files in this directory