OpenIslet

scripts/verify_iip0041_clinical_h1_cd64t_siglec.py

EXP-028 (CAND-031 / Target IIP-0041 — Bucket 2A) Remediated Verification Suite

script Release v0.8.0 gen-eb955f8266035aba 984 KB · 69 sections

Use this file in any AI chat (paste-only or attachment-capable):

Download as text (.txt) Download section (.txt)

Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0041_clinical_h1_cd64t_siglec.py · SHA-256: f004cf6d8259b8b4…

        },
        {
            "cohort_id": "C1b_Reichman2025_FullDose_OriginalGlycemicEndpoint",
            "label": "Reichman et al. 2025 (NEJM; PMID:40544428) full-dose zimislecel Parts B/C original NEJM glycemic target (12/12; note Figure 3 has 11/12 Day-365 CGM records, 2/12 had prohibited peri-infusion glucocorticoids, and original NEJM endpoint differs from common C2b)",
            "k": 12, "n": 12, "includes_reichman": True, "setting": "ALLOGENEIC_ESC",
            "primary_verified": True, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": True,
            "analysis_role": "SINGLE_STUDY_ORIGINAL_PRIMARY_ENDPOINT_NOT_COMMON_C2B",
            "immunosuppression_status": "CHRONIC_SYSTEMIC_IS_WITH_11_OF_12_D365_CGM_AND_2_PROHIBITED_GLUCOCORTICOIDS",
        },
        {
            "cohort_id": "C1c_Reichman2025_Analyzed12Mo_Engraftment",
            "label": "Reichman et al. 2025 (NEJM; PMID:40544428) Parts A+B+C >=12-month follow-up analyzed population C-peptide+ engraftment (14/14 under IS: 2 Part A half-dose + 12 Parts B/C full-dose; excludes any dosed participants with <12 months follow-up)",
            "k": 14, "n": 14, "includes_reichman": True, "setting": "ALLOGENEIC_ESC",
            "primary_verified": True, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "SINGLE_STUDY_ANALYZED_GE12MO_FOLLOWUP_ENGRAFTMENT_OBSERVATION",
            "immunosuppression_status": "CHRONIC_SYSTEMIC_IS",
        },
        {
            "cohort_id": "C1d_NonReichman_PrimaryVerified_Wang2024_Only",
            "label": "Non-Reichman single-recipient observation: Wang et al. 2024 (Cell; PMID:39326417, 1/1 autologous CiPSC in abdominal anterior rectus sheath on continued 3-drug prior liver-tx IS + peri-infusion induction; distinct product/site/IS from allogeneic Core A/B/X)",
            "k": 1, "n": 1, "includes_reichman": False, "setting": "AUTOLOGOUS_CIPSC",
            "primary_verified": True, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "SINGLE_RECIPIENT_AUTOLOGOUS_OBSERVATION_NON_EXCHANGEABLE_WITH_ALLO",
            "immunosuppression_status": "CONTINUED_3_DRUG_PRIOR_LIVER_TX_IS_PLUS_PERI_INFUSION_INDUCTION",
        },
        {
            "cohort_id": "C2a_DescriptiveSensitivity_MixedT1D_InsulinFree_11of13",
            "label": "DESCRIPTIVE SENSITIVITY ONLY (conditional on assumed common-endpoint count 11/13; mixes incompatible Reichman 10/12 allogeneic hESC intraportal + Wang 1/1 autologous CiPSC rectus-sheath 3-drug-IS; non-exchangeable, non-promotable)",
            "k": 11, "n": 13, "includes_reichman": True, "setting": "MIXED_ALLO_AND_AUTO_INCOMPATIBLE",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "MIXED_CHRONIC_SYSTEMIC_IS_NON_EXCHANGEABLE",
        },
        {
            "cohort_id": "C2b_DescriptiveSensitivity_MixedT1D_AssumedCommonC2b_13of13",
            "label": "DESCRIPTIVE SENSITIVITY ONLY (conditional on assumed common-C2b count 13/13; NOT primary-verified common C2b: Reichman Fig. 3 has 11/12 D365 CGM & 2/12 prohibited glucocorticoids; Wang is autologous rectus-sheath on 3-drug liver-tx IS; non-exchangeable, non-promotable)",
            "k": 13, "n": 13, "includes_reichman": True, "setting": "MIXED_ALLO_AND_AUTO_INCOMPATIBLE",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "MIXED_CHRONIC_SYSTEMIC_IS_NON_EXCHANGEABLE",
        },
        {
            "cohort_id": "C3a_DescriptiveSensitivity_MixedT1D_T2D_InsulinFree_12of14",
            "label": "DESCRIPTIVE SENSITIVITY ONLY (conditional on assumed common count 12/14 adding Wu et al. Cell Discov 2024 T2D PMID:38684699 1/1 to mixed T1D 11/13; mixes T1D + T2D + allo + auto; non-exchangeable)",
            "k": 12, "n": 14, "includes_reichman": True, "setting": "MIXED_T1D_T2D_ALLO_AUTO_INCOMPATIBLE",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "MIXED_CHRONIC_SYSTEMIC_IS_ALL_THREE_COHORTS",
        },
        {
            "cohort_id": "C4a_CAS_Secondary_Sensitivity_InsulinFree",
            "label": "DESCRIPTIVE SECONDARY SENSITIVITY ONLY adding Shi et al. 2026 (Lancet Diabetes Endocrinol; PMID:41765034) per 2026-02-26 CAS account / CEG M0144 (1/3 insulin-free; assumed 11+1 / 13+3)",
            "k": 12, "n": 16, "includes_reichman": True, "setting": "MIXED_ALLO_AND_AUTO_INCOMPATIBLE",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "CHRONIC_IS_AND_AUTOLOGOUS_LOSS_UPON_IS_WITHDRAWAL",
        },
        {
            "cohort_id": "C4b_CAS_Secondary_Sensitivity_CpeptideUnderIS",
            "label": "DESCRIPTIVE SECONDARY SENSITIVITY ONLY adding Shi et al. 2026 assumed C-peptide restoration under IS (13+3 / 13+3; autologous recipient lost C-peptide post-IS withdrawal)",
            "k": 16, "n": 16, "includes_reichman": True, "setting": "MIXED_ALLO_AND_AUTO_INCOMPATIBLE",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "CHRONIC_IS_REQUIRED",
        },
        {
            "cohort_id": "C5_Unauthenticated_SecondaryClaim_UpperBound_InsulinFree",
            "label": "DESCRIPTIVE UNAUTHENTICATED UPPER-BOUND SENSITIVITY assuming Shi 2026 = 3/3 insulin-free (14/16) — NOT verified from paywalled Lancet Letter PDF (0 abstract chars in PubMed)",
            "k": 14, "n": 16, "includes_reichman": True, "setting": "UNVERIFIED_SECONDARY_CLAIM",
            "primary_verified": False, "common_c2b_adjudicated": False, "exchangeable_likelihood_valid": False,
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_ONLY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS",
            "immunosuppression_status": "UNVERIFIED_SECONDARY_CLAIM",
        },
    ]

    results = []
    for c in cohorts:
        k, n = c["k"], c["n"]
        cp_lo, cp_hi = clopper_pearson_ci(k, n)
        post: dict[str, Any] = {}
        for pname, (a0, b0) in non_informative_priors.items():
            post[pname] = _beta_posterior_summary(a0, b0, k, n, overlap_status="NON_OVERLAPPING_PRIOR_LIKELIHOOD")
        for pname, (a0, b0) in anchored_priors.items():
            ov = (
                "OVERLAPPING_PRIOR_DIAGNOSTIC_ONLY_DOUBLES_REICHMAN"
                if c["includes_reichman"]
                else "NON_OVERLAPPING_PRIOR_LIKELIHOOD"
            )
            post[pname] = _beta_posterior_summary(a0, b0, k, n, overlap_status=ov)
        results.append({
            **c,
            "observed_rate_pct": round(100.0 * k / n, 2),
            "clopper_pearson_95_ci_pct": [round(100.0 * cp_lo, 2), round(100.0 * cp_hi, 2)],
            "clopper_pearson_95_ci_scope": "NOMINAL_IID_UNADJUSTED_RECIPIENT_COUNTS_ONLY_NOT_CLUSTER_ADJUSTED",
            "bayesian_posteriors": post,
        })

    # Explicit descriptive sensitivity decision table for all 4 possible Shi 2026 (n=3) assumed C2b outcomes:
    # Replaces retired contradictory ">=2/3 flips H1" rule (which lowered overlapping P(H1>=90%) 86.31% -> 67.73%).
    # Even under the hypothetical assumption of common C2b counts, all four Shi n=3 scenarios fail posterior
    # thresholds AND remain mixed-cohort descriptive sensitivities (non-promotable under the single-compatible-cohort rule).
    shi_decision_table = []
    for k_shi in (3, 2, 1, 0):
        k_pool = 13 + k_shi
        n_pool = 16
        k_nonr = 1 + k_shi  # Assumed descriptive sensitivity: Wang 2024 (1/1) + Shi 2026 (k_shi/3)
        n_nonr = 4
        cp_lo, cp_hi = clopper_pearson_ci(k_pool, n_pool)
        unif = _beta_posterior_summary(1.0, 1.0, k_pool, n_pool, overlap_status="NON_OVERLAPPING_PRIOR_LIKELIHOOD")
        jeff = _beta_posterior_summary(0.5, 0.5, k_pool, n_pool, overlap_status="NON_OVERLAPPING_PRIOR_LIKELIHOOD")
        nonr_anch = _beta_posterior_summary(8.8, 1.2, k_nonr, n_nonr, overlap_status="NON_OVERLAPPING_PRIOR_LIKELIHOOD")
        diag_ov = _beta_posterior_summary(8.8, 1.2, k_pool, n_pool, overlap_status="OVERLAPPING_PRIOR_DIAGNOSTIC_ONLY_DOUBLES_REICHMAN")
        passes_unif = unif["prob_ge_90_exact"] >= 0.90
        passes_nonr = nonr_anch["prob_ge_90_exact"] >= 0.85
        if passes_unif and passes_nonr:
            disp = "HOLD_H1_AT_88PCT_MIXED_COHORT_SENSITIVITY_ONLY"
        elif k_shi <= 1:
            disp = "HOLD_H1_AT_88PCT_AND_TRIGGER_DOWNWARD_REAUDIT"
        else:
            disp = "HOLD_H1_AT_88PCT_INSUFFICIENT_POSTERIOR_MASS"
        shi_decision_table.append({
            "analysis_role": "DESCRIPTIVE_SENSITIVITY_CONDITIONAL_ON_ASSUMED_COMMON_COUNTS_NON_PROMOTABLE_MIXED_COHORT",
            "shi_assumed_c2b_outcome": f"{k_shi}/3",
            "assumed_mixed_t1d_c2b_sensitivity": f"{k_pool}/{n_pool}",
            "descriptive_clopper_pearson_95_ci_pct": [round(100.0 * cp_lo, 2), round(100.0 * cp_hi, 2)],
            "descriptive_clopper_pearson_95_ci_scope": "NOMINAL_IID_UNADJUSTED_RECIPIENT_COUNTS_ONLY_NOT_CLUSTER_ADJUSTED",
            "uniform_Beta_1_1_posterior": unif,
            "jeffreys_Beta_0p5_0p5_posterior": jeff,
            "non_reichman_sensitivity_k_of_4": f"{k_nonr}/{n_nonr}",
            "non_overlapping_Beta_8p8_1p2_on_non_reichman_sensitivity": nonr_anch,
            "retired_double_counted_Beta_8p8_1p2_diagnostic": diag_ov,
            "passes_uniform_ge_90pct": passes_unif,
            "passes_non_overlapping_anchored_ge_85pct": passes_nonr,
            "gate_28a_disposition": disp,
        })

    # Programmatic exact verification of Uniform Beta(1,1) nominal integer lower-bound counts (21/21 & 36/37)
    # and the exact continuous fractional all-success Uniform transition n_eff = ln(0.10)/ln(0.90) - 1 ~= 20.854345
    p_u_20_20 = 1.0 - beta_cdf(0.90, 21.0, 1.0)
    p_u_21_21 = 1.0 - beta_cdf(0.90, 22.0, 1.0)
    p_u_35_36 = 1.0 - beta_cdf(0.90, 36.0, 2.0)
    p_u_36_37 = 1.0 - beta_cdf(0.90, 37.0, 2.0)
    continuous_all_success_n_eff_transition = (math.log(0.10) / math.log(0.90)) - 1.0
    if not (p_u_20_20 < 0.90 <= p_u_21_21):
        raise ValueError(f"Uniform minimum zero-failure check failed: 20/20={p_u_20_20}, 21/21={p_u_21_21}")
    if not (p_u_35_36 < 0.90 <= p_u_36_37):
        raise ValueError(f"Uniform minimum one-failure check failed: 35/36={p_u_35_36}, 36/37={p_u_36_37}")

    # Verify exact mathematical and governance sanity checks (optimize-safe!)
    wang_only = next(c for c in results if c["cohort_id"] == "C1d_NonReichman_PrimaryVerified_Wang2024_Only")
    if abs(wang_only["bayesian_posteriors"]["openislet_prior_Beta_8p8_1p2_n10"]["prob_ge_90_exact"] - 0.563803) >= 1e-4:
        raise ValueError("Wang 2024 non-overlapping Beta(8.8,1.2) posterior sanity check failed")
    c2b_row = next(c for c in results if c["cohort_id"] == "C2b_DescriptiveSensitivity_MixedT1D_AssumedCommonC2b_13of13")
    if c2b_row["primary_verified"] is not False or c2b_row["common_c2b_adjudicated"] is not False:
        raise ValueError("Mixed 13/13 C2b sensitivity MUST NOT be marked primary_verified=True or common_c2b_adjudicated=True")
    if not all(row["gate_28a_disposition"].startswith("HOLD_H1_AT_88PCT") for row in shi_decision_table):
        raise ValueError("Expected all four Shi 2026 scenarios to hold live H1 at 88%")

    return {
        "live_openislet_h1_held_today": 0.88,
        "conditional_h1_sensitivity_target": 0.90,
        "live_reanchor_decision": "HOLD_LOCKED_AT_0p88_SINGLE_COMPATIBLE_POST_RELEASE_COHORT_NOT_MET",
        "prior_vs_posterior_audit_note": (
            "Beta(8.8, 1.2) is the clinical post-release prior (mean 88.00%), NOT a posterior and NOT calibrated for "
            "CMC attempted-lot manufacturing yield. Because live ISLET-1-BLUEPRINT.md line 37 already cites Reichman 2025 "
            "to anchor H1 = 0.88, updating Beta(8.8, 1.2) with Reichman's 12 outcomes double-counts Reichman. All mixed "
            "13/13 and 11/13 intervals/posteriors are descriptive sensitivities conditional on assumed common-endpoint counts: "
            "under non-informative Uniform Beta(1,1), assumed 13/13 yields Beta(14,1) (mean 93.33%, P(H1>=90%)=77.12%; Jeffreys 90.53%) "
            "and assumed 11/13 yields Beta(12,3) (mean 80.00%, P(H1>=90%)=15.84%). Updating Beta(8.8, 1.2) strictly with non-Reichman "
            "Wang 2024 (1/1; incompatible autologous product/site/IS) gives descriptive Beta(9.8, 1.2) (mean 89.09%, P(H1>=90%)=56.38%). "
            "The retired 'flip iff >=2/3 Shi' rule is removed because 2/3 lowers P(H1>=90%) across every prior."
        ),
        "uniform_prior_minimum_threshold_verification": {
            "zero_failure_minimum_k_of_n": "21/21",
            "zero_failure_minimum_classification": "nominal_integer_lower_bound_unclustered_iid",
            "continuous_all_success_uniform_n_eff_transition": round(continuous_all_success_n_eff_transition, 6),
            "threshold_modeling_note": (
                "21/21 is the nominal integer lower bound under unclustered DEFF=1.0 i.i.d. assumptions; "
                "under the continuous fractional likelihood approximation Beta(1 + n_eff, 1), the exact "
                "all-success Uniform transition occurs at n_eff ~= 20.854345, and near the threshold "
                "exchangeability and ICC assumptions dominate over display rounding. All cluster-adjusted "
                "Beta-Binomial probabilities on fractional (k_eff, n_eff) are prespecified decision-model "
                "quantities conditional on assumed lot/bank variance-component ICCs (rho_lot, rho_bank) "
                "and cohort exchangeability rather than independently calibrated empirical probabilities."
            ),
            "prob_ge_90pct_at_20_of_20": round(100.0 * p_u_20_20, 4),
            "prob_ge_90pct_at_21_of_21": round(100.0 * p_u_21_21, 4),
            "one_failure_minimum_k_of_n": "36/37",
            "prob_ge_90pct_at_35_of_36": round(100.0 * p_u_35_36, 4),
            "prob_ge_90pct_at_36_of_37": round(100.0 * p_u_36_37, 4),
        },
        "per_study_endpoint_adjudication_ledger": per_study_endpoint_adjudication_ledger,
        "gate_28a_coherent_decision_contract": {
            "clinical_estimands_strictly_separated": {
                "blueprint_h1_clinical_post_release_estimand": (
                    "ISLET-1-BLUEPRINT.md:37 establishes the released-product post-release scope (conditioning in-body hurdles on passing "
                    "laboratory/GMP release checks) and the 88% illustrative class-level Hurdle-1 judgment. Gate 28-A (IIP-0041 / DEC-120) "
                    "operationalizes this post-release clinical estimand for future promotion adjudication as: "
                    "H1_Blueprint = P(durable >= 6-month adjudicated C2b glycemic target restoration under de novo chronic glucocorticoid-free "
                    "systemic IS | released full-dose GMP allogeneic SC-islet lot infused intraportally into an enrolled T1D recipient). "
                    "Held live at 0.88 (+0.00 pp). Reichman-anchored Beta(8.8, 1.2) applies ONLY to non-overlapping post-release clinical "
                    "cohorts on this same estimand. Changes in CMC lot-release or infusion-utilization rate alone can NEVER move Blueprint H1."
                ),
                "release_only_cmc_yield_metric": (
                    "P_release_CMC = N_released_lots / N_attempted_lots = "
                    "P(GMP lot passes pre-infusion release specifications | GMP manufacturing lot initiated). "
                    "Reported cleanly as a separate standalone operational CMC yield metric."
                ),
                "separate_cmc_attempted_lot_readiness_metric": (
                    "H1_CMC_ATTEMPTED_LOT_READINESS = P_release_CMC * P_infuse_given_released * H1_Blueprint, where "
                    "P_infuse_given_released = infused_primary_course_equivalents / released_lots_n carries explicit unit "
                    "infused primary-course equivalents per released lot (course-equivalent weighted rate, distinct from raw "
                    "physical-lot utilization — e.g., under a 2-lot pooled course both physical lots are infused [100% physical-lot "
                    "utilization] while course-equivalent p_infuse_given_released = 1.0 / 2 = 0.50). "
                    "Worked single-lot example: at P_release_CMC = 0.80, course-equivalent P_infuse_given_released = 0.50, and "
                    "H1_Blueprint = 0.88, the projected successful primary-course equivalents per attempted lot is 0.80 * 0.50 * 0.88 = 0.352 "
                    "(35.2% primary-course equivalents per attempted lot, NOT 70.4%; distinct from a physical-lot success probability "
                    "once a recipient's course spans multiple lots), while release-only P_release_CMC = 80.0% and authoritative measured weighted CMC readiness "
                    "(measured_weighted_cmc_readiness = lot_weighted_primary_successes / attempted_lots_n) are reported separately "
                    "from diagnostic unweighted-recipient-rate empirical_product_readiness "
                    "(DIAGNOSTIC_UNWEIGHTED_RECIPIENT_RATE_PRODUCT_ONLY) with matching conditioning and outcome "
                    "weights across every topology: released-but-uninfused lots (infusion = 0), "
                    "split lots (lot-level release weight 1, recipient-dose infusion weight infused_doses_n / planned_doses_n, explicit per-recipient "
                    "outcomes with zero positional inference), prespecified pooled multi-lot courses (complete reconciled membership, single agreed "