def __repr__(self) -> str: return f'MCBScopeKey{self.as_tuple()!r}' class LotScopeKey: """5-key Stage-7 differentiation lot provenance scope tuple (IIP-0024; DEC-103).""" __slots__ = ('product_variant_id', 'construct_sha256', 'donor_seedline_id', 'mcb_id', 'lot_id') def __init__( self, product_variant_id: str, construct_sha256: str, donor_seedline_id: str, mcb_id: str, lot_id: str, ) -> None: for fname, val in ( ('product_variant_id', product_variant_id), ('construct_sha256', construct_sha256), ('donor_seedline_id', donor_seedline_id), ('mcb_id', mcb_id), ('lot_id', lot_id), ): if not isinstance(val, str) or not val.strip() or val != val.strip(): raise ValueError(f'LotScopeKey.{fname} must be a canonical non-whitespace-padded string (IIP-0024; DEC-103)') object.__setattr__(self, fname, val) def __setattr__(self, name: str, value: Any) -> None: raise TypeError('LotScopeKey is immutable (IIP-0024; DEC-103)') def __delattr__(self, name: str) -> None: raise TypeError('LotScopeKey is immutable (IIP-0024; DEC-103)') def as_tuple(self) -> tuple[str, str, str, str, str]: return (self.product_variant_id, self.construct_sha256, self.donor_seedline_id, self.mcb_id, self.lot_id) def to_mcb_key(self) -> MCBScopeKey: return MCBScopeKey(self.product_variant_id, self.construct_sha256, self.donor_seedline_id, self.mcb_id) def __eq__(self, other: object) -> bool: return isinstance(other, LotScopeKey) and self.as_tuple() == other.as_tuple() def __hash__(self) -> int: return hash(('LotScopeKey', self.as_tuple())) def __repr__(self) -> str: return f'LotScopeKey{self.as_tuple()!r}' class AssembledDeviceLotScopeKey: """7-key assembled device x lot x physical route provenance scope tuple (IIP-0024; DEC-103).""" __slots__ = ( 'product_variant_id', 'construct_sha256', 'donor_seedline_id', 'mcb_id', 'lot_id', 'device_assembly_id', 'physical_route_id', ) def __init__( self, product_variant_id: str, construct_sha256: str, donor_seedline_id: str, mcb_id: str, lot_id: str, device_assembly_id: str, physical_route_id: str, ) -> None: for fname, val in ( ('product_variant_id', product_variant_id), ('construct_sha256', construct_sha256), ('donor_seedline_id', donor_seedline_id), ('mcb_id', mcb_id), ('lot_id', lot_id), ('device_assembly_id', device_assembly_id), ('physical_route_id', physical_route_id), ): if not isinstance(val, str) or not val.strip() or val != val.strip(): raise ValueError(f'AssembledDeviceLotScopeKey.{fname} must be a canonical non-whitespace-padded string (IIP-0024; DEC-103)') object.__setattr__(self, fname, val) def __setattr__(self, name: str, value: Any) -> None: raise TypeError('AssembledDeviceLotScopeKey is immutable (IIP-0024; DEC-103)') def __delattr__(self, name: str) -> None: raise TypeError('AssembledDeviceLotScopeKey is immutable (IIP-0024; DEC-103)') def as_tuple(self) -> tuple[str, str, str, str, str, str, str]: return ( self.product_variant_id, self.construct_sha256, self.donor_seedline_id, self.mcb_id, self.lot_id, self.device_assembly_id, self.physical_route_id, ) def to_lot_key(self) -> LotScopeKey: return LotScopeKey( self.product_variant_id, self.construct_sha256, self.donor_seedline_id, self.mcb_id, self.lot_id, ) def to_mcb_key(self) -> MCBScopeKey: return MCBScopeKey(self.product_variant_id, self.construct_sha256, self.donor_seedline_id, self.mcb_id) def __eq__(self, other: object) -> bool: return isinstance(other, AssembledDeviceLotScopeKey) and self.as_tuple() == other.as_tuple() def __hash__(self) -> int: return hash(('AssembledDeviceLotScopeKey', self.as_tuple())) def __repr__(self) -> str: return f'AssembledDeviceLotScopeKey{self.as_tuple()!r}' ENDPOINT_REGISTRY_SPEC: MappingProxyType = _deep_freeze_iip0024({ 'registry_version': 'IIP-0024-v1.0', 'decision_id': 'DEC-103', 'mcb_mandatory_endpoint_ids': ( 'mcb_donor_pairwise_ibd_pi_hat', 'mcb_wgs_30x_structural_haplotype_verified', 'mcb_karyotype_gband_ogm_verified', 'mcb_imprinting_ic1_record', 'mcb_imprinting_ic2_record', 'mcb_imprinting_ig_dmr_record', 'mcb_xci_46xx_3axis_record', 'mcb_mtdna_1000x_scoped_record', 'mcb_1q32_mdm4_diploid_cn', 'mcb_1q32_mdm4_single_cell_mosaic', 'mcb_20q11_bcl2l1_diploid_cn', 'mcb_20q11_bcl2l1_single_cell_mosaic', 'mcb_tier6b_pure_hpsc_clonogenic_escape', ), 'lot_mandatory_endpoint_ids': ( 'lot_tier6b_sorted_prolif_clonogenic_escape', ), 'device_sister_terminal_endpoint_ids': ( 'obs_explant_en_bloc_recovery_fraction', 'gate0s_shedding_ddpcr_assay', 'gate0s_shedding_viable_outgrowth_assay', 'obs_iapp_d84_immunocapture_oligomer_elisa_fold', 'obs_iapp_d84_colocalized_fibril_area_pct', ), 'count_endpoint_caps_and_zero_vetoes': { 'mcb_1q32_mdm4_single_cell_mosaic': {'cap': 0.01, 'require_observed_zero': False}, 'mcb_20q11_bcl2l1_single_cell_mosaic': {'cap': 0.01, 'require_observed_zero': False}, 'mcb_tier6b_pure_hpsc_clonogenic_escape': {'cap': 1e-8, 'require_observed_zero': True, 'use_poisson_protocol_floor': True, 'forbid_implicit_1p0_defaults': True}, 'obs_tp53_ppm1d_bcor_vaf': {'cap': 1.0e-4, 'require_observed_zero': False, 'use_poisson_protocol_floor': True}, 'obs_castseq_translocation_freq': {'cap': 1.0e-4, 'require_observed_zero': False, 'use_poisson_protocol_floor': True}, 'obs_20q11_bcl2l1_single_cell_mosaic': {'cap': 0.01, 'require_observed_zero': False}, 'obs_1q32_mdm4_single_cell_mosaic': {'cap': 0.01, 'require_observed_zero': False}, 'obs_assembled_cluster_ki67_progenitor': {'cap': 0.005, 'require_observed_zero': False}, 'obs_ductal_sox9_krt19_double_pos': {'cap': 0.001, 'require_observed_zero': False}, 'obs_assembled_cluster_slc18a1_enterochromaffin': {'cap': 0.01, 'require_observed_zero': False}, 'obs_senescent_p16_sasp_positive': {'cap': 0.01, 'require_observed_zero': False}, 'obs_gate0v_day28_persistent_vp1_ie1': {'cap': 0.0005, 'require_observed_zero': True}, 'lot_tier6b_sorted_prolif_clonogenic_escape': { 'cap': 3.0e-7, 'require_observed_zero': True, 'requires_per_fraction_thinning': True, 'forbid_implicit_1p0_defaults': True, 'detection_floor_d_l_min': 0.50, 'scope_key_tuple': ('endpoint_id', 'scope_key', 'fraction_id'), }, 'obs_day28_sox2_oct4_nanog_residual_psc': {'cap': 0.0005, 'require_observed_zero': False}, 'obs_day28_mki67_top2a_prolif_escapee': {'cap': 0.0005, 'require_observed_zero': False}, 'gate0s_shedding_ddpcr_assay': {'cap': 1e-6, 'require_observed_zero': True}, 'gate0s_shedding_viable_outgrowth_assay': {'cap': 1e-6, 'require_observed_zero': True}, }, 'physical_routes': { 'SUPRAFASCIAL_350UM_CAO2_CATALASE_POUCH': { 'requires_cao2_catalase_p05': True, 'requires_design_z_two_stage': False, 'requires_cuff_panel': True, 'canonical_design_z_divider_arm': None, }, 'Z_OMENTAL_140UM_ZERO_CAO2': { 'requires_cao2_catalase_p05': False, 'requires_design_z_two_stage': True, 'requires_cuff_panel': True, 'canonical_design_z_divider_arm': 'PLAIN_HYDROGEL_140UM', }, 'DESIGN_Z_140UM_ZERO_CAO2_PLAIN_HYDROGEL': { 'requires_cao2_catalase_p05': False, 'requires_design_z_two_stage': True, 'requires_cuff_panel': True, 'canonical_design_z_divider_arm': 'PLAIN_HYDROGEL_140UM', }, 'DESIGN_Z_140UM_ZERO_CAO2_EXPLORATORY_DIVIDER': { 'requires_cao2_catalase_p05': False, 'requires_design_z_two_stage': True, 'requires_cuff_panel': True, 'canonical_design_z_divider_arm': 'EXPLORATORY_18PCT_DIVIDER_140UM', }, }, }) REGISTERED_VALIDATED_CLUSTER_ESTIMATORS_IIP0024: frozenset[str] = frozenset({ 'BETA_BINOMIAL_EXACT_PROFILE_L95_V1', 'DESIGN_BASED_HYPERGEOMETRIC_CLUSTER_BOUND_V1', }) _ATOMIC_ENDPOINT_KINDS = { **dict.fromkeys(ENDPOINT_REGISTRY_SPEC['count_endpoint_caps_and_zero_vetoes'], 'EXACT_INTEGER_COUNT'), **dict.fromkeys(S9_CORE_LOT_ENDPOINT_IDS, 'CONTINUOUS_STUDENT_T'), **dict.fromkeys(( 'stage7_stored_mature_insulin_iu', 'gate0s_ap1903_1h_insulin_burst_iu', 'gate0s_ap1903_24h_insulin_dump_fraction', 'obs_explant_en_bloc_recovery_fraction', 'mcb_1q32_mdm4_diploid_cn', 'mcb_20q11_bcl2l1_diploid_cn', 'mcb_donor_pairwise_ibd_pi_hat', 'obs_iapp_d84_immunocapture_oligomer_elisa_fold', 'obs_iapp_d84_colocalized_fibril_area_pct', ), 'CONTINUOUS_STUDENT_T'), **dict.fromkeys(( 'mcb_wgs_30x_structural_haplotype_verified', 'mcb_karyotype_gband_ogm_verified', ), 'METADATA_CONTROL'), **dict.fromkeys(( 'mcb_imprinting_ic1_record', 'mcb_imprinting_ic2_record', 'mcb_imprinting_ig_dmr_record', 'mcb_xci_46xx_3axis_record', 'mcb_mtdna_1000x_scoped_record', 'stage0_twoclock_repeated_challenge_panel', 'stage0_locus2_modeb_v3_panel', ), 'STRUCTURED_PANEL'), } _ATOMIC_REQUIRED_SCOPES = { **dict.fromkeys(ENDPOINT_REGISTRY_SPEC['mcb_mandatory_endpoint_ids'], 'MCB_SCOPE'), **dict.fromkeys(ENDPOINT_REGISTRY_SPEC['device_sister_terminal_endpoint_ids'], 'ASSEMBLED_DEVICE_LOT_SCOPE'), **dict.fromkeys(('gate0s_ap1903_1h_insulin_burst_iu', 'gate0s_ap1903_24h_insulin_dump_fraction'), 'ASSEMBLED_DEVICE_LOT_SCOPE'), **dict.fromkeys((*S9_CORE_LOT_ENDPOINT_IDS, 'stage7_stored_mature_insulin_iu'), 'LOT_SCOPE'), } def _atomic_mcb_panel_status(validator, scope: str, payload: Any) -> str: if not isinstance(payload, dict): return 'HOLD_MALFORMED_STRUCTURED_PANEL' try: args = inspect.signature(validator).bind(endpoint_scope=scope, **payload) except TypeError: return 'HOLD_MALFORMED_STRUCTURED_PANEL' status = validator(*args.args, **args.kwargs)['status'] return 'PASS' if status == 'NOT_APPLICABLE_46XY' else status