---
title: "2026-09-01 inverse ve2e PI CAI direct data review"
description: "Reviewed direct vxData-to-PI-CAI preprocessing against the canonical dataset path and found integration, ordering, provenance, and upsampling gaps."
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-09-01 inverse ve2e PI CAI direct data review

## Work Done

- Performed a read-only fresh-context review of the uncommitted `data_alt.py` direct PI-CAI data path and public `preprocess_volumes` rename in `virdx/ve2e`.
- Compared the draft with the active `data.py`, `VxProsDataModule`, `VxprosDataset`, pipeline table builders and schemas, vxData SDK 1.4.2 materialization, and local PI-CAI schemas.
- Confirmed that the direct implementation reproduces canonical NIfTI resample, crop, pad, normalization, transpose, and mask handling and internally removes fake split routing, CSV, config copying, Lightning, DataLoader, and shuffle.
- Found that `PICAIInference` still imports the old path, the returned batch loses patient identity and input ordering, non-RPE ectomy provenance is mislabeled as biopsy, configured dataset upsampling is omitted, and schema-free empty pipeline frames can fail before the intended domain validation.
- Reported severity-ranked findings and exact fixes to the parent agent. Made no changes to the `ve2e` checkout.

## Lessons Learned: Pitfalls

- A cleaner alternative module does not simplify production behavior until the active model import is replaced; checking call sites is necessary before crediting architectural removal.
- `preprocess_volumes` is the canonical native-volume transform but not the entire `VxprosDataset` input transform because `BaseVxprosDataset.__getitem__` can apply configured in-plane upsampling afterward.
- Internally aligned arrays are insufficient for a patient-ID API when pipeline eligibility can drop rows and the output schema carries no identifiers.
- The clinical pipeline's `isup_source` is a specimen type, not an already-normalized PI-CAI provenance enum; values include RPE, BIOPSY, RESECTION, TURP, and EXCISION.

## Lessons Learned: Improvements

- Add an inverse SOP defining the complete canonical clinical inference transform, including post-preprocessing upsampling and output geometry.
- Define whether vxData sample generation is strict one-requested-patient-to-one-returned-case or a partial eligible-cohort operation; in either case, preserve patient and study identifiers and deterministic order in the returned contract.
- Document the allowed mapping from vxData pathology specimen types to PI-CAI label provenance and reject unsupported types rather than coercing them.
- Require schemaful empty DataFrames from pipeline steps so downstream table builders can produce stable domain errors for empty cohorts.

Source: https://docs.virdx.dev/knowledge/inbox/2026-09-01-inverse-ve2e-picai-direct-data-review/index.mdx
