# Phase 10.13 — Doctors Legacy Parity Contract

## Scope
Phase 10.13 recovers and verifies the dispatcher-confirmed doctor functions:

- `get_doc_rev` — doctor revenue top-N ranking.
- `total_op_visits` — annual outpatient visit total across doctors.
- `total_admission` — annual inpatient/admission total across doctors.

The source contract identified by the legacy inventory is `KPI_DOCTOR_PERF_DETAIL_JOB`.

## Comparison periods
The annual doctor KPI source is keyed by `YEARID`. The live gate therefore checks each function independently for:

1. Current year.
2. Comparison year.

This produces **6 exact runtime parity checks**.

## Ranking contract
`get_doc_rev` compares both:

- doctor identity at every top-N rank;
- `TOT_REV` value at every top-N rank.

Any identity mismatch or non-zero value difference fails the gate.

## Total contracts
- `total_op_visits` uses doctor-level `TOTAL_OP_VISITS` values.
- `total_admission` uses doctor-level `TOTAL_INPAT_VISITS` values.

Doctor-level values are deduplicated before final aggregation to preserve the established dashboard doctor KPI contract.

## Explicit non-claim
The finance functions `moh_revn`, `drug_rev`, and `net_rev` are **not** closed in Phase 10.13. They remain reserved for Phase 10.15 — Specialty Finance Recovery.

## Read-only rule
All Phase 10.13 parity execution is SELECT-only. Oracle writes: `NONE`.
