OpenIslet

scripts/verify_iip0043_wholegraft_gate0v_and_calibration.py

IIP-0043 / DEC-122 (CAND-034 / EXP-031 — Bucket 1 Closure, Stage S3-R2 Remediated)

script Release v0.8.0 gen-eb955f8266035aba 1008 KB · 76 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_iip0043_wholegraft_gate0v_and_calibration.py · SHA-256: 20706180ed1ed6a2…

                        "Whenever deff > 1.0 (clustered/correlated observations, including sub-ULP JSON numbers such as "
                        "1.00000000000000001 preserved via exact Decimal parsing), variance-adjusted effective-count "
                        "bounds with outward effective counts k_eff_lower = floor(k * n_eff / n) and "
                        "k_eff_upper = ceil(k * n_eff / n) at n_eff = floor(n / deff) preserve point ordering "
                        "(0 <= l_ratio <= point <= u_ratio whenever the empirical point is defined) strictly as a "
                        "NON-AUTHORIZING DIAGNOSTIC DISPLAY (exact_directional_confidence_certified = false), NEVER "
                        "advertise nominal 95% directional coverage, and route Gate 0V-Kill release adjudication to "
                        "HOLD_CLUSTERED_DEFF_GT_1_REQUIRES_CLUSTER_LEVEL_INFERENCE (release_authorizing = false). "
                        "For paired 24-h and 72-h vehicle-normalized survival ratios R = p_treated / s_veh over their "
                        "true domain [0, +infinity), neither u_ratio (ceil(u_treated / s_veh_lower)) nor l_ratio "
                        "(floor(l_treated / s_veh_upper)) is clamped to 1.0, with explicit zero-denominator boundary "
                        "conventions: 0/0 reports undefined point estimate None and bounds_ordered_l_le_point_le_u = "
                        "None (while bounds_ordered_l_le_u = true and u_ratio = +Infinity), whereas k > 0 / 0 reports "
                        "point estimate +Infinity and u_ratio = +Infinity (bounds_ordered_l_le_point_le_u = true). "
                        "At deff == 1.0, u_ratio and l_ratio are separate directional one-sided confidence statements "
                        "at >= 1 - (alpha_treated + alpha_veh) = 0.950 each using the same per-component tail budgets, "
                        "NOT a simultaneous two-sided interval at that same unsplit alpha (by intersection-union, "
                        "min(eta_healthy_L, eta_fragile_L) uses single alpha_eta = 0.005); NOT familywise across all "
                        "5 lineages x 5 regimes simultaneously. Exact Clopper-Pearson coverage additionally assumes "
                        "representative independent binary observations sharing a common event probability p within "
                        "each component (independent sampling with unequal per-unit event probabilities falls outside "
                        "the standard common-probability binomial model); neither single-cell unit-count declaration "
                        "nor multi-well partition arithmetic proves equal unit probabilities or physical independence "
                        "on its own. Gate 0V-Kill evaluates acute 24-h/72-h stressed AP1903 viability/erasure separately "
                        "from long-horizon pan-lineage clonogenic eradication (which is owned by Blueprint Gate 5 / "
                        "legacy MCB clonogenic trials in wetlab_contract.py and ISLET-1-BLUEPRINT.md §1.2/§4.5). "
                        "All PASS statuses remain conditional on modeled assumptions (including the 15-panel "
                        "screening/control 97.6508% scope and NW-08 15.0 mmHg modeled oxygen floor) and pending physical qualification."
                    ),
                },
                "alpha_obs_and_cal_2way": "0.005",
                "estimand1_min_n_eff_at_eta_0p80": kill_eta_0p80,
                "estimand1_min_n_eff_at_24_of_24_calibrant": kill_eta_24,
                "estimand2_indirect_min_infected_at_risk_at_eta_0p80_alpha_0p015": kill_cond_3log_eta_0p80_indirect,
                "estimand2_direct_min_infected_at_risk_at_eta_0p80_alpha_0p020": kill_cond_3log_eta_0p80_direct,
                "estimand2_reference_min_infected_at_risk_at_eta_0p80_alpha_0p005": kill_cond_3log_eta_0p80_legacy_0p005,
                "ideal_100pct_kill_zero_survivors_passes": True,
                "lab_scale_by_stressed_vehicle_survival": kill_lab_scale_by_sveh,
            },
            "operational_tier_scope": {
                "BANK_QUALIFICATION": "Full 3-pathogen (CVB4-E2, CVB3, HCMV) + applicable receptor addenda x 5-lineage two-stage screen/ddPCR + dual-target latent genome arm + 5-regime raw-count Gate 0V-Kill -> emits PASS_WHOLEGRAFT_BANK_QUALIFICATION / PASS_COMPOSITE_BANK_QUALIFICATION (NEVER clinical lot release).",
                "LOT_RELEASE_SURROGATE": "Clinical lot release bridged strictly via independent external --trusted-qualification-store verifying prior PASS_COMPOSITE_BANK_QUALIFICATION AND mandatory original JSON-object archived BANK_QUALIFICATION payload (bound across bank record, archived payload, and current lot) + 1-pathogen sentinel (CVB4-E2) + dual-target latent ddPCR + 2-regime AP1903 + adjudication of ALL submitted supplemental adverse data -> emits PASS_WHOLEGRAFT_LOT_RELEASE_SURROGATE / PASS_COMPOSITE_CLINICAL_RELEASE.",
                "AUTOLOGOUS_D1B_PROCESS_QUAL": "Autologous D1b-Auto bridged strictly via independent external --trusted-qualification-store process-qualification record + per-patient adventitious-agent panel + Gate 0V-A + active edited-genotype non-inferiority + 2-regime AP1903 + adjudication of ALL submitted supplemental adverse data -> emits PASS_WHOLEGRAFT_AUTOLOGOUS_PROCESS_QUAL / PASS_COMPOSITE_AUTOLOGOUS_CLINICAL_RELEASE.",
            },
            "composite_weighted_average_loophole_proof": {
                "scenario": "1.30% persistently VP1+ pericytes (~433,875 infected cells) with 0% in beta/alpha/delta/iEC",
                "pericyte_graft_weight": round(float(w_pericyte), 6),
                "weighted_graft_average_pct": round(weighted_masking_pct, 6),
                "would_falsely_pass_weighted_only_0p05_cap": bool(weighted_masking_pct < 0.05),
                "blocked_by_conjunctive_per_lineage_rule": True,
            },
            "numerical_evidence_provenance_scope": {
                "supplied_assay_interval_and_replicate_summaries": (
                    "Gate 0V-Geno paired edited-vs-WT non-inferiority (edited_minus_wt_day14_log10_reduction_l95, "
                    "paired_noninferiority_replicates_n >= 6) and Gate 0V-B acute 72-h U95 / Day-14 L95 fields "
                    "consume caller-supplied assay summaries rather than recomputing intervals from raw replicate titers."
                ),
                "raw_count_recomputed_decimal_clopper_pearson_bounds": (
                    "Gate 0V-B Day-28 persistence U_lin, negative-control U95 (<= 0.15% on n >= 20,000), dual spike "
                    "calibrants (eta >= 0.80), dual-target latent ddPCR bounds, powered CD46/CD55 persistence bounds, "
                    "and all Gate 0V-Kill 24-h/72-h/Estimand-1/Estimand-2 erasure bounds are recomputed from raw integer counts."
                ),
            },
            "adversarial_contract_tests": adversarial,
        },
        "part_b_nw08_ccby4_calibration_and_layer4_margins": nw08,
        "part_c_protected_invariance_and_ceg_delta_diff": ceg_and_prot,
        "part_d_oq016_odds_and_tail_risk_reduction": oq016,
        "overall_status": "PASS" if all_ok else "FAIL",
    }

    rendered_text = json.dumps(receipt, indent=2) + "\n"
    if args.check:
        if not args.out.is_file():
            print(f"FAIL: missing pinned receipt {args.out}", file=sys.stderr)
            return 1
        on_disk_doc = strict_json_load_file(args.out, preserve_boundary_decimals=False)
        norm_disk = _normalize_receipt_for_portable_check(on_disk_doc)
        norm_curr = _normalize_receipt_for_portable_check(receipt)
        if norm_disk != norm_curr:
            print(f"FAIL: deterministic portable replay mismatch against {args.out.name}", file=sys.stderr)
            return 1
        norm_sha = hashlib.sha256(
            json.dumps(norm_curr, sort_keys=True, ensure_ascii=False, separators=(",", ":")).encode("utf-8")
        ).hexdigest()
        print(
            f"OK: {args.out.name} (portable_SHA-256={norm_sha}) matches deterministic replay | "
            f"mode={ceg_and_prot['bundle_mode']} | status={receipt['overall_status']} | "
            f"decimal_reg={decimal_regression['passed_checks']}/{decimal_regression['total_checks']} | "
            f"adversarial={adversarial['passed_cases']}/{adversarial['total_cases']} | "
            f"nw08_trig={nw08['nw08_trigger_and_floor_unit_tests']['passed_tests']}/{nw08['nw08_trigger_and_floor_unit_tests']['total_tests']} | "
            f"live_dispatch={nw08['nw08_live_dispatch_solver_tests']['passed_tests']}/{nw08['nw08_live_dispatch_solver_tests']['total_tests']} | "
            f"protected={ceg_and_prot['protected_files_checked_total']} ok={ceg_and_prot['protected_files_zero_byte_invariance_ok']} | "
            f"r4_renderer_compat={r4_ok} | gy030_parity={gy030_parity_ok} | fvm3d={fvm_ok}"
        )
        return 0 if all_ok else 1
    args.out.parent.mkdir(parents=True, exist_ok=True)
    args.out.write_text(rendered_text, encoding="utf-8")
    print(
        f"Wrote {args.out.name} | mode={ceg_and_prot['bundle_mode']} | status={receipt['overall_status']} | "
        f"decimal_reg={decimal_regression['passed_checks']}/{decimal_regression['total_checks']} | "
        f"adversarial={adversarial['passed_cases']}/{adversarial['total_cases']} | "
        f"nw08_trig={nw08['nw08_trigger_and_floor_unit_tests']['passed_tests']}/{nw08['nw08_trigger_and_floor_unit_tests']['total_tests']} | "
        f"live_dispatch={nw08['nw08_live_dispatch_solver_tests']['passed_tests']}/{nw08['nw08_live_dispatch_solver_tests']['total_tests']} | "
        f"protected={ceg_and_prot['protected_files_checked_total']} ok={ceg_and_prot['protected_files_zero_byte_invariance_ok']} | "
        f"r4_renderer_compat={r4_ok} | gy030_parity={gy030_parity_ok} | fvm3d={fvm_ok}"
    )
    return 0 if all_ok else 1


if __name__ == "__main__":
    raise SystemExit(main())