# H11.0-P4 — GMOV Legacy Source Contract

## Legacy dispatcher key
`gmov`

## Legacy function
`get_monthly_outpatient_visits`

## Source status
`FULL_HISTORICAL_FUNCTION_BODY_RECOVERED`

## Exact historical behavior

The old function executes the same monthly outpatient reservation query against:

- `njch` — New Jeddah
- `jckh` — Jeddah
- `mnh` — Madina

It returns 12 monthly rows with three branch values.

## Oracle sources

- `RCP_VISIT`
- `RCP_SERVICE_RESERVATION`
- `SEC_LOOKUP_DETAIL`

## Exact business rules

- `RCP_VISIT.CLASSCODE = 2`
- No emergency exclusion is applied in the legacy `gmov` function.
- `RCP_SERVICE_RESERVATION.SERVSTATUS NOT IN ('C','F')`
- `RCP_SERVICE_RESERVATION.SCHED_SERIAL IS NOT NULL`
- Year mode filters `EXPECTeddonedate` by year.
- Date-range mode filters the inclusive selected calendar-day range.

## Acceptance

The function may move from PARTIAL to MATCHED only when:

- year mode: 36 branch-month values match exactly,
- date-range mode: 36 branch-month values match exactly,
- `max_difference = 0`,
- `write_operations = NONE`,
- all prior regression gates remain PASS.
