"ic50_l95_nm": 24.0, "ic50_u95_nm": 52.0, "selectivity_l95_fold": 78.0, "selectivity_u95_fold": 135.0, }, { "analyte_id": "HLA-DQ8 + native WT InsB:9-23", "peptide_sequence": "SHLVEALYLVCGERG", "peptide_reagent_lot_id": wt15_reagent_lot_id, "replicates_n": 3, "expression_batch_ids": list(spr_c2_batch_ids), "ic50_l95_nm": 20.0, "ic50_u95_nm": 46.0, "selectivity_l95_fold": 88.0, "selectivity_u95_fold": 150.0, }, ], "off_target_controls": [ { "analyte_id": "HLA-DQ2.5 + CLIP1", "replicates_n": 3, "expression_batch_ids": list(spr_c1_batch_ids), "selectivity_l95_fold": 92.0, "selectivity_u95_fold": 165.0, }, { "analyte_id": "HLA-DQ2.5 + Self_IGKV2_EAED", "replicates_n": 3, "expression_batch_ids": list(spr_c1_batch_ids), "selectivity_l95_fold": 80.0, "selectivity_u95_fold": 145.0, }, { "analyte_id": "HLA-DQ2.5 + cel_glutenin_L1", "replicates_n": 3, "expression_batch_ids": list(spr_c1_batch_ids), "selectivity_l95_fold": 72.0, "selectivity_u95_fold": 130.0, }, { "analyte_id": "HLA-DQ8-trans + Cpep_Nterm_EAED", "replicates_n": 3, "expression_batch_ids": list(spr_c1_batch_ids), "selectivity_l95_fold": 84.0, "selectivity_u95_fold": 150.0, }, { "analyte_id": "HLA-DQ8 + CLIP1", "replicates_n": 3, "expression_batch_ids": list(spr_c2_batch_ids), "selectivity_l95_fold": 90.0, "selectivity_u95_fold": 160.0, }, { "analyte_id": "HLA-DQ8 + DQ8-glia-gamma1a", "replicates_n": 3, "expression_batch_ids": list(spr_c2_batch_ids), "selectivity_l95_fold": 75.0, "selectivity_u95_fold": 130.0, }, { "analyte_id": "HLA-DQ8-trans + WT InsB:9-23", "peptide_sequence": "SHLVEALYLVCGERG", "peptide_reagent_lot_id": wt15_reagent_lot_id, "replicates_n": 3, "expression_batch_ids": list(spr_c2_batch_ids), "selectivity_l95_fold": 82.0, "selectivity_u95_fold": 145.0, }, ], "comp2_comparators_screened": [ { "comparator_id": cid, "screened": True, "replicates_n": 3, "expression_batch_ids": list(spr_c2_batch_ids) if cid == _SHIELD_COMP2_LEAD else [comparator_batch_map[cid]], "register_control_screens": { "native_wt_insb9_23_15aa": { "screened": True, "peptide_sequence": "SHLVEALYLVCGERG", "peptide_reagent_lot_id": wt15_reagent_lot_id, "expression_batch_ids": list(spr_c2_batch_ids) if cid == _SHIELD_COMP2_LEAD else [comparator_batch_map[cid]], "replicates_n": 3, "evidence_record_id": f"SPR-COMP-{cid}-WT15", }, "engineered_6dfx_p8e9e_12aa": { "screened": True, "peptide_sequence": "VEELYLVAGEEG", "peptide_reagent_lot_id": r6dfx_reagent_lot_id, "expression_batch_ids": list(spr_c2_batch_ids) if cid == _SHIELD_COMP2_LEAD else [comparator_batch_map[cid]], "replicates_n": 3, "evidence_record_id": f"SPR-COMP-{cid}-6DFX", }, }, } for cid in _SHIELD_MANDATORY_COMP2_COMPARATORS ], "register_qc_records": register_qc, "sec_mals_dls_monomer_coformulation": { "expression_batch_ids": list(sec_all_lead_batch_ids), "comp1_qf09_pi2_alone_monomer_qc_passed": True, "comp2_t006_alone_monomer_qc_passed": True, "cocktail_1to1_coformulation_qc_passed": True, "protenix_homodimer_flag_iptm_addressed": 0.6691, "comp1_monomer_pct": 98.2, "comp2_monomer_pct": 97.5, "cocktail_1to1_monomer_pct": 96.8, "dls_pdi": 0.08, "no_aggregates_or_precipitation": True, "qualified_coformulation_mixtures": qualified_mixtures, }, "tcell_blockade_and_apc_cytotoxicity_donors": donors, } if include_preregistered_roster: if roster_donor_ids is not None: r_ids = [str(x) for x in roster_donor_ids] else: r_n = max(n_donors, int(planned_t1d_donor_family_n) if planned_t1d_donor_family_n is not None else n_donors) r_ids = [f"T1D_DONOR_{i + 1:02d}" for i in range(r_n)] obs_out["preregistered_donor_family_roster"] = _shield_build_preregistered_roster( r_ids, roster_id=roster_id, preregistration_timestamp_utc=preregistration_timestamp_utc, predeclared_per_donor_unit_count_n=int(n_eff_per_donor), ) if planned_t1d_donor_family_n is not None: obs_out["planned_t1d_donor_family_n"] = int(planned_t1d_donor_family_n) if excluded_donor_records is not None: obs_out["excluded_donor_records"] = list(excluded_donor_records) return obs_out def evaluate_gate30_shield_spr(observation: dict[str, Any]) -> dict[str, Any]: """Executable typed fail-first Gate 30-SHIELD-SPR adjudicator synchronized 100% identically across verify_iip0044_foundry_v1_3_biologics.py and verify_iip0042_master_multilayer_portfolio_crosswalk.py. Pre-adjudication input integrity: Non-dict payloads or ANY non-finite (NaN/Inf) or overflowing (IEEE-754 binary64 abs(x) > 1e300 for float; exact abs(x) > 10**300 for int) numeric anywhere in the input tree raise ValueError BEFORE decision precedence (and strict JSON text decoding rejects raw decimal literals with |d| > 10^300). Unique 6-level fail-first decision precedence: FAIL > HOLD_INVALID_OR_MISSING_INPUT > HOLD_CYTOTOXICITY_U95_EXCEEDS_5PCT > HOLD_OBSERVED_NONZERO_CYTOTOXICITY > HOLD > PASS Requires all typed evidence blocks with construct-bound expression_batch_ids linkage (rejecting empty construct_ids batches; binding Comp1 assays to IsletSHIELD_QF09_pI2, Comp2 assays + register QC to IsletSHIELD_Comp2_T006, each comparator to its own construct, and cocktail assays to BOTH leads with >= 3 distinct Comp1 and >= 3 distinct Comp2 batches linked across assay evidence), all 4 mandatory on-target analytes (requiring peptide_sequence='SHLVEALYLVCGERG' and matching peptide_reagent_lot_id between the WT15 on-target analyte and register_qc_records.native_wt_insb9_23_15aa), all 7 off-target controls (4 Comp1 + 3 Comp2), all 6 Comp2 comparators, mandatory register QC (HIP11, 15-aa WT InsB:9-23, 12-aa 6DFX; optional physical 14-aa 1JK8 omitted OR null -> PASS, any non-null value validated strictly), quantitative SEC-MALS/DLS (>= 95.0% monomer, PDI <= 0.15, no_aggregates_or_precipitation=True reconciled with boolean QC flags), mandatory typed donor_sampling_and_independence_design + per-donor assay_run_id, mandatory typed T1D donor eligibility (t1d_diagnosis_confirmed=True, donor_clinical_cohort='T1D', non-empty unpadded t1d_prequalification_ref, rejecting contradictory non-T1D donor tokens even if flags are forged), qualifying donor hla_genotype allowlist, mandatory authorization-grade typed + contradiction-guarded gy018_independence_justification, exact GY-018 design_effect_deff == 1.0 (zero tolerance, preserved as exact Decimal through JSON decoding), suppression assay acceptance range [-1000.0, 100.0]% with overflow-immune non-authorizing Student-t diagnostic, mandatory cryptographically hash-pinned outcome-blind preregistered_donor_family_roster (100% reconciled on ALL raw submitted donor IDs BEFORE deduplication/quarantine filtering; unverified/unpinned/incomplete/unrostered rosters fail closed to HOLD_INVALID_OR_MISSING_INPUT for overall PASS and donor-based FAIL, while independent valid non-donor SPR failures remain fail-first FAIL tagged failure_domain='INDEPENDENT_NON_DONOR_SPR' and out-of-spec physicochemical SEC-MALS/DLS measurements hold as unqualified material inputs with failure_domain=None), cluster-conservative distribution-free exact one-sided Clopper-Pearson suppression inference across donor, expression-batch, assay-run, and joint (batch U run) connected components (confirmatory PASS requires >= 9 disjoint batch/run clusters and L95_CP >= 70.0% + anti-enhancement min >= 0.0% + mean >= 70.0%; suppression FAIL requires L95_CP(k_lt_40) > 60.0% across >= 6 disjoint batch/run clusters; Student-t is strictly non-authorizing; only one-sided lower bounds drive adjudication while U95 is descriptive only), 100%-measured full-roster cytotoxicity requirement for confirmatory PASS (len(excluded_donor_records) == 0 and valid_donor_records_n == N_roster), and distribution-free fixed pre-exclusion roster Bonferroni-calibrated FWER <= 0.05 cytotoxicity FAIL rule under H0_all: max_{i=1..N_roster} p_i <= 5.0% using alpha_donor = 0.05 / N_roster (scoped strictly to the fixed-roster donor cytotoxicity family, conditional on external outcome-blind custody & pre-readout receipt; cohort Student-t lower bound is strictly non-authorizing). Two-pass order-independent canonical key uniqueness runs BEFORE biological threshold adjudication across ALL evidence lists (expression_batches, on_target_analytes, off_target_controls, comp2_comparators_screened, donors), and derived_summary emits machine-checked trackb_shield_trigger_state distinguishing SHIELD-1-only Comp2 failure vs overall SHIELD failure while excluding all non-FAIL, held, invalid, and partial-FAIL states. """ if not isinstance(observation, dict): raise ValueError("Gate 30-SHIELD-SPR observation must be a JSON object") _shield_reject_nonfinite_tree(observation, "observation") reasons: list[str] = [] worst_state = "PASS" spr_bio_fail = False comp1_spr_bio_fail = False comp2_spr_bio_fail = False comp1_on_target_passed_analytes: set[str] = set() comp1_off_target_passed_controls: set[str] = set() donor_based_bio_fail = False derived_summary: dict[str, Any] = {} def _escalate(state: str, reason: str) -> None: nonlocal worst_state reasons.append(f"[{state}] {reason}") if _SHIELD_SPR_PRECEDENCE[state] > _SHIELD_SPR_PRECEDENCE[worst_state]: worst_state = state # 1. Expression batches (R08 B3: two-pass order-independent uniqueness BEFORE accepting passing batches; # >= 3 distinct passing batches per cocktail lead; non-empty construct_ids required on EVERY batch) batches = observation.get("expression_batches") passing_batch_constructs: dict[str, frozenset[str]] = {} referenced_batches: set[str] = set() comp1_assay_batches: set[str] = set() comp2_assay_batches: set[str] = set() cocktail_comp1_batches: set[str] = set() cocktail_comp2_batches: set[str] = set() conflicted_batch_ids: set[str] = set() if not isinstance(batches, list) or len(batches) == 0: _escalate("HOLD_INVALID_OR_MISSING_INPUT", "Missing typed expression_batches list (>= 3 distinct batches required)") else: batch_id_counts: dict[str, int] = {} for b in batches: if isinstance(b, dict): bid = b.get("batch_id") if type(bid) is str and bid.strip(): bid_c = bid.strip() batch_id_counts[bid_c] = batch_id_counts.get(bid_c, 0) + 1 conflicted_batch_ids = {k for k, cnt in batch_id_counts.items() if cnt > 1} for cbid in sorted(conflicted_batch_ids): _escalate( "HOLD_INVALID_OR_MISSING_INPUT", f"Duplicate/conflicting expression batch_id: {cbid!r} (count={batch_id_counts[cbid]}); all occurrences excluded", ) lead_batch_counts: dict[str, int] = {ld: 0 for ld in _SHIELD_COCKTAIL_LEADS} for idx, b in enumerate(batches): if not isinstance(b, dict): _escalate("HOLD_INVALID_OR_MISSING_INPUT", f"expression_batches[{idx}] must be an object") continue bid = b.get("batch_id") if type(bid) is not str or not bid.strip(): _escalate("HOLD_INVALID_OR_MISSING_INPUT", f"expression_batches[{idx}] missing non-empty batch_id") continue bid_clean = bid.strip() if bid_clean in conflicted_batch_ids: continue if b.get("qc_passed") is not True: _escalate("HOLD_INVALID_OR_MISSING_INPUT", f"Expression batch {bid_clean!r} failed qc_passed") continue c_set, c_err = _shield_parse_batch_construct_ids(b, bid_clean) if c_err is not None or c_set is None: _escalate("HOLD_INVALID_OR_MISSING_INPUT", c_err or f"Invalid construct_ids on batch {bid_clean!r}") continue passing_batch_constructs[bid_clean] = c_set for ld in _SHIELD_COCKTAIL_LEADS: