pdstools.utils.report_utils._filenames

Filename generation and resource copying for report rendering.

Functions

get_output_filename(→ str)

Generate the output filename based on the report parameters.

copy_quarto_file(→ None)

Copy the report quarto file to the temporary directory.

copy_report_resources(resource_dict)

Copy report resources from the reports directory to specified destinations.

Module Contents

get_output_filename(name: str | None, report_type: str, model_id: str | None = None, output_type: str = 'html') str

Generate the output filename based on the report parameters.

If name already ends with .{output_type} (case-insensitive), it is treated as a full filename and returned verbatim (after replacing spaces with underscores). Otherwise the filename is composed from report_type, name, and model_id with the extension appended.

Parameters:
  • name (str | None)

  • report_type (str)

  • model_id (str | None)

  • output_type (str)

Return type:

str

copy_quarto_file(qmd_file: str, temp_dir: pathlib.Path) None

Copy the report quarto file to the temporary directory.

Parameters:
  • qmd_file (str) – Name of the Quarto markdown file to copy

  • temp_dir (Path) – Destination directory to copy files to

Return type:

None

copy_report_resources(resource_dict: list[tuple[str, str]])

Copy report resources from the reports directory to specified destinations.

Parameters:

resource_dict (list[tuple[str, str]]) – list of tuples containing (source_path, destination_path) pairs

Return type:

None