π sections.acf_pacfΒΆ
Builds the ACF and PACF section for the report.
This function retrieves configuration for ACF/PACF analysis from the report builder, initializes the appropriate analyzer and plotter classes with their parameters, computes the ACF/PACF data, generates the corresponding plots, and returns a dictionary containing both the computed data and chart metadata (including a base64-encoded image).
FunctionsΒΆ
- owlmix.reporting.sections.acf_pacf.build_acf_pacf_section(report_builder)ΒΆ
- Parameters:
report_builder (
ReportBuilderProtocol) β The report builder instance containing the dataframe and configuration.- Returns:
A dictionary with keys:
data: The computed ACF/PACF results.chart: Metadata and image for the generated plot, including:title: Title of the chart.description: Description of the chart.alt_text: Alternative text for the image.image: Base64-encoded image of the plot.
- Return type:
dict
Workflow:
Retrieves the ACF/PACF configuration from the report builder.
Fetches the analyzer and plotter classes and their parameter classes from the registries.
Initializes analyzer and plotter parameter objects using the configuration.
Instantiates the analyzer with the DataFrame and parameters, then computes the ACF/PACF data.
Instantiates the plotter with the computed data and plot parameters, then generates the plot.
Converts the plot image to a base64 string for embedding in the report.
Returns a dictionary containing both the computed data and chart metadata.
Example Usage:
section = build_acf_pacf_section(report_builder)
data = section["data"]
chart = section["chart"]
DependenciesΒΆ
os: For file path operations.register_section,ANALYZERS_REGISTRY,PLOTTERS_REGISTRY: For section registration and dynamic class retrieval.ReportBuilderProtocol: Protocol for the report builder object.
RegistriesΒΆ
ANALYZERS_REGISTRY["acf_pacf"]: Provides the analyzer class and its parameter class for ACF/PACF.PLOTTERS_REGISTRY["acf_pacf"]: Provides the plotter class and its parameter class for ACF/PACF.
Section RegistrationΒΆ
The function is registered as a report section under the name "acf_pacf" using the @register_section decorator.
@register_section("acf_pacf")
def build_acf_pacf_section(report_builder: ReportBuilderProtocol) -> Dict[str, Any]:
...