---
title: "2026-08-31 ve2e ISUP inference package refactor"
description: "Split reusable ISUP inference primitives into a small package and removed the unrelated legacy csPCa runner."
image: "https://docs.virdx.dev/img/virdx-social-card.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.virdx.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 2026-08-31 ve2e ISUP inference package refactor

## Work Done

- Completed the non-training vxData ISUP benchmark implementation and full-cohort validation using the canonical model, preprocessing, forward, and classification-metric paths.
- Kept benchmark policy in `scripts/benchmarking/benchmark_isup.py`, including unbiased study eligibility, separate biopsy/RPE QWK, PHI-safe reporting, and private JSON output.
- Refactored the 419-line `src/ve2e/inference.py` monolith into focused checkpoint and classification modules under `src/ve2e/inference/`.
- Split the temporary legacy checkpoint adapter into checkpoint, config, and DinoFlex mapping modules under `src/ve2e/inference/legacy/`.
- Used calldiff trees and reachability reports to verify that the benchmark reaches the new checkpoint loader and canonical classification iterator.
- Removed the unrelated legacy csPCa Hydra workflow and its orphan `configs/inference.yaml` after confirming that preserving it obscured the ISUP-focused package boundary.
- Kept every inference package file below 250 lines and every function at cyclomatic complexity 8 or lower.
- Validated locally with Ruff, formatting, compilation, mocked benchmark orchestration, legacy-config mapping, secure JSON checks, and `git diff --check`. The Linux-only Pixi environment could not run on the macOS host.
- Appended and normally pushed commit `36a6db51` to `feat/isup-inference`. No PR was created.

## Lessons Learned: Pitfalls

- Mechanically preserving the old csPCa Hydra entrypoint created code unrelated to the ISUP goal. It also made the new package look like another end-to-end inference application rather than reusable primitives.
- A correctness-only review reported no regression but did not question whether the preserved workflow belonged in scope. Boundary reviews must check product intent, not only behavior parity.
- The project Pixi environments are Linux-only, so macOS validation is limited to host tooling and dependency-mocked tests.

## Lessons Learned: Improvements

- For focused inference refactors, first classify old code as required primitive, required caller, or obsolete workflow. Delete obsolete workflows instead of preserving them by default.
- State the intended package API before moving code. For this package it is checkpoint loading, inference datamodule construction, classification iteration, and isolated legacy checkpoint translation only.
- Add a documented Linux-independent static validation command for contributors on macOS.

Source: https://docs.virdx.dev/knowledge/inbox/2026-08-31-clinical-ve2e-isup-inference-package-refactor/index.mdx
