OpenIslet

scripts/verify_iip0056_route4_omentum_and_exvivo_rest.py

OpenIslet Wave-6 Round-14 Prospective Candidate W6-C2 (Staged Slot IIP-0047 -> Provisional

script Release v0.8.0 gen-eb955f8266035aba 466 KB · 37 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_iip0056_route4_omentum_and_exvivo_rest.py · SHA-256: 25e12d578ba80b55…

    "survival_to_endpoint",
    "major_hemorrhage_or_dehiscence",
    "bowel_obstruction_event",
    "omental_torsion_event",
    "grade3_adhesion_event",
    "monitored_complications",
    "surgical_safety_pass",
    "month3_capsule_um",
    "retrieval_mass_pct",
    "total_implanted_cells",
    "residual_viable_cells_measured",
    "residual_sampling_fraction",
    "localization_verified",
)
# NHP cohort: diabetic enrollment eligibility, measurement dates, typed monitored complications, observed independence vs documented Day-90 nonresponder (Review C2 #1 / Audit F5 / Audit R4-04 / Audit R5-04)
REQUIRED_NHP_SUBJECT_FIELDS: Tuple[str, ...] = (
    "subject_id",
    "species",
    "lot_id",
    "preimplant_diabetic_verified",
    "baseline_exogenous_insulin_u_kg_d",
    "baseline_fasting_c_peptide_ng_ml",
    "dose_ieq_per_kg",
    "achieved_insulin_independence",
    "followup_duration_days",
    "capsule_sampling_day",
    "bowel_obstruction_event",
    "omental_torsion_event",
    "grade3_adhesion_event",
    "monitored_complications",
    "month3_capsule_um",
    "residual_exogenous_insulin_u_kg_d",
    "paired_dynamic_gsis_pass",
    "retrieval_mass_pct",
    "total_implanted_cells",
    "residual_viable_cells_measured",
    "residual_sampling_fraction",
    "localization_verified",
)
REQUIRED_NHP_RESPONDER_PROCEDURE_AND_ENDPOINT_FIELDS: Tuple[str, ...] = (
    "insulin_indep_day",
    "omentectomy_performed",
    "omentectomy_procedure_id",
    "omentectomy_day",
    "cpeptide_extinction_subject_id",
    "cpeptide_extinction_procedure_id",
    "cpeptide_extinction_assessment_day",
    "post_omentectomy_cpeptide_extinguished",
    "portal_gradient_assessment_day",
)
SUBJECT_FOLLOWUP_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "followup_days",
    "follow_up_days",
    "follow_up_duration_days",
    "followup_day",
)
SUBJECT_CAPSULE_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "capsule_histology_day",
    "capsule_day",
    "capsule_measurement_day",
    "month3_capsule_day",
    "month3_capsule_sampling_day",
    "histology_day",
)
SUBJECT_RETRIEVAL_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "retrieval_day",
    "explant_day",
    "omentectomy_day",
    "necropsy_day",
)
NHP_OMENTECTOMY_PROCEDURE_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "procedure_day",
    "explant_day",
    "omentectomy_procedure_day",
    "explant_omentectomy_day",
    "graft_explant_day",
    "partial_omentectomy_day",
    "retrieval_day",
    "retrieval_assessment_day",
)
NHP_TERMINAL_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "necropsy_day",
    "terminal_day",
    "euthanasia_day",
)
NHP_CPEP_EXTINCTION_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "cpeptide_extinction_day",
    "post_omentectomy_cpeptide_assessment_day",
    "post_omentectomy_cpeptide_extinction_day",
    "post_omentectomy_cpeptide_extinction_assessment_day",
    "extinction_assessment_day",
    "extinction_day",
)
NHP_PORTAL_GRADIENT_DATE_ALIAS_KEYS: Tuple[str, ...] = (
    "portal_gradient_day",
    "portal_insulin_gradient_day",
)
NHP_OMENTECTOMY_PERFORMED_ALIAS_KEYS: Tuple[str, ...] = (
    "partial_omentectomy_performed",
    "explant_performed",
    "graft_explant_performed",
    "procedure_performed",
)
NHP_PROCEDURE_ID_ALIAS_KEYS: Tuple[str, ...] = (
    "procedure_id",
    "explant_procedure_id",
    "omentectomy_id",
    "partial_omentectomy_procedure_id",
    "graft_explant_procedure_id",
)
NHP_EXTINCTION_SUBJECT_ID_ALIAS_KEYS: Tuple[str, ...] = (
    "extinction_subject_id",
    "cpeptide_subject_id",
    "post_omentectomy_extinction_subject_id",
)
NHP_EXTINCTION_PROCEDURE_ID_ALIAS_KEYS: Tuple[str, ...] = (
    "extinction_procedure_id",
    "cpeptide_procedure_id",
    "post_omentectomy_extinction_procedure_id",
)
NHP_EXTINCTION_OUTCOME_BOOL_ALIAS_KEYS: Tuple[str, ...] = (
    "post_omentectomy_cpeptide_extinguished",
    "cpeptide_extinguished",
    "post_omentectomy_cpeptide_extinction",
    "cpeptide_extinction",
    "cpeptide_extinction_verified",
    "cpeptide_extinction_confirmed",
    "cpeptide_extinction_achieved",
    "cpeptide_extinction_pass",
    "cpeptide_extinction_result",
    "extinction_verified",
    "extinction_confirmed",
    "extinction_achieved",
    "extinction_result",
    "post_omentectomy_extinction",
    "post_omentectomy_extinction_verified",
    "post_omentectomy_cpeptide_extinction_verified",
    "post_omentectomy_cpeptide_extinction_confirmed",
    "post_omentectomy_cpeptide_extinction_pass",
)
SUBJECT_COMPLICATION_BOOL_ALIAS_GROUPS: Tuple[Tuple[str, ...], ...] = (
    (
        "bowel_obstruction_event",
        "bowel_obstruction",
        "intestinal_obstruction",
        "intestinal_obstruction_event",
        "bowel_obstruction_observed",
    ),
    (
        "omental_torsion_event",
        "omental_torsion",
        "torsion",
        "volvulus",
        "omental_volvulus",
        "omental_torsion_observed",
    ),
    (
        "grade3_adhesion_event",
        "grade3_adhesion",
        "grade3_adhesions",
        "grade_3_adhesion",
        "grade_3_adhesions",
        "adhesion_grade3",
        "adhesion_grade_3",
        "grade3_adhesion_observed",
    ),
    (
        "surgical_complication",
        "major_complication",
    ),
)
SUBJECT_COMPLICATION_BOOL_ALIAS_KEYS: Tuple[str, ...] = (
    "bowel_obstruction",
    "intestinal_obstruction",
    "intestinal_obstruction_event",
    "omental_torsion",
    "torsion",
    "volvulus",
    "omental_volvulus",
    "grade3_adhesion",
    "grade3_adhesions",
    "grade_3_adhesion",
    "grade_3_adhesions",
    "adhesion_grade3",
    "adhesion_grade_3",
    "bowel_obstruction_observed",
    "omental_torsion_observed",
    "grade3_adhesion_observed",
    "surgical_complication",
    "major_complication",
)
SUBJECT_COMPLICATION_LIST_ALIAS_KEYS: Tuple[str, ...] = (
    "adverse_events",
    "adverse_event",
    "complications",
    "complication",
    "surgical_complications",
    "monitored_adverse_events",
    "complication_events",
    "bowel_obstruction_events",
)
ALLOWED_EVIDENCE_TIERS: FrozenSet[str] = frozenset({
    "AUTHENTICATED_ARCHIVED_WETLAB",
    "SYNTHETIC_FIXTURE",
})
GATE0V_BANK_ONLY_DECISIONS: FrozenSet[str] = frozenset({
    "PASS_WHOLEGRAFT_BANK_QUALIFICATION",
    "PASS_COMPOSITE_BANK_QUALIFICATION",
})
GATE0V_ALLOGENEIC_CLINICAL_DECISIONS: FrozenSet[str] = frozenset({
    "PASS_WHOLEGRAFT_LOT_RELEASE_SURROGATE",
    "PASS_COMPOSITE_CLINICAL_RELEASE",
})
GATE0V_AUTOLOGOUS_CLINICAL_DECISIONS: FrozenSet[str] = frozenset({
    "PASS_WHOLEGRAFT_AUTOLOGOUS_PROCESS_QUAL",
    "PASS_COMPOSITE_AUTOLOGOUS_CLINICAL_RELEASE",
})
ALLOWED_UPSTREAM_WETLAB_DECISIONS: Dict[str, FrozenSet[str]] = {
    "GATE-34": frozenset({"PASS", "PASS_GATE34_CLINICAL_LOT_RELEASE", "PASS_GATE34", "PASS_GATE_34"}),
    "GATE-0V": GATE0V_ALLOGENEIC_CLINICAL_DECISIONS | GATE0V_AUTOLOGOUS_CLINICAL_DECISIONS,
    "GATE-5": frozenset({"PASS_GATE5_OQ012_CLONOGENIC_ERADICATION", "PASS_GATE5_OQ012"}),
}
ALLOWED_UPSTREAM_SYNTHETIC_DECISIONS: Dict[str, FrozenSet[str]] = {
    k: frozenset(set(v) | {"SYNTHETIC_SELF_TEST_PASS"}) for k, v in ALLOWED_UPSTREAM_WETLAB_DECISIONS.items()
}
ALLOWED_CURRENT_ASSAY_CLINICAL_DECISIONS: FrozenSet[str] = frozenset({
    "PASS",
    "PASS_GATE35",
    "PASS_GATE_35",
    "PASS_GATE35_CURRENT_ASSAY_VERIFIED",
    "PASS_GATE35_CLINICAL_PROMOTION_AUTHORIZED",
    "PASS_GATE35_CLINICAL_LOT_RELEASE",
})
ALLOWED_CURRENT_ASSAY_NONPROMO_DECISIONS: FrozenSet[str] = (
    ALLOWED_CURRENT_ASSAY_CLINICAL_DECISIONS
    | frozenset({"PASS_STAGE0_CANDIDATE_EXPERIMENT_BOOKING_ONLY", "STAGE_LIMITED_PRECLINICAL_ONLY"})
)
ALLOWED_CURRENT_ASSAY_SYNTHETIC_DECISIONS: FrozenSet[str] = (
    ALLOWED_CURRENT_ASSAY_NONPROMO_DECISIONS
    | frozenset({"SYNTHETIC_SELF_TEST_PASS", "SYNTHETIC_SELF_TEST_BOOKING_PASS"})
)
# Complete governed current-assay measurement fields bound inside current_assay_evidence_record (Review #4)
CURRENT_ASSAY_ALWAYS_BOUND_FIELDS: Tuple[str, ...] = (
    "deployment_site",
    "clinical_matrix_id",
    "needle_microtracks_used",
    "coformulated_immune_cuff_agents",
    "polyglactin_sutures_used",
    "ductal_cytokeratin_impurity_pct",
    "endotoxin_eu_per_ml",