πŸ“‘ sections.protocol_clsΒΆ

Protocol for report builder classes.

Any class implementing this protocol must provide the following attributes and methods, which are used for constructing and managing report sections, handling data, and exporting results.

ClassesΒΆ

class owlmix.reporting.sections.protocol_cls.ReportBuilderProtocolΒΆ

Attributes:

  • df (pandas.DataFrame): The main DataFrame containing the data for analysis.

  • target_col (str): The name of the target column for analysis.

  • date_col (str): The name of the date column in the DataFrame.

  • config (ConfigBuilder): The configuration object for the report.

Methods:

abstractmethod add_all_sections()ΒΆ

Add all available sections to the report.

abstractmethod include_sections(sections)ΒΆ

Include only the specified sections in the report.

Parameters:

sections (list[str]) – List of section names to include.

abstractmethod exclude_sections(sections)ΒΆ

Exclude the specified sections from the report.

Parameters:

sections (list[str]) – List of section names to exclude.

abstractmethod add_section(name, data, chart)ΒΆ

Add a section to the report with the given name, data, and chart.

Parameters:
  • name (str) – Name of the section.

  • data (dict) – Data dictionary for the section.

  • chart (dict) – Chart dictionary for the section.

Returns:

Self (the report builder instance).

abstractmethod add_section_by_name(name)ΒΆ

Add a section to the report by its name.

Parameters:

name (str) – Name of the section.

Returns:

Self (the report builder instance).

abstractmethod build(output_path)ΒΆ

Build the report and output it to the specified path.

Parameters:

output_path (str or pathlib.Path) – Path to save the report.

Returns:

Dictionary containing the report data.

abstractmethod image_to_base64(path)ΒΆ

Convert an image at the given path to a base64-encoded string.

Parameters:

path (str or pathlib.Path) – Path to the image file.

Returns:

Base64-encoded string of the image.

abstractmethod save(path)ΒΆ

Save the report to the specified path.

Parameters:

path (str or pathlib.Path) – Path to save the report.

DependenciesΒΆ

  • pandas

  • typing.Protocol

  • pathlib.Path

  • ConfigBuilder from owlmix.config.config_builder

See AlsoΒΆ

Back to Home