import sys
from pathlib import Path
import polars as pl
sys.path.insert(0, 'src')
from rtflite import LibreOfficeConverter
try:
converter = LibreOfficeConverter()
except Exception:
converter = None
print("WARNING: LibreOffice not found. PDF conversion will be skipped.")7 IE Summary
Objectives
This guide demonstrates Inclusion/Exclusion (IE) summary analysis showing Protocol Deviations.
7.1 Setup
from csrlite import load_plan, study_plan_to_ie_summary
from csrlite.ie.ie_summary import ie_ard, ie_df, ie_rtf7.2 IE Summary Analysis
The IE analysis focuses on: 1. Identifying screening failures from ADSL/ADIE. 2. Breaking down failures by category (Inclusion vs Exclusion). 3. Detailing specific criteria failures.
7.3 StudyPlan-Driven Workflow
study_plan = load_plan("studies/xyz123/yaml/plan_xyz123.yaml")
study_plan.get_plan_df().filter(pl.col("analysis") == "ie_summary")2026-02-03 15:26:50,917 - csrlite.common.plan - INFO - Successfully loaded dataset 'adsl' from 'studies/xyz123/yaml/../../../data/adsl.parquet'
2026-02-03 15:26:50,920 - csrlite.common.plan - INFO - Successfully loaded dataset 'adae' from 'studies/xyz123/yaml/../../../data/adae.parquet'
2026-02-03 15:26:50,921 - csrlite.common.plan - INFO - Successfully loaded dataset 'adie' from 'studies/xyz123/yaml/../../../data/adie.parquet'
2026-02-03 15:26:50,923 - csrlite.common.plan - INFO - Successfully loaded dataset 'adpd' from 'studies/xyz123/yaml/../../../data/adpd.parquet'
shape: (1, 5)
| analysis | population | observation | parameter | group |
|---|---|---|---|---|
| str | str | str | str | str |
| "ie_summary" | "all" | null | null | null |
output_files = study_plan_to_ie_summary(study_plan)studies/xyz123/rtf/ie_summary_all_total.rtf
7.3.1 ie_summary_scrfail
7.4 Complete Pipeline
adsl = pl.read_parquet("data/adsl.parquet")
adie = pl.read_parquet("data/adie.parquet")
ard = ie_ard(
adsl=adsl,
adie=adie,
group_col="TRT01A"
)
df = ie_df(ard)
ie_rtf(
df,
"studies/xyz123/rtf/ie_summary_manual.rtf",
title=[
"Summary of Protocol Deviations",
"(Inclusion/Exclusion)"
]
)studies/xyz123/rtf/ie_summary_manual.rtf