# Phase 10.10 — Patient Activity Legacy Functional Parity

## Baseline

- Required baseline: `10.9.2.2`
- Target release: `10.10.0`
- Patch ID: `H10.10`

## Objective

Move the Patient Activity workspace from "implemented but parity open" to a verified selected-branch legacy parity implementation while improving executive readability and preserving all previously approved Revenue gates.

## Included legacy contracts

- `gmov_s` — Monthly outpatient visits.
- `perv_s` — Monthly emergency visits.
- `padm_s` — Monthly admissions.
- `vfr` — New vs Follow-up ratio.

The legacy three-branch composite functions `gmov`, `perv`, and `padm` deliberately remain `PARTIAL`; Phase 10.10 does not misrepresent them as complete.

## User-visible improvements

- Year comparison and custom date-range modes.
- Current period, comparison period, report mode, and branch shown clearly.
- Executive body typography aligned with the approved 16 px / 17 px Arabic standard.
- Technical error detail removed from the executive UI.
- Data-driven executive insight for the most material movement change.
- Three primary monthly charts with explicit render/empty/error states.
- Monthly table includes current and comparison values for OPD, ER, and Admissions.

## New components

- `app/Repositories/LegacyPatientActivityRepository.php`
- `app/Services/PatientActivityParityService.php`
- `public/assets/css/patient-activity-executive-parity.css`
- `public/phase10-10-patient-activity-parity-qa.php`

## Modified components

- `app/Repositories/VisitsRepository.php`
- `app/Controllers/OperationsController.php`
- `app/Services/ChartDataService.php`
- `app/Views/operations/module.php`
- `app/Views/layouts/main.php`
- `config/i18n.php`
- Legacy inventory maps.

## QA contract

- 8 Patient Activity runtime parity checks.
- Exact count difference = 0.
- 3/3 Patient Activity charts rendered in a real headless browser.
- Revenue parity regression remains 10/10 PASS.
- Revenue chart browser regression remains 5/5 PASS.
- No Oracle writes.

## Patch safety

- Semantic baseline guard: release + stable capabilities, not fragile exact source markers for files being replaced.
- Pre-apply backup.
- Post-apply payload SHA-256 verification.
- Automatic restore when post-apply validation fails.
