# H11.0-P9 — Legacy Batch B Source Contract

## Batch scope

This batch proves the final two unresolved PARTIAL historical monthly diagnostic functions:

- `plts` → `get_lab_tests`
- `prts` → `get_rad_tests`

The recovered historical dispatcher calls each function once. Each historical function then runs
the same Oracle SQL independently against NJCH, JCKH, and MNH and emits one composite
three-branch monthly dataset.

Because JCKH remains formally `DEFERRED_NOT_READY`, H11.0-P9 proves exact parity for the
READY branches NJCH + MNH and keeps both functions at `PARTIAL_DEFERRED_BRANCH`.

## plts — Monthly laboratory tests

Historical function: `get_lab_tests`

Oracle sources:

- `RCP_LAB_SERVICE_RESERVATION`
- `SEC_LOOKUP_DETAIL`

Exact historical rules:

- date field: `RCP_LAB_SERVICE_RESERVATION.EXPECTEDDONEDATE`
- historical eligibility cutoff: `EXPECTEDDONEDATE <= SYSDATE`
- year mode: `EXTRACT(YEAR FROM EXPECTEDDONEDATE) = selected year`
- range mode: inclusive from/to bounds
- monthly grouping by the month number of `EXPECTEDDONEDATE`
- 12-month completion through `SEC_LOOKUP_DETAIL WHERE PARENT_ID = 1`

## prts — Monthly radiology tests

Historical function: `get_rad_tests`

Oracle sources:

- `RCP_RAD_SERVICE_RESERVATION`
- `SEC_LOOKUP_DETAIL`

Exact historical rules:

- date field: `RCP_RAD_SERVICE_RESERVATION.MACHINE_SCH_FROM`
- historical eligibility cutoff: `MACHINE_SCH_FROM <= SYSDATE`
- year mode: `EXTRACT(YEAR FROM MACHINE_SCH_FROM) = selected year`
- range mode: inclusive from/to bounds
- monthly grouping by the month number of `MACHINE_SCH_FROM`
- 12-month completion through `SEC_LOOKUP_DETAIL WHERE PARENT_ID = 1`

## Independent implementation paths

Current path:

- `DiagnosticsRepository::monthlyLabTests`
- `DiagnosticsRepository::monthlyRadiologyTests`

Independent historical path:

- `LegacyDiagnosticsRepository::monthlyLabTests`
- `LegacyDiagnosticsRepository::monthlyRadiologyTests`

The historical repository does not call `DiagnosticsRepository`.

## Live acceptance matrix

- Functions: 2
- READY branches: 2
- Modes: 2 (`year`, `range`)
- Dataset checks: 8
- Checks per dataset: 24 values (12 months × current/comparison series)
- Total exact value checks: 192
- Exact values per function: 96
- Identity mismatches required: 0
- Maximum difference required: 0
- Oracle writes: NONE

## Promotion policy

A full PASS proves:

- `plts` → `PARTIAL_DEFERRED_BRANCH`
- `prts` → `PARTIAL_DEFERRED_BRANCH`

No MATCHED promotion is allowed while JCKH remains deferred because these historical
functions are inherently three-branch composite outputs.

## Legacy progress after PASS

Official Legacy progress remains:

- Known: 31
- MATCHED: 23
- PARTIAL: 6
- MISSING: 2
- Progress: 74.2%

However, proof depth becomes complete for the current deferred scope:

- `gmov` → exact READY-scope proof
- `padm` → exact READY-scope proof
- `perv` → exact READY-scope proof
- `popr` → exact READY-scope proof
- `plts` → exact READY-scope proof
- `prts` → exact READY-scope proof

Therefore, after PASS, all 6 of 6 PARTIAL functions have exact READY-scope proof, and none
remain unproven within the current NJCH + MNH scope.
