IPAA QoL Pipeline
Reusable, cohort-agnostic pipeline for processing IPAA Quality-of-Life survey data → AMA-styled tables + figures.
SDH Research Toolkit/IPAA QoL Pipeline/) — what it does, how to consume it, and the reference papers it's anchored against.Reusable, cohort-agnostic pipeline for processing IPAA Quality-of-Life (QoL) survey data and producing AMA-styled tables + figures for manuscript submission.
Author: Stefan D. Holubar Lab, Cleveland Clinic Status: in development (Phase 3 of /trilogy tps_qol, 2026-04-27) License: internal use only (not yet open-sourced)
---
What it does
Takes raw QoL survey xlsx exports (e.g., from Cleveland Clinic ileal pouch registry) → produces:
- Within-cohort tables (Before vs After redo, longitudinal pairs)
- Cross-sectional comparison tables (Cohort A vs Cohort B post-redo)
- CONSORT-style flow diagrams
- Waterfall plots of CGQLI changes (matched pairs)
- AMA three-line styled .docx tables for direct manuscript insertion
All output is config-driven, so the same code base serves any IPAA QoL study using the Cleveland Clinic Pouch Survey instrument.
Reference instruments supported
- Cleveland Clinic Pouch Survey (default; CGQLI = (QoL + QoH + QoE) / 30, range 0–1)
To support a different instrument, copy qol_pipeline/config.py defaults and override the InstrumentConfig fields.
Reference papers (output schema anchors)
| Paper | Role |
|---|---|
| Holubar et al. 2025 (in preparation) | Primary anchor for within-cohort Before vs After tables |
| Maspero, Lavryk, Holubar et al. BJS 2023 (PMID 37535972) | Primary anchor for cross-sectional PSM-matched cohort comparison |
| Lavryk, Stocchi, Holubar et al. J Gastrointest Surg 2019 (PMID 30097964) | Methodological precedent for trajectory + multivariate factor analyses |
Folder structure
IPAA QoL Pipeline/
├── README.md
├── .gitignore
├── Scripts/
│ └── qol_pipeline/ # main package
│ ├── __init__.py
│ ├── config.py # InstrumentConfig dataclass
│ ├── load_qol.py # xlsx → tidy DataFrame
│ ├── classify.py # fu_period → before/after/context
│ ├── derive.py # CGQLI + composites
│ ├── stats.py # Wilcoxon, Chi-sq, paired-t, McNemar
│ ├── tables.py # within_cohort + cross_sectional builders
│ ├── figures.py # CONSORT + waterfall plots
│ └── docx_writer.py # AMA-styled docx output
├── templates/
│ ├── T1_pouch_survey_items.docx # static instrument-reference table
│ └── ama_table_style.json # 12/6/12 border spec
├── validation/
│ ├── holubar_2025_anchors.json # ground-truth from published paper
│ └── test_ali_reproduces_published.py
├── examples/
│ └── ali_qol_demo.py # worked example using Ali QoL data
└── z.txt
Usage (consumer perspective)
From a TPS-style consumer project:
import sys
from pathlib import Path
SANDBOX = Path("/Volumes/T1 Claude/000 Claude Sandbox")
sys.path.insert(0, str(SANDBOX / "IPAA QoL Pipeline" / "Scripts"))
from qol_pipeline import load_qol, classify, derive, tables, figures, docx_writer
from qol_pipeline.config import InstrumentConfig, CLEVELAND_POUCH_SURVEY
# 1) Load
df = load_qol.load_qol(
xlsx_path="path/to/cohort_qol.xlsx",
instrument_config=CLEVELAND_POUCH_SURVEY,
cohort_name="My Cohort",
)
# 2) Classify before/after
df = classify.add_before_after(df, CLEVELAND_POUCH_SURVEY)
# 3) Derive CGQLI
df = derive.add_cgqli(df, CLEVELAND_POUCH_SURVEY)
# 4) Build tables
within = tables.within_cohort_table(df, cohort_name="My Cohort")
cross = tables.cross_sectional_table(df_a, df_b, name_a="Group A", name_b="Group B")
# 5) Render docx
docx_writer.write_docx(tables=[within, cross], out_path="QoL Tables.docx")
Adding a new IPAA QoL study (future-proofing)
- Drop the QoL xlsx into your study's project folder
- Inspect schema vs Ali's xlsx (likely same Cleveland registry export — but verify column names)
- If columns differ, add a new
ColumnMappingtoqol_pipeline/config.pyor pass an override - Write a thin driver script analogous to
A Fellows/Shah/TPS/QoL/Scripts/run_tps_qol.py - Run; outputs land in your study's
Data/and the AMA-styled tables in<Study> QoL Tables.docx
Validation
The pipeline includes a regression test (validation/test_ali_reproduces_published.py) that runs against Ali's QoL data and asserts the output matches Holubar 2025 anchor rows within tolerance. Run this whenever you change classify.py, derive.py, or stats.py.
Status (as of 2026-04-27)
- 🚧 Phase 3 in progress (
/trilogy tps_qol) - ⏳ TPS QoL data pending from Jie Dai
- ⏳ First consumer = TPS manuscript at
A Fellows/Shah/TPS/QoL/
For questions, additions, or onboarding help — email Stefan directly:
webmaster@holubarlab.org