flexmeasures.data.services.report_templates
Logic for loading prepared report templates.
Report templates are YAML files packaged in flexmeasures/data/templates/reports. Each template describes a ready-made report definition: a reporter class, a complete reporter config and a parameters skeleton in which users fill in their own sensors (replacing the FILL_IN placeholders).
Functions
- flexmeasures.data.services.report_templates.find_placeholders(obj: Any, root: str = '') list[str]
List the paths of any unfilled template placeholders in the given (nested) object.
- flexmeasures.data.services.report_templates.get_report_template(name: str) dict | None
Load the packaged report template with the given name, if it exists.
- flexmeasures.data.services.report_templates.get_report_template_text(name: str) str | None
The raw YAML of the packaged report template with the given name, if it exists.
Unlike get_report_template, this preserves the explanatory comments, so users can pipe the result to a file and edit it.
- flexmeasures.data.services.report_templates.list_report_templates() list[dict]
Load all packaged report templates (sorted by name).
- flexmeasures.data.services.report_templates.merge_template_parameters(template_parameters: dict, user_parameters: dict, user_provided_timing: bool = False) dict
Merge user-provided report parameters on top of a template’s parameters skeleton.
Top-level keys provided by the user win. Timing fields are treated as a group: if the user provides any timing field (or user_provided_timing is set, e.g. because timing was given through CLI options), the template’s recommended timing fields are dropped altogether.