# Shifa One — Gap List (P0-T3)

> Spec items with **no existing equivalent** in the platform, tagged by implementation phase.
> Items marked *(ext)* are extensions of an existing asset (see [REUSE-MAP.md](REUSE-MAP.md)); unmarked items are net-new builds.

## Phase 1 — Platform Foundation

- Facility profile satellite: type enum, **hierarchy (parent, max depth 5)**, working hours, capacity, geo, modules_enabled *(ext of `business_locations`)*
- Department upgrades: code/type/parent/head/working-hours *(ext of `clc_departments`)*
- **Rooms** entity (per department, type enum, equipment, status, scheduling flag)
- User↔department assignment (m2m) + department data scope
- **License/credential tracking** + verification workflow + expiry alerts
- **Module registry catalog** (category, installable_per, dependencies) + **`module_instances`** (per business/location/department; enable/disable/soft-lock)
- Manifest `extra.medical` convention + retro-fit seeding for existing modules
- **Schema-driven per-module settings UI** (JSON settings on module_instance)
- **14 predefined medical roles** seeded per business
- **ABAC override layer** + **data scopes** (department/own/custom) + selective field-level gates
- **Business-type presets (10) + setup wizard** (choose type → confirm modules → install)

## Phase 2 — Shared Services

- Unified **`notify()` service** routing one event to in-app/email/SMS/WhatsApp *(wraps existing channels)*
- **In-app notification center** (read tracking, retention) *(ext of Laravel notifications)*
- Per-module **template registry** + per-tenant overrides *(ext of `notification_templates`)*
- Per-user channel/event **preferences, quiet hours, digests** (hourly/daily)
- **Document-type taxonomy** (system + custom categories)
- **Document versioning**
- **Dynamic watermarking** (viewer info on view/download/print)
- Document **access audit** at document layer (view/download/print) *(ext of `ss_access_logs`)*

## Phase 3 — Medical Core

- Patient identity extension fields (national_id, marital, nationality, language, …) *(ext)*
- **Structured allergies** (type/severity/verified) + **current medications** + insurance info tables *(ext)*
- **Patient merge + duplicate detection** (confidence scoring)
- Patient export (PDF; FHIR/HL7 backlog)
- Encounter upgrades: type (telemedicine/home_visit/day_care), priority, check-in/discharge times, **structured ICD-10 diagnosis table**, parent-encounter links *(ext)*
- Notes: **amendments/addenda, sign & lock, co-sign**, note types *(ext)*; voice-dictation hook (AiCore transcriber)
- Vitals: full standard set (**BP, SpO₂, pain score, glucose, GCS**) as first-class table with trends *(ext)*
- Rx: refills, PRN, substitution flags; **interaction-check hook point** *(ext)*
- **Unified orders entity** (lab/imaging/procedure/consultation) + event routing to fulfilling modules
- Scheduling: **schedule exceptions/breaks/overbooking**, **waitlist**, **queue management** *(ext)*
- **Referrals** (internal/external, tracking, letters)
- **Medical alerts registry** (allergy banners, critical values, fall risk, isolation, consent-missing) surfaced across screens

## Phase 4 — Outpatient Revenue Path

- **Insurance layer: payers, patient policies, price agreements, claims (submit→adjudicate→appeal), pre-auth, co-pay/deductible split**
- Auto **charge capture** (encounter/order/Rx → draft invoice lines) *(ext)*
- Payer-specific price lists *(ext of selling_price_groups)*
- Pharmacy dispense workflow screen + **stock deduction bridge** (medicine.product_id → ERP stock) *(ext)*
- **Drug-interaction engine** (optional module; rule tables + Rx/dispense hooks)
- Lab **test catalog** (panels, specimen requirements, TAT, price via product link) *(ext)*
- **Specimen entity** (barcode, collect/receive/reject chain) *(ext of worklist)*
- **Result validation workflow** (performed_by vs verified_by, preliminary/final/corrected) *(ext)*
- **Outreach management** (external referring providers, pickup, delivery)
- Lab QC (Levey-Jennings/Westgard) — *optional, non-blocking*
- E2E seeders for clinic/polyclinic/lab/pharmacy presets

## Phase 5 — Diagnostics & Specialties

- Radiology **report entity** (draft/preliminary/final/amended, critical-findings communication log), **modality worklist** *(ext)*; radiation-dose fields; teleradiology (backlog)
- Dental: notation systems, periodontal/endo/implant charting, **CDT treatment-plan builder** with cost/insurance preview *(ext)*
- Derma: **lesion entity + interactive body map**, photo comparison, PASI/EASI scoring templates *(ext)*
- Ophthalmology: full eye-exam entity, **glasses/contact-lens Rx**, glaucoma & DR tracking *(ext)*
- Diagnostic-center order-type plugins: ecg_echo, endoscopy, pulmonary_function, audiometry, vision_testing

## Phase 6 — Inpatient / Hospital

- **bed_management**: wards, beds, reservations, real-time board, cleaning/turnover
- **inpatient**: admissions, bed assignments, nursing care plans, **MAR**, fluid balance, discharge workflow (med reconciliation)
- **emergency**: er_visits (triage ESI/CTAS, dispositions, timing metrics), **ER tracking board**, order sets *(ext of EmergencyClinic profile)*
- **surgery**: surgical cases, OR scheduling board, WHO safety checklist, sponge counts, implant registry
- **icu**: ICU admissions (APACHE/SOFA), **hourly flowsheets**, ventilator weaning, dashboards
- **blood_bank**: donors, donations/screening, crossmatch, issue/transfusion + reaction workflow, blood inventory
- Mini-modules or registered stubs: ambulance, nicu, dialysis, mortuary (physiotherapy = extend existing)

## Phase 7 — Back Office

- Duty-roster UX (visual calendar, swap approval, conflict rules) *(ext of Essentials shifts)*
- Credential/license compliance dashboards *(shares Phase 1 tracking)*
- **Chart of accounts + journal-entry layer** with auto-postings from existing payment/payroll/purchase events *(ext of accounts)*
- GL / trial balance / P&L / balance sheet / cost centers / budgets

## Phase 8 — Patient Portal & Extras

- **Dependents (family) management** (portal owner ↔ multiple patients)
- Records release-to-portal flags + full records API (notes, results w/ ranges, vitals trends, downloads, temporary share)
- Online payment gateway integration
- **Secure messaging** (patient ↔ provider)
- **Telemedicine** (video join, chat, virtual waiting room; encounter type exists from Phase 3)
- Health tools: symptom checker (triage), medication reminders, wellness tracking, PHQ-9/GAD-7 questionnaires

## Explicit non-goals for now (backlog, register as stubs where preset requires)

DICOM viewer embedding · HL7/FHIR interfaces (export + REF messages) · biometric portal login · OCR external Rx · voice-call channel · demand forecasting (inventory/blood) · teleradiology network
