Skip to content

render_run_summary_markdown

Public callable

Render a run summary dictionary into Markdown for handover notes.

Parameters:

Name Type Description Default
summary dict

Output from :func:build_run_summary.

required

Returns:

Type Description
str

Markdown text containing key run outcomes and diagnostics.

Source code in src/fabricops_kit/run_summary.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def render_run_summary_markdown(summary: dict) -> str:
    """Render a run summary dictionary into Markdown for handover notes.

    Parameters
    ----------
    summary : dict
        Output from :func:`build_run_summary`.

    Returns
    -------
    str
        Markdown text containing key run outcomes and diagnostics.
    """
    s = summary.get("sections", {})
    lines = [f"# Run Summary — {summary.get('dataset_name', 'unknown')}", f"- Run ID: `{summary.get('run_id', 'unknown')}`", f"- Environment: `{summary.get('environment', 'unknown')}`", f"- Overall status: **{summary.get('overall_status', 'unknown')}**", "", "## Run Context", f"- Source table: `{summary.get('source_table', 'unknown')}`", f"- Target table: `{summary.get('target_table', 'unknown')}`", f"- Started at (UTC): `{summary.get('started_at_utc', 'unknown')}`", "", "## Dataset Purpose", f"{s.get('purpose') or 'Not provided.'}", "", "## Section Status", f"- Schema drift: **{_status_of(s.get('schema_drift'))}**", f"- Incremental safety: **{_status_of(s.get('incremental_safety'))}**", f"- Quality: **{_status_of(s.get('quality'))}**", f"- Contracts: **{_status_of(s.get('contracts'))}**"]
    lines.extend(["", "## Not Provided Sections"])
    lines.extend([f"- {n}" for n in summary.get("not_provided_sections", [])] or ["- None"])
    src_count = (s.get("source_profile") or {}).get("row_count")
    out_count = (s.get("output_profile") or {}).get("row_count")
    lines.extend(["", f"- Source row count: `{src_count}`", f"- Output row count: `{out_count}`", "", "## Action Items"])
    lines.extend([f"- {item}" for item in summary.get("action_items", [])] or ["- None"])
    lines.extend(["", "## Notes"])
    lines.extend([f"- {n}" for n in (s.get("notes") or [])] or ["- None"])
    return "\n".join(lines)