if ( _upper95('obs_s6_cluster_diam_p90_um') > _diam_cap or _lower95('obs_s6_p10_nearest_neighbor_edge_gap_um') < _gap_floor ): iip0019_s6_status = 'HOLD_S6_LATERAL_CLUMPING_EDGE_GAP_OR_CLUSTER_DIAMETER_CAP_FAILED' else: iip0019_s6_status = 'CLEARED_S6_LATERAL_SPACING_AND_DOSE_MATCHED_CLUSTER_CAP' if iip0019_s6_status != 'CLEARED_S6_LATERAL_SPACING_AND_DOSE_MATCHED_CLUSTER_CAP': iip0019_transport_hold_status = iip0019_s6_status if _p05_active: _p05_quant_ok = all( _mk in validated_stage0 and se_provenance_by_mean.get(_mk) == 'EXPLICIT_SE_SUPPLIED' for _mk in _p05_mean_keys ) if _p05_geom_val is None or not _p05_quant_ok: iip0019_p05_status = 'HOLD_P05_INCOMPLETE_OR_DEFAULT_SE_BARRIER_QUALIFICATION_PANEL' elif observations.get('p05_full_336h_coupled_o2_h2o2_ca_ph_qualified') is not True: iip0019_p05_status = 'HOLD_P05_FULL_336H_COUPLED_TRANSPORT_QUALIFICATION_UNVERIFIED' elif _upper95('obs_p05_islet_plane_h2o2_max_uM') > 5.0: iip0019_p05_status = 'HOLD_P05_ISLET_PLANE_H2O2_EXCEEDS_5P0UM_TIER2_ABORT_CEILING' elif _upper95('obs_p05_islet_plane_h2o2_max_uM') > 2.5: iip0019_p05_status = 'HOLD_P05_ISLET_PLANE_H2O2_EXCEEDS_2P5UM_TIER1_TARGET_REQUIRES_FULL_73800IU_RETENTION' elif ( _upper95('obs_p05_microbead_volume_d99_um') > 50.0 or _lower95('obs_p05_catalase_barrier_film_um') < 20.0 or _lower95('obs_p05_day7_catalase_retention_pct') < 70.0 or _lower95('obs_p05_336h_retained_catalase_iu_333cm2') < 73800.0 ): iip0019_p05_status = 'HOLD_P05_MICROBEAD_D99_FILM_THICKNESS_OR_CATALASE_RETENTION_FAILED' else: iip0019_p05_status = 'CLEARED_P05_WET_SIEVED_MICROBEAD_AND_20UM_CATALASE_BARRIER_GATE' if iip0019_p05_status != 'CLEARED_P05_WET_SIEVED_MICROBEAD_AND_20UM_CATALASE_BARRIER_GATE' and iip0019_transport_hold_status is None: iip0019_transport_hold_status = iip0019_p05_status if _dz_active: _dz_empty_ok = all( _mk in validated_stage0 and se_provenance_by_mean.get(_mk) == 'EXPLICIT_SE_SUPPLIED' for _mk in _dz_empty_mean_keys ) _dz_loaded_ok = all( _mk in validated_stage0 and se_provenance_by_mean.get(_mk) == 'EXPLICIT_SE_SUPPLIED' for _mk in _dz_loaded_mean_keys ) if _dz_arm_val is None or not _dz_empty_ok: iip0019_dz_status = 'HOLD_DESIGN_Z_INCOMPLETE_OR_DEFAULT_SE_EMPTY_LUMEN_OPTODE_PANEL' elif _dz_arm_val == 'EXPLORATORY_18PCT_DIVIDER_140UM' and not _divider_qc_cleared: iip0019_dz_status = 'HOLD_S6_EXPLORATORY_DIVIDER_HYDRATED_PO2_LEACHABLES_OR_MODULUS_QC_FAILED' else: _lumen_floor = 35.0 if _dz_arm_val == 'EXPLORATORY_18PCT_DIVIDER_140UM' else 40.0 _standoff_cap = 20.0 if _dz_arm_val == 'EXPLORATORY_18PCT_DIVIDER_140UM' else 15.0 if ( observations.get('design_z_empty_lumen_14d_persistence_verified') is not True or _lower95('obs_design_z_empty_lumen_5site_min_po2_mmhg') < _lumen_floor or _upper95('obs_design_z_vessel_standoff_p90_um') > _standoff_cap ): iip0019_dz_status = 'HOLD_DESIGN_Z_EMPTY_LUMEN_PO2_STANDOFF_OR_14D_PERSISTENCE_FAILED' elif observations.get('design_z_loaded_closed_state_confirmed') is not True or not _dz_loaded_ok: iip0019_dz_status = 'HOLD_DESIGN_Z_EMPTY_LUMEN_ONLY_REQUIRES_LOADED_CLOSED_STATE_CONFIRMATION' elif ( _lower95('obs_design_z_loaded_surface_po2_mmhg') < 15.0 or _lower95('obs_design_z_loaded_core_po2_mmhg') < 5.0 or _lower95('obs_design_z_loaded_perifusion_gsis_si') < 3.0 ): iip0019_dz_status = 'HOLD_DESIGN_Z_LOADED_CLOSED_STATE_PO2_OR_READOUT2_GSIS_SI3_FAILED' else: iip0019_dz_status = 'CLEARED_DESIGN_Z_TWO_STAGE_EMPTY_LUMEN_AND_LOADED_CLOSED_STATE_GATE' if iip0019_dz_status != 'CLEARED_DESIGN_Z_TWO_STAGE_EMPTY_LUMEN_AND_LOADED_CLOSED_STATE_GATE' and iip0019_transport_hold_status is None: iip0019_transport_hold_status = iip0019_dz_status iip0019_eval_summary: dict[str, object] | None = None if _s6_active or _p05_active or _dz_active: iip0019_eval_summary = { 'gate_pass': iip0019_transport_hold_status is None, 'hold_status': iip0019_transport_hold_status, 's6_cluster_size_arm': _s6_arm_val, 's6_lateral_spacing_status': iip0019_s6_status, 'p05_barrier_slab_geometry_mode': _p05_geom_val, 'p05_microbead_barrier_status': iip0019_p05_status, 'design_z_divider_arm': _dz_arm_val, 'design_z_two_stage_status': iip0019_dz_status, } # Stage-0 Gate P05 recombinant human CAT (P04040) species/shed-mass/endotoxin lock and anti-PEG / Day-28 anti-SA humoral + DPR-maleimide/hepatocyte cuff gate (IIP-0020; DEC-099): _req_iip0020_full = observations.get('require_full_iip0020_biomaterial_and_humoral_panel') is True _p05_cat_acc = observations.get('p05_catalase_uniprot_accession') if isinstance(_p05_cat_acc, str): _p05_cat_acc = _p05_cat_acc.strip() _cuff_arm = observations.get('cuff_bioconjugation_arm') if isinstance(_cuff_arm, str): _cuff_arm = _cuff_arm.strip() _cuff_stratum = observations.get('cuff_serum_challenge_stratum') if isinstance(_cuff_stratum, str): _cuff_stratum = _cuff_stratum.strip() _iip0020_p05_mean_keys = ( 'obs_p05_catalase_endotoxin_eu_per_mg', 'obs_p05_total_implant_catalase_endotoxin_eu', 'obs_p05_day7_shed_catalase_mass_pct', ) _iip0020_cuff_core_mean_keys = ( 'obs_cuff_surface_c3b_deposition_pct_pos_ctrl', 'obs_cuff_soluble_sc5b9_pct_pos_ctrl', 'obs_cuff_macrophage_fcgammar_cytokine_fold', 'obs_cuff_primed_serum_thbd_apc_retention_pct', 'obs_cuff_primed_serum_cfh_c3b_cleavage_retention_pct', 'obs_cuff_dpr_ring_hydrolysis_pct', 'obs_cuff_hepatocyte_72h_caspase37_fold', 'obs_cuff_hepatocyte_72h_alt_ldh_fold', ) _iip0020_cuff_donor_count_keys = ( 'obs_cuff_serum_donor_count', 'obs_cuff_serum_failing_donor_count', ) _iip0020_fasl_mean_keys = ( 'obs_cuff_primed_serum_fasl_ec50_fold_shift', 'obs_cuff_primed_serum_fasl_emax_apoptosis_pct', 'obs_cuff_14d_hsa_shed_bioactive_fasl_pct', ) _iip0020_p05_species_active = bool( _req_iip0020_full or (_req_iip0025_full and not _is_design_z_product) or (product_def is not None and not _is_design_z_product and _p05_active) or _p05_cat_acc is not None or observations.get('p05_recombinant_human_catalase_verified') is not None or any(_mk in validated_stage0 for _mk in _iip0020_p05_mean_keys) ) _iip0020_cuff_active = bool( _req_iip0020_full or _cuff_arm is not None or _cuff_stratum is not None or observations.get('cuff_dpr_ring_hydrolysis_lcms_verified') is not None or observations.get('cuff_conjugate_disulfide_and_site_occupancy_lcms_verified') is not None or observations.get('cuff_hexafasl_inventory_within_provisional_cap_verified') is not None or any(_mk in validated_stage0 for _mk in (*_iip0020_cuff_core_mean_keys, *_iip0020_cuff_donor_count_keys, *_iip0020_fasl_mean_keys, 'obs_cuff_h1a_sec_mals_hexamer_purity_pct', 'obs_cuff_unreacted_free_thiol_pct')) ) iip0020_p05_species_status: str | None = None iip0020_cuff_status: str | None = None iip0020_hold_status: str | None = None # Product-bind Gate P05 strictly to CaO2-containing routes (not _is_design_z_product) so extra Design Z fields never suppress species/barrier holds (IIP-0025; DEC-104): if _iip0020_p05_species_active and not _is_design_z_product: _iip20_p05_quant_ok = all( _mk in validated_stage0 and se_provenance_by_mean.get(_mk) == 'EXPLICIT_SE_SUPPLIED' for _mk in _iip0020_p05_mean_keys ) if _p05_cat_acc != 'P04040' or observations.get('p05_recombinant_human_catalase_verified') is not True: iip0020_p05_species_status = 'HOLD_P05_XENO_OR_UNVERIFIED_CATALASE_SPECIES_REQUIRES_HUMAN_P04040' elif not _iip20_p05_quant_ok: iip0020_p05_species_status = 'HOLD_P05_INCOMPLETE_OR_DEFAULT_SE_CATALASE_ENDOTOXIN_OR_SHED_MASS_PANEL' elif ( _upper95('obs_p05_catalase_endotoxin_eu_per_mg') > 0.10 or _upper95('obs_p05_total_implant_catalase_endotoxin_eu') > 0.50 or _upper95('obs_p05_day7_shed_catalase_mass_pct') > 30.0 ): iip0020_p05_species_status = 'HOLD_P05_CATALASE_ENDOTOXIN_OR_DAY7_SHED_MASS_EXCEEDED' else: iip0020_p05_species_status = 'CLEARED_P05_HUMAN_P04040_SPECIES_ENDOTOXIN_AND_SHED_MASS_GATE' if iip0020_p05_species_status != 'CLEARED_P05_HUMAN_P04040_SPECIES_ENDOTOXIN_AND_SHED_MASS_GATE': iip0020_hold_status = iip0020_p05_species_status if _iip0020_cuff_active: _is_fasl_free = _cuff_arm == 'DPR_HYDROLYZED_CFH_THBD_FASL_FREE' _is_h1a = _cuff_arm == 'DPR_HYDROLYZED_CFH_THBD_H1A_ADIPOQ_HEXAFASL' _is_dpr_covalent = _cuff_arm in ( 'DPR_HYDROLYZED_CFH_THBD_H1A_ADIPOQ_HEXAFASL', 'DPR_HYDROLYZED_CFH_THBD_T0_TNC_FASL', 'DPR_HYDROLYZED_CFH_THBD_FASL_FREE', ) _req_cuff_keys = list(_iip0020_cuff_core_mean_keys) if not _is_fasl_free: _req_cuff_keys.extend(_iip0020_fasl_mean_keys) if _is_dpr_covalent: _req_cuff_keys.append('obs_cuff_unreacted_free_thiol_pct') if _is_h1a: _req_cuff_keys.append('obs_cuff_h1a_sec_mals_hexamer_purity_pct') _cuff_quant_ok = all( _mk in validated_stage0 and se_provenance_by_mean.get(_mk) == 'EXPLICIT_SE_SUPPLIED' for _mk in _req_cuff_keys ) and all( _mk in validated_stage0 and abs(validated_stage0[_mk] - round(validated_stage0[_mk])) <= 1e-9 for _mk in _iip0020_cuff_donor_count_keys ) _cuff_donor_n = int(round(validated_stage0['obs_cuff_serum_donor_count'])) if 'obs_cuff_serum_donor_count' in validated_stage0 else -1 _cuff_fail_n = int(round(validated_stage0['obs_cuff_serum_failing_donor_count'])) if 'obs_cuff_serum_failing_donor_count' in validated_stage0 else 999 if _cuff_arm is None or _cuff_stratum is None or not _cuff_quant_ok: iip0020_cuff_status = 'HOLD_CUFF_INCOMPLETE_OR_DEFAULT_SE_HUMORAL_MALEIMIDE_HEPATOCYTE_PANEL' elif observations.get('cuff_dpr_ring_hydrolysis_lcms_verified') is not True or _lower95('obs_cuff_dpr_ring_hydrolysis_pct') < 98.0: iip0020_cuff_status = 'HOLD_CUFF_THIOSUCCINIMIDE_RING_HYDROLYSIS_LT_98PCT_RETRO_MICHAEL_HAZARD' elif _is_dpr_covalent and ( observations.get('cuff_conjugate_disulfide_and_site_occupancy_lcms_verified') is not True or _upper95('obs_cuff_unreacted_free_thiol_pct') > 5.0 ): iip0020_cuff_status = 'HOLD_CUFF_CONJUGATE_DISULFIDE_SITE_OCCUPANCY_OR_FREE_THIOL_FAILED' elif _is_h1a and _lower95('obs_cuff_h1a_sec_mals_hexamer_purity_pct') < 90.0: iip0020_cuff_status = 'HOLD_CUFF_H1A_HEXAMER_PURITY_LT_90PCT' elif not _is_fasl_free and ( observations.get('cuff_hexafasl_inventory_within_provisional_cap_verified') is not True or _upper95('obs_cuff_14d_hsa_shed_bioactive_fasl_pct') > 5.0 or _upper95('obs_cuff_primed_serum_fasl_ec50_fold_shift') > 2.0 or _lower95('obs_cuff_primed_serum_fasl_ec50_fold_shift') < 0.50 or _lower95('obs_cuff_primed_serum_fasl_emax_apoptosis_pct') < 80.0 ): iip0020_cuff_status = 'HOLD_CUFF_FASL_CAP_SHEDDING_OR_PRIMED_SERUM_POTENCY_FAILED' elif ( _cuff_donor_n < 12 or _cuff_fail_n > 0 or _upper95('obs_cuff_surface_c3b_deposition_pct_pos_ctrl') > 5.0 or _upper95('obs_cuff_soluble_sc5b9_pct_pos_ctrl') > 5.0 or _upper95('obs_cuff_macrophage_fcgammar_cytokine_fold') > 1.5 or _lower95('obs_cuff_primed_serum_thbd_apc_retention_pct') < 80.0 or _lower95('obs_cuff_primed_serum_cfh_c3b_cleavage_retention_pct') < 80.0 ): iip0020_cuff_status = 'HOLD_CUFF_ANTI_PEG_OR_DAY28_ANTI_SA_HUMORAL_COMPLEMENT_OR_COFACTOR_FAILED' elif ( _upper95('obs_cuff_hepatocyte_72h_caspase37_fold') > 1.20 or _upper95('obs_cuff_hepatocyte_72h_alt_ldh_fold') > 1.20 ): iip0020_cuff_status = 'HOLD_CUFF_PRIMARY_HUMAN_HEPATOCYTE_LEACHATE_OR_DIGEST_TOXICITY_EXCEEDED' else: iip0020_cuff_status = 'CLEARED_CUFF_HUMORAL_HYDROLYSIS_AND_HEPATOCYTE_SAFETY_GATE' if iip0020_cuff_status != 'CLEARED_CUFF_HUMORAL_HYDROLYSIS_AND_HEPATOCYTE_SAFETY_GATE' and iip0020_hold_status is None: iip0020_hold_status = iip0020_cuff_status iip0020_eval_summary: dict[str, object] | None = None if _iip0020_p05_species_active or _iip0020_cuff_active: iip0020_eval_summary = { 'gate_pass': iip0020_hold_status is None, 'hold_status': iip0020_hold_status, 'p05_catalase_uniprot_accession': _p05_cat_acc, 'p05_catalase_species_status': iip0020_p05_species_status, 'cuff_bioconjugation_arm': _cuff_arm, 'cuff_serum_challenge_stratum': _cuff_stratum, 'cuff_humoral_and_safety_status': iip0020_cuff_status, } # Stage-0 120-h lineage-resolved metabolic-rest OCR coupon and 4-arm Nec-1s x Ferrostatin-1 pellet-LOQ/NQO1 conditioning gate (IIP-0021; DEC-100): _req_iip0021_full = observations.get('require_full_iip0021_ocr_and_conditioning_panel') is True _rest_arm = observations.get('rest_ocr_coupon_arm') if isinstance(_rest_arm, str): _rest_arm = _rest_arm.strip() _cond_arm = observations.get('conditioning_4arm_arm') if isinstance(_cond_arm, str): _cond_arm = _cond_arm.strip() _cond_scope = observations.get('conditioning_washout_analyte_scope') if isinstance(_cond_scope, str): _cond_scope = _cond_scope.strip() _iip0021_rest_keys = ( 'obs_rest_120h_graft_ocr_ratio',