Migrate Amazon Connect TEI study to the Mercury Notebook Pattern

studies/202602_AmazonConnect -> studies/202602_TEI_Amazon_Connect,
rebuilt as pattern Variant 4 (TEI composite reproduction):

- teicalc/ self-contained engine (stdlib-only): Forrester's tables as
  the never-edited verbatim anchor, NPV/ROI/payback + risk adjustment
  transplanted from core/calculations, ClientDrivers overlay (contacts/
  agents/fixed driver map, growth re-base, identity at composite scale),
  scenario stress with core-identical semantics
- one deliverable notebook (business_case.ipynb): widget-pair sidebar
  drivers, published-vs-overlay KPI columns, cash-flow/waterfall/scenario
  charts, verification gate, backstage JSON data appendix
- gate + tests reproduce the published totals within PDF rounding:
  NPV $78.7M / ROI 342% / payback <6 months (engine $78,713,492 /
  342.48% / 0.7 months); 27 study tests, headless nbconvert green,
  stage simulation leak-free, exports carry the appendix
- old Athena workflow (00_provision..04_export, config.py, seed_data.py)
  deleted; git history preserves it; root test fixture repointed to
  teicalc.anchor
- docs: study README rewritten; root README points new studies at
  template/MercuryNotebook; pattern doc stale ctm-token-calculator paths
  now cite studies/202607_CTM_GenesysCX; Variant 4 cites this study as
  its realized reference

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-09 14:29:46 -04:00
parent c3260ae7b8
commit a420af230b
33 changed files with 8235 additions and 6923 deletions

View File

@@ -12,7 +12,7 @@ Palladium is a Jupyter notebook + Streamlit toolkit for building Total Economic
┌──────────────────────────────────────────────────────────────────┐
│ Palladium │
│ │
│ studies/202602_AmazonConnect/ ← one folder per TEI study
│ studies/202512_GenesysCX/ ← legacy study (this path)
│ studies/YYYYMM_<Vendor>/ │
│ ├─ notebooks/ ─┐ │
│ ├─ seed_data.py │ │
@@ -78,7 +78,7 @@ From any notebook, setup is one import:
```python
from core.bootstrap import init
pal = init(study="202602_AmazonConnect") # loads .env, connects, imports study
pal = init(study="202512_GenesysCX") # loads .env, connects, imports study
pal.client.list_reports()
pal.seed_data.BENEFITS
```
@@ -113,23 +113,26 @@ python -m palladium test
### Run a study end-to-end
Each study lives in `studies/<slug>/`. The reference study is the
February 2026 Forrester *Total Economic Impact™ Of Amazon Connect*:
Each new study is self-contained under the
[Mercury Notebook Deliverable Pattern](docs/Mercury_Notebook_Pattern_V1-00.md).
The reference TEI study is the February 2026 Forrester *Total Economic
Impact™ Of Amazon Connect* (pattern Variant 4 — composite reproduction):
```bash
make lab # then browse to studies/202602_AmazonConnect/notebooks/
cd studies/202602_TEI_Amazon_Connect
python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
mercury --working-dir notebooks/ # serve the deliverable (the stage)
python scripts/export_report.py # export .html/.md report sources
```
| Notebook | Purpose |
|----------|---------|
| `00_provision.ipynb` | **Run first** — creates the report template + fields, lets you select the CRM client and the Proposal/Engagement to attach to (pulling the client's profile to avoid re-entry), creates the tool, seeds the published values, calculates, and verifies the totals |
| `01_benefits.ipynb` | Quantify and risk-adjust benefit categories |
| `02_costs.ipynb` | Document implementation and ongoing costs |
| `03_business_case.ipynb` | Financial summary, scenario analysis, visualizations |
| `04_export.ipynb` | Generate report-ready JSON for the html2docx pipeline |
Its notebook reproduces the published totals within the PDF's rounding —
**NPV $78.7M • ROI 342% • Payback <6 months** — and the verification gate
asserts it on every headless run. See the study's README for details.
The Amazon Connect notebooks reproduce the published study totals within
rounding: **NPV $78.7M • ROI 342% • Payback <6 months**.
The remaining legacy study, `studies/202512_GenesysCX/`, still uses the
shared `core/` workflow (`make lab`, provision → push → calculate); it
migrates to the pattern next, after which `core/`'s notebook helpers and
`app/` retire.
### Streamlit application (study-agnostic)
@@ -176,20 +179,17 @@ the published Forrester totals.
## Adding a new study
Copy the template, not an existing study:
```bash
cp -r studies/202602_AmazonConnect studies/202612_GenesysCloud
cd studies/202612_GenesysCloud
cp -r template/MercuryNotebook studies/YYYYMM_TEI_Vendor_Product
```
1. **`README.md`** — update the title, source citation, key numbers.
2. **`seed_data.py`** — replace `BENEFITS` and `COSTS` with the new study's rows.
3. **`config.py`** — set `STUDY_SLUG`, leave `TOOL_PUBLIC_ID` blank until provisioned.
4. **`docs/`** — drop the source PDF here.
5. Open the notebooks; the imports (`core.calculations`, `core.notebook_helpers`,
`core.tei_client`) are study-agnostic. Update the markdown narrative.
The shared `core/` package and the `app/` Streamlit UI need no changes —
they introspect the TEI Report template via the API.
Then follow `template/MercuryNotebook/README.md`: rename `studylib/` to
your study package (underscores only — dashes break Python imports),
replace the toy model, re-pin the tests, rework the notebook.
`studies/202602_TEI_Amazon_Connect/` is the worked TEI example;
`studies/202607_CTM_GenesysCX/` is the full multi-notebook reference.
---
@@ -269,24 +269,22 @@ palladium/
│ ├── main.py # entry point
│ ├── views/ # benefits, costs, summary, versions (NOT `pages/` — avoids Streamlit auto-multipage)
│ └── components/ # tables, charts
├── studies/ # One folder per TEI engagement
── 202512_GenesysCX/ # CX Cloud (Genesys + Salesforce) TEI
├── template/
── MercuryNotebook/ # copy-me pattern scaffold (runnable)
├── studies/ # One folder per engagement
│ ├── 202512_GenesysCX/ # CX Cloud TEI — legacy shared-core layout
│ │ ├── README.md # NPV $10.8M · ROI 266% + AI-token line
│ │ ├── config.py / seed_data.py # study-scoped PALLADIUM_GENESYSCX_* keys
│ │ └── notebooks/ # 00_provision, 01_business_case
── 202602_AmazonConnect/
├── README.md
├── config.py # TOOL_PUBLIC_ID, REPORT_PUBLIC_ID
├── seed_data.py # 5 benefits + 3 costs from the PDF
├── notebooks/
│ ├── 00_provision.ipynb # creates template+tool in Athena, seeds & verifies
── 01_benefits.ipynb
── 02_costs.ipynb
├── 03_business_case.ipynb
│ │ └── 04_export.ipynb
│ ├── exports/ # generated; .gitignored
│ └── docs/
│ └── 202602_TEI Report Amazon Connect.pdf
── 202602_TEI_Amazon_Connect/ # Amazon Connect TEI — pattern Variant 4
├── README.md # NPV $78.7M · ROI 342%, reproduced + gated
├── teicalc/ # self-contained engine (anchor/model/overlay)
├── notebooks/business_case.ipynb
├── tests/ · scripts/ · config.toml · pyproject.toml
│ │ ├── exports/ # generated; .gitignored
│ │ ── docs/
── 202602_TEI Report Amazon Connect.pdf
└── 202607_CTM_GenesysCX/ # CTM × Genesys study — pattern reference impl
├── tests/ # 50 tests for core/
│ ├── test_client.py
│ ├── test_calculations.py