src.llm_interpreter.render.assembler

Report assembler for AMMM evidence-backed reports.

This module combines all components (inputs, analysis, LLM, rendering) to produce complete markdown reports with citations.

Author: AMMM Team Created: 2025-04-10 Last Modified: 2025-04-10

Module Contents

class src.llm_interpreter.render.assembler.ReportSection(title: str, content: str, level: int = 2)

Represents a section of the report.

to_markdown() str

Convert section to markdown.

class src.llm_interpreter.render.assembler.ReportAssembler(results_dir: pathlib.Path)

Assembles complete evidence-backed reports.

Brings together all components: - CSV data loading - Analysis and insights - Citations - Report structure

load_and_analyze()

Load CSV data and run analysis.

build_title_section() ReportSection

Build report title and metadata.

build_executive_summary() ReportSection

Build executive summary section.

build_data_quality_section() ReportSection

Build data quality diagnostics section.

build_model_fit_section() ReportSection

Build model fit diagnostics section.

build_media_performance_section() ReportSection

Build media performance insights section.

build_budget_optimization_section() ReportSection

Build budget optimization section.

assemble_report() str

Assemble complete report.

Returns:

Complete markdown report

save_report(output_path: pathlib.Path)

Assemble and save report to file.

Parameters:

output_path – Path to save markdown report

src.llm_interpreter.render.assembler.generate_report(results_dir: pathlib.Path, output_path: pathlib.Path) str

Generate complete evidence-backed report.

Parameters:
  • results_dir – Directory containing results (csv/ and png/ subdirs)

  • output_path – Path to save markdown report

Returns:

Report content as string

Example

>>> from pathlib import Path
>>> from src.llm_interpreter.render import generate_report
>>>
>>> report = generate_report(
...     results_dir=Path("results"),
...     output_path=Path("results/markdown/ammm_report.md")
... )
>>> print(f"Generated {len(report)} character report")