Files
palladium/assessments/CX_AI_Diagnostic/tests/test_export.py
Robert Helewka a967f73d09 feat: add master notebook library scaffolding and review tooling
Add CLAUDE.md defining the Palladium master notebook conventions and
Red Panda Approval criteria, plus a review-notebook slash command for
LLM-driven notebook review.

Expand .gitignore to block client/engagement documents and generated
exports, keeping masters client-clean while allowing text/image sources.

Normalize slider widget numeric values from floats to integers in
notebook JSON.
2026-07-31 16:16:07 +00:00

53 lines
1.9 KiB
Python

"""Export contracts — JSON round-trips, CSV shape pinned to the spec."""
from datetime import date
import pandas as pd
from diaglib import (
CSV_COLUMNS,
build_engagement,
load_engagement,
parse_participants,
scores_dataframe,
value_at_stake,
write_exports,
)
def _engagement(config, baseline, scores):
return build_engagement(
config=config, client_name="Acme Demo Co", facilitator="Robert Helewka",
workshop_date=date(2026, 7, 19),
participants=parse_participants(
"Jane Example | VP Customer Experience | cx; Sam Sample | Ops Director | ops"),
baseline=baseline, scores=scores,
computed_value=value_at_stake(config, baseline, scores))
def test_write_exports_and_reload(config, baseline, scores, tmp_path):
eng = _engagement(config, baseline, scores)
json_path, csv_path = write_exports(eng, config, tmp_path)
assert json_path.name == "acme_demo_co_2026-07-19.json"
assert csv_path.name == "acme_demo_co_2026-07-19.csv"
# JSON is the source-of-truth artifact — it must round-trip losslessly.
reloaded = load_engagement(json_path)
assert reloaded == eng
df = pd.read_csv(csv_path)
assert list(df.columns) == CSV_COLUMNS
assert len(df) == 12
def test_scores_dataframe_flags(config, baseline, scores):
df = scores_dataframe(_engagement(config, baseline, scores), config)
by_id = df.set_index("competency_id")
assert bool(by_id.loc["data_readiness", "is_foundational"])
assert bool(by_id.loc["data_readiness", "is_binding_constraint"])
assert bool(by_id.loc["process_discovery", "is_foundational"])
assert not bool(by_id.loc["process_discovery", "is_binding_constraint"])
assert not bool(by_id.loc["automation_ai_strategy", "is_foundational"])
assert (df["engagement_id"] == "acme_demo_co_2026-07-19").all()
assert (df["industry"] == "contact_center").all()