# PR: ClinicCore — shared medical engine + specialty plugins (Derma, Dental)

**Open at:** https://github.com/TPSEgypt/static-purchase-requisition/pull/new/feature/clinic-core
**Base:** `main`  **Compare:** `feature/clinic-core`

---

## What this does

Introduces **ClinicCore**, a shared human-medical engine so one patient profile (`= App\Contact`) is reused across many specialty clinics, with each specialty adding only its own fields/sheets/actions — replacing the previous clone-per-specialty approach (Vet/Derma/Dental were each ~60-table clones with isolated patients).

Mirrors the existing **LabCore** driver-registry pattern: `ClinicCore` owns the shared 90% (patient, doctors, appointments, prescriptions, pharmacy, exams, consents, reminders) + a data-driven `clc_specialties` registry (45 seeded) + a `SpecialtyDriverRegistry`. A specialty is either a **config-only row** (~43, run on the generic engine) or a **plugin** that registers a driver + a 1:1/1:many extension table + Blade fragments injected into the shared screens.

## ClinicCore commits in this PR (9)
- `cca4434` Phase 1: engine extracted from DermatologyClinic + specialty engine
- `bd6cf2a` Phase 1 polish: genericize inherited derma content
- `4f6378b` Phase 2a: **Dermatology** re-founded as a plugin (`derma_patient_profiles`)
- `aed0dbf` Phase 3: **Dental** plugin (tooth chart: `dental_tooth_findings`)
- `f2603e3` Phase 2b: retire old `drm_`/`dnt_` clones to thin plugins; drop 128 old tables
- `37ea6ae` + `4d4edd8` neutralize inherited derma/vet vocabulary
- `f4e5ba0` per-specialty exam sheets (specialty-scoped `clc_exam_templates`)
- `cde309e` interactive tooth-chart editing + appointment-screen specialty fragments

## ⚠️ Scope note
`main` does not yet contain the **LabCore / VetClinic (P1–P6) / VetAdmission (M1–M5) / Go agent** line that this branch was built on, so this PR's diff also includes those ~25 upstream commits. Review the 9 commits above for the ClinicCore change itself; the rest land via their own branch.

## Verification
- 97+ migrations clean on dev DB; both plugins proven end-to-end.
- **Browser-verified**: specialty selector (45) on the patient form toggles the correct driver fragment (Derma skin fields ↔ Dental dentition); save persists to the plugin extension table and the show page renders it; interactive tooth chart (click → pick → AJAX persist); dental appointment shows the tooth-chart card.

## Out of scope / follow-ups
Default exam sheets for the ~40 config-only specialties; specialty-scoped permissions; patient-list specialty filter. The pre-existing `route:list`/`PaymentAccountController` breakage is unrelated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
