"day0_sprout_length_7d_pct": [round(p + 0.4 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "day0_branching_7d_pct": [round(p + 0.2 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "day0_lumen_formation_7d_pct": [round(p + 0.3 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "delayed_sprout_length_7d_pct": [round(pd + 0.4 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "delayed_branching_7d_pct": [round(pd + 0.2 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "delayed_lumen_formation_7d_pct": [round(pd + 0.3 + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "sprouting_7d_pct": [round(p + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], "sprouting_delayed_7d_pct": [round(pd + d, 2) for d in (-0.3, -0.15, 0.0, 0.15, 0.3)], } for idx_a, (s, c, v, ev_c, p, pd) in enumerate(zip( [0.0, 18.0, 38.0, 54.0, 60.0, 62.0, 64.0], [0.0, 15.0, 35.0, 52.0, 57.0, 58.0, 60.0], [100.0, 99.0, 98.0, 97.0, 95.0, 93.0, 81.0], [100.0, 99.2, 98.4, 97.5, 95.8, 94.0, 82.0], [100.0, 99.0, 97.0, 96.0, 94.0, 92.0, 76.0], [100.0, 99.0, 97.5, 96.5, 94.5, 92.5, 78.0], )) ] a0a_fit_ok = _sign_receipt({ "analysis_method": "SIMULTANEOUS_BONFERRONI_GRID_BRACKET_STUDENT_T", "donor_ids": a0a_donors, "raw_replicates_sha256": sha256_bytes(canonical_json_bytes(a0a_reps_ok)), "analysis_record_sha256": "a" * 64, "ic50_free_alpha_sma_uM": 66.25, "ic50_free_col1a1_uM": 70.88, "ic50_free_max_u95_uM": 75.0, "cc10_free_7d_l95_uM": 280.0, "c_sprout_max_free_7d_l95_uM": 260.0, }) a0a_ok = _sign_receipt({ "stage": "A-0a", "verdict": "PASS", "evidence_scope": "route_free", "study_start_utc": "2026-06-20T08:00:00Z", "recorded_at_utc": "2026-07-01T08:00:00Z", "analysis_record_sha256": "a" * 64, "a0a_assay_matrix": "human_fibroblast_serum_media", "a0a_dialysis_fu_replicates": [0.415, 0.418, 0.420, 0.422, 0.425], "a0a_matrix_fu_by_assay": { "fibrosis_efficacy_assay": { "matrix_id": "human_fibroblast_serum_media", "nominal_conc_uM_grid": [round(x / 0.42, 4) for x in (0.0, 20.0, 40.0, 75.0, 150.0, 260.0, 500.0)], "dialysis_fu_replicates": [0.415, 0.418, 0.420, 0.422, 0.425], "measured_fu_mean": 0.42, "analytical_sample_record_sha256": sha256_bytes(b"A0A-FIBROSIS-FU-DIALYSIS-01"), }, "vascular_viability_assay": { "matrix_id": "human_iec_sprouting_media", "nominal_conc_uM_grid": [round(x / 0.50, 4) for x in (0.0, 20.0, 40.0, 75.0, 150.0, 260.0, 500.0)], "dialysis_fu_replicates": [0.494, 0.497, 0.500, 0.503, 0.506], "measured_fu_mean": 0.50, "analytical_sample_record_sha256": sha256_bytes(b"A0A-VASCULAR-FU-DIALYSIS-01"), }, }, "fu_measured": 0.42, "emax_alpha_sma_pct": 62.0, "emax_col1a1_pct": 58.0, "ic50_free_alpha_sma_uM": 66.25, "ic50_free_col1a1_uM": 70.88, "ic50_free_max_u95_uM": 75.0, "cc10_free_7d_l95_uM": 280.0, "c_sprout_max_free_7d_l95_uM": 260.0, "c_upper_provisional_7d_l95_uM": 260.0, "endpoints_bracketed": True, "tested_free_conc_uM_grid": [0.0, 20.0, 40.0, 75.0, 150.0, 260.0, 500.0], "alpha_sma_inhibition_pct_grid": [0.0, 18.0, 38.0, 54.0, 60.0, 62.0, 64.0], "col1a1_inhibition_pct_grid": [0.0, 15.0, 35.0, 52.0, 57.0, 58.0, 60.0], "viability_7d_pct_grid": [100.0, 99.0, 98.0, 97.0, 95.0, 93.0, 81.0], "sprouting_7d_pct_grid": [100.0, 99.0, 97.0, 96.0, 94.0, 92.0, 76.0], "sprouting_delayed_7d_pct_grid": [100.0, 99.0, 97.5, 96.5, 94.5, 92.5, 78.0], "a0a_donor_replicates_by_conc": a0a_reps_ok, "a0a_fit_artifact_receipt": a0a_fit_ok, }) a0b_donors = ["DON-A0B-1", "DON-A0B-2", "DON-A0B-3"] def _mk_a0b_raw_pair(pct_vals: Sequence[float], base_veh: float) -> dict[str, list[float]]: vehs = [round(base_veh * (1.0 + 0.02 * (i - 1)), 4) for i in range(len(pct_vals))] return {"treated": [round(vehs[i] * float(pct_vals[i]) / 100.0, 4) for i in range(len(pct_vals))], "vehicle": vehs} a0b_reps_ok = [ (lambda _vv, _evv, _d0l, _d0b, _d0n, _d4l, _d4b, _d4n, _s0, _s4: { "conc_uM": c_u, "donor_ids": a0b_donors, "matched_vehicle_record_id": f"A0B-VASC-VEH-{int(c_u)}UM", "efficacy_matched_vehicle_record_id": f"A0B-EFF-VEH-{int(c_u)}UM", "matched_vehicle_raw_baselines": { "viability_raw": 96.5, "efficacy_viability_raw": 97.0, "day0_sprout_length_um": 410.0, "day0_branching_junctions": 28.0, "day0_network_persistence_idx": 0.91, "day4_sprout_length_um": 395.0, "day4_branching_junctions": 26.5, "day4_network_persistence_idx": 0.89, }, "raw_donor_measurements": { "viability_14d": _mk_a0b_raw_pair(_vv, 96.5), "efficacy_culture_viability_14d": _mk_a0b_raw_pair(_evv, 97.0), "day0_sprout_length_14d": _mk_a0b_raw_pair(_d0l, 410.0), "day0_branching_14d": _mk_a0b_raw_pair(_d0b, 28.0), "day0_network_persistence_14d": _mk_a0b_raw_pair(_d0n, 0.91), "day4_sprout_length_14d": _mk_a0b_raw_pair(_d4l, 395.0), "day4_branching_14d": _mk_a0b_raw_pair(_d4b, 26.5), "day4_network_persistence_14d": _mk_a0b_raw_pair(_d4n, 0.89), }, "viability_14d_pct": _vv, "efficacy_culture_viability_14d_pct": _evv, "day0_sprout_length_14d_pct": _d0l, "day0_branching_14d_pct": _d0b, "day0_network_persistence_14d_pct": _d0n, "day4_sprout_length_14d_pct": _d4l, "day4_branching_14d_pct": _d4b, "day4_network_persistence_14d_pct": _d4n, "day0_sprouting_14d_pct": _s0, "day4_delayed_sprouting_14d_pct": _s4, })( [round(v + d, 2) for d in (-0.3, 0.0, 0.3)], [round(ev_v + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s0 + 0.4 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s0 + 0.2 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s0 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s4 + 0.4 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s4 + 0.2 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s4 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s0 + d, 2) for d in (-0.3, 0.0, 0.3)], [round(s4 + d, 2) for d in (-0.3, 0.0, 0.3)], ) for c_u, v, ev_v, s0, s4 in ( (0.0, 99.0, 99.2, 99.0, 99.5), (50.0, 97.5, 97.8, 96.5, 97.5), (100.0, 96.0, 96.4, 95.0, 96.0), (150.0, 95.0, 95.4, 94.0, 95.0), (190.0, 94.2, 94.6, 93.2, 94.0), (220.0, 93.0, 93.5, 91.8, 92.5), (240.0, 91.8, 92.2, 86.0, 88.0), (360.0, 82.0, 83.0, 72.0, 78.0), ) ] a0b_fit_ok = _sign_receipt({ "donor_ids": a0b_donors, "raw_replicates_sha256": sha256_bytes(canonical_json_bytes(a0b_reps_ok)), "cc10_free_14d_l95_uM": 240.0, "c_sprout_max_free_14d_l95_uM": 220.0, "day14_viability_pct": 94.0, "day14_sprouting_pct": 93.0, }) def _mk_pfd_3lots(clot: str, t_arr: Sequence[float], c_arr: Sequence[float], load_mg: float = 18.75) -> list[dict[str, Any]]: lot_names = [clot, f"{clot}-REP2", f"{clot}-REP3"] scales = [1.0, 0.99, 1.01] out_l: list[dict[str, Any]] = [] for lnm, sc in zip(lot_names, scales): b_l = { "coating_lot_id": lnm, "initial_pirfenidone_loading_mg": load_mg, "elution_time_hours": list(t_arr), "cumulative_intact_parent_released_mg": [round(x * sc, 4) for x in c_arr], } out_l.append({**b_l, "lot_trace_sha256": sha256_bytes(canonical_json_bytes(b_l))}) return out_l def _mk_pfd_tp_rows(pts: Sequence[tuple[float, float]], clot: str, tag_u: str = "PFD", deltas: Sequence[float] = (-0.35, 0.0, 0.35), single_lot_only: bool = False, active_lot_offset: float = 0.0) -> list[dict[str, Any]]: lot_names = [clot] if single_lot_only else [clot, f"{clot}-REP2", f"{clot}-REP3"] lot_shifts = [active_lot_offset] if single_lot_only else [active_lot_offset, -0.25, 0.25] rows_out: list[dict[str, Any]] = [] for hh, val in pts: urecs: list[dict[str, Any]] = [] ums: list[float] = [] ui = 0 for ln_i, lshift in zip(lot_names, lot_shifts): for d in deltas: ui += 1 um = round(val + (0.0 if all(x == 0.0 for x in deltas) else lshift) + d, 3) ums.append(um) urecs.append({ "coating_lot_id": ln_i, "independent_unit_id": f"{tag_u}-UNIT-{ui}", "specimen_id": f"{tag_u}-SPEC-{int(hh)}H-U{ui}", "technical_well_readings_uM": [round(um - 0.05, 3), um, round(um + 0.05, 3)], "unit_mean_uM": um, }) rows_out.append({ "hour_h": hh, "independent_unit_records": urecs, "free_parent_uM_replicates": ums, }) return rows_out a0b_tp_pts = ((6.0, 182.0), (24.0, 175.0), (72.0, 152.0), (144.0, 136.0), (216.0, 122.0), (288.0, 114.0), (336.0, 108.0)) a1_tp_pts = ((6.0, 178.0), (24.0, 170.0), (72.0, 148.0), (144.0, 132.0), (216.0, 118.0), (288.0, 108.0), (336.0, 100.0), (600.0, 22.0), (840.0, 3.2)) a0b_tp_ok = _mk_pfd_tp_rows(a0b_tp_pts, coat_a["coating_lot_id"], "A0B") a1_tp_ok = _mk_pfd_tp_rows(a1_tp_pts, coat_a["coating_lot_id"], "A1") def _mk_pfd_env(scope_s: str, comp_s: str, *, art_id: str = coat_a["coating_article_id"], lot_id: str = coat_a["coating_lot_id"], ke_a: float = 0.004, kr_a: float = 0.002, ke_w: float = 0.010) -> dict[str, Any]: # Dense pilot trace (1.0 h spacing <= 2.0 h cap) with observed slopes conservatively below declared bounds / 1.15! r_rise_p = min(kr_a / 1.25, 0.0015) r_elim_p = min(ke_a / 1.25, 0.0030) r_wash_p = min(ke_w / 1.25, 0.0080) bh_p = [0.5, 1.5, 2.5, 3.5, 4.5, 5.5] bc_p = [ round(180.0, 4), round(180.0 * math.exp(r_rise_p * 1.0), 4), round(180.0 * math.exp(r_rise_p * 2.0), 4), round(180.0 * math.exp(r_rise_p * 2.0 - r_elim_p * 1.0), 4), round(180.0 * math.exp(r_rise_p * 2.0 - r_elim_p * 2.0), 4), round(180.0 * math.exp(r_rise_p * 2.0 - r_elim_p * 3.0), 4), ] wh_p = [336.0, 337.0, 338.0, 339.0] wc_p = [round(100.0 * math.exp(-r_wash_p * float(k)), 4) for k in range(4)] dpt_body = { "pilot_coating_lot_id": f"{lot_id}-PILOT", "pilot_compartment_id": comp_s, "burst_segment_hours_h": bh_p, "burst_segment_free_parent_uM": bc_p, "washout_segment_hours_h": wh_p, "washout_segment_free_parent_uM": wc_p, } dpt_sha = sha256_bytes(canonical_json_bytes(dpt_body)) dpt_rec = {**dpt_body, "pilot_trace_sha256": dpt_sha} eb = { "k_elim_active_max_per_h": ke_a, "k_rise_active_max_per_h": kr_a, "k_elim_washout_max_per_h": ke_w, "coating_article_id": art_id, "evidence_scope": scope_s, "compartment_id": comp_s, "envelope_qualification_method": "DENSE_PILOT_TIMECOURSE_BOUND", "pilot_sampling_max_gap_h": 1.0, "burst_phase_covered": True, "washout_phase_covered": True, "source_study_ids": ["PFD-DENSE-PILOT-001", "PFD-WASHOUT-001"], "dense_pilot_trace": dpt_rec, "envelope_model_sha256": dpt_sha, } return {**eb, "envelope_receipt_sha256": sha256_bytes(canonical_json_bytes(eb))} a0b_env_ok = _mk_pfd_env("bench_unedited", "BENCH_LOCAL_PERI_GRAFT") a1b_env_ok = _mk_pfd_env("bench_unedited", "BENCH_ELUTION_LOCAL_PERI_GRAFT") a1e_env_ok = _mk_pfd_env("exact_product", "BENCH_ELUTION_LOCAL_PERI_GRAFT") a0b_mfu_ok = { "fibrosis_efficacy_assay": { "matrix_id": "human_macrophage_fibroblast_14d_media", "nominal_conc_uM_grid": [round(r["conc_uM"] / 0.42, 4) for r in a0b_reps_ok], "dialysis_fu_replicates": [0.415, 0.418, 0.420, 0.422, 0.425], "measured_fu_mean": 0.42, "analytical_sample_record_sha256": sha256_bytes(b"A0B-FIBROSIS-14D-FU-DIALYSIS-01"), }, "vascular_viability_assay": { "matrix_id": "human_iec_sprouting_14d_media", "nominal_conc_uM_grid": [round(r["conc_uM"] / 0.50, 4) for r in a0b_reps_ok], "dialysis_fu_replicates": [0.494, 0.497, 0.500, 0.503, 0.506], "measured_fu_mean": 0.50, "analytical_sample_record_sha256": sha256_bytes(b"A0B-VASCULAR-14D-FU-DIALYSIS-01"), }, } a0b_y = _sign_receipt({ "stage": "A-0b", "verdict": "PASS", "product_id": py, "bank_id": by, "lot_id": ly, "route_id": ry, "evidence_scope": "bench_unedited", "study_start_utc": "2026-07-02T09:00:00Z", "recorded_at_utc": "2026-07-20T09:00:00Z", "parent_receipt_sha256": a0a_ok["receipt_sha256"], **coat_a, "initial_pirfenidone_loading_mg": 18.75, "coating_thickness_um": 6.5, "day1_burst_pct": 9.6, "modeled_systemic_plasma_ug_ml": 0.16, "elution_time_hours": tr14_t, "cumulative_intact_parent_released_mg": tr14_m, "assumed_human_t_half_h": 3.0, "assumed_human_vd_l": 50.0, "worst_face_o2_mmhg": 44.0, "day14_viability_pct": 94.0, "day14_sprouting_pct": 93.0, "cc10_free_14d_l95_uM": 240.0, "c_sprout_max_free_14d_l95_uM": 220.0, "c_upper_provisional_14d_l95_uM": 220.0, "sustained_free_parent_lower_uM": 95.0, "peak_free_parent_u95_uM": 195.0, "day14_sustained_free_parent_u95_uM": 165.0, "added_coating_water_equiv_diff_path_um": 3.2, "water_equiv_diff_path_um": 24.0, "local_ph_min": 7.31, "local_ph_max": 7.39, "a0b_14d_safety_replicates_by_conc": a0b_reps_ok, "a0b_fit_artifact_receipt": a0b_fit_ok, "a0b_matrix_fu_by_assay": a0b_mfu_ok, "a0b_local_exposure_timepoints": a0b_tp_ok, "a0b_local_pk_envelope": a0b_env_ok, "a0b_local_ph_timepoints": [ {"hour_h": h_p, "coating_lot_id": coat_a["coating_lot_id"], "ph_min": 7.33, "ph_max": 7.38} for h_p in (24.0, 168.0, 336.0) ], "manufacturing_lot_release_records": _mk_pfd_3lots(coat_a["coating_lot_id"], tr14_t, tr14_m), }) a1b_y = _sign_receipt({ "stage": "A-1-BENCH", "verdict": "PASS", "product_id": py, "bank_id": by, "lot_id": ly, "route_id": ry, "evidence_scope": "bench_unedited", "elution_started_at_utc": "2026-07-21T10:00:00Z", "recorded_at_utc": "2026-08-26T10:00:00Z", "parent_receipt_sha256": a0b_y["receipt_sha256"], **coat_a, "initial_pirfenidone_loading_mg": 18.75, "day35_residual_parent_mg": 1.125, "day35_degradant_mass_mg": 0.0,