# Proposal P-PLATFORM-FIRST — "HIS as a Thin Clinical Platform, OBGY as the First Plug-in Specialty"

Competing proposal to the architecture review board — senior solution architect submission, 2026-06-11.

Stance: **`Modules/HIS` is a thin, specialty-agnostic clinical platform** (MPI bridge, Encounter, Folio,
orders hub, forms engine, scheduling/queue, beds/ADT). **`Modules/Obgy` is a specialty clinical-content
module that plugs into HIS encounters** — its simple sheets become forms-engine content, its complex
sheets (IVF cycles, pregnancies) become dedicated `obgy_*` tables FK-ing into `his_encounters`.

All claims below trace to the evidence pack (`md/01`–`md/09`), `/home/moonui/hms-phase0-spec.md`,
`/home/moonui/public_html/hms-feasibility-report.html`, and `/home/amrtechogate/public_html/obgy-erp-analysis.md`.

---

## 1. Thesis

This is the only architecture that simultaneously satisfies **every binding decision already approved**
(D1 lab_patients-in-place MPI, D2 one-module HIS with forward-only imports, D3 CreateLabRequest
service-performer contract, D4 Encounter/Folio deferred-but-approved, D5 LIS untouchable) **and** the
commercial requirement of license-separable tiers (Moon Clinic must sell without 85 OB/GYN tables;
an IVF center must not pay for ADT/beds). The OBGY analysis itself takes this side: blueprint §95 2.6
designs `Encounter`, `OperativeNote`, `SurgicalBooking`, `Hospital`, `incision_types` and the queue
service *module-agnostic "so the HMS module can consume them"*, and §95 2.1–2.5 delegate patient,
lab, drugs and money to ERP/LIS/Inventory/Accounting — leaving OBGY, by its own blueprint, a thin
specialty clinical layer. We are not inventing the split; we are executing the split the evidence
already drew.

Three facts make any "OBGY-as-core" alternative untenable and any "everything-inside-HIS" alternative
commercially weaker:

1. **OBGY has no Encounter.** §90.1: no clinical table references `visits`; the single most
   HIS-critical entity must be designed new either way. The platform's spine cannot come from a
   system that lacks the spine.
2. **Zero OBGY code is portable** (PHP 5.6 EOL, system-wide SQLi, no FKs, rule R12 "no legacy
   endpoint ported"). The rewrite cost is identical under every architecture — so architecture
   should be chosen on ownership and salability, where platform-first wins.
3. **~48% of OBGY's 312 tables are women's-health-only content** (ANC, IVF, andrology, gyn US,
   endoscopy, infertility). A general-hospital core that is half specialty content is unsellable as
   Tier-2 "Moon Clinic" and unmaintainable as a platform.

LIS is the proof the pattern works: a 137-migration, 66-model clinical vertical living as a
self-contained module on platform rails (BaseModel tenancy/audit, DataScope, PermissionDependencyRegistry,
SequenceService, `CreateJournalEntry`-only accounting). `Modules/Obgy` becomes the second instance of
that proven recipe — with HIS supplying the clinical primitives LIS never needed.

---

## 2. Module layout (exact nwidart modules and key tables)

### 2.1 `Modules/HIS` — the thin clinical platform (ONE module per settled D2; internal split by folders)

Internal domain folders (folders, not modules — D2 explicitly rejects premature module splitting):
`Mpi/`, `Scheduling/`, `Encounter/`, `Folio/`, `Orders/`, `Forms/`, `Adt/`, `Surgery/`.

| Domain | Key tables | Provenance |
|---|---|---|
| MPI bridge | *(no new patient table — D1)* `his_patient_spouses` (1:1 → `lab_patients`, replaces OBGY couple-in-one-row), `his_referrals`, `his_hospitals` | spec W2-1 item 7 (`scopeInternal()`), obgy §95 1.1, A5 |
| Scheduling/queue | `his_appointments`, `his_visit_periods` (slot capacity `max_no`, DB-transaction enforced), `his_clinic_closures` | OBGY A1 (`visits` booking half, `visit_periods`, `vacations`) — fills the 1/10 appointments gap |
| Encounter | `his_encounters` (encounter_number via SequenceService; `patient_id`→`lab_patients` internal; `type` opd/ipd/er/daycase; `status` FHIR subset; `attending_doctor_id`→`lab_doctors`; `parent_encounter_id`; `queue_position` replacing OBGY's `visitorder`/`enterordered`/`view` triple), `his_encounter_diagnoses` | D4 approved design; DDL per `md/08-data-spine.md` §2.2 |
| Folio/billing | `his_folios` (payer_type self_pay/insurance/b2b_account; decimal(12,3)), `his_folio_charges` (morph `source_type`/`source_id` + `UNIQUE(source_type, source_id)` — a clinical act bills exactly once; `service_code` per SBS/`sbscs_code` pattern; `unit_cost`+`cost_center_id` COGS fields), `his_folio_payments`, `his_deposits` (receipt-voucher + FIFO precedents) | D4; PostLabInvoice generalization (Generalization Register, spec line 96) |
| Orders hub (CPOE shape) | `his_prescriptions` + `his_prescription_items` (morph `prescribable`, `subject` enum patient/spouse — collapses OBGY's 10 `*drugs` clones), `his_service_orders` + `his_service_order_items` (morph `orderable` — collapses 8 `*invest` clones; lab items delegate to `CreateLabRequest`) | OBGY A2 — 4 generic tables replace 18 |
| Forms engine | `his_form_templates`, `his_form_sections`, `his_form_fields` (typed: text/number/lookup/diagram), `his_form_responses`, `his_form_response_values`, `his_lookups` (`domain`, `parent_id`, `title_ar`, `title_en`, `sort`) — generalization of OBGY's `presenthistoryquestions`/`presenthistoryanswers`/`gynaph` Q&A engine + the ~190-list lookup engine | OBGY A3, A8 |
| Clinical exam | `his_clinical_exams` (typed vitals), `his_exam_findings` (`body_system` enum, lookup-or-free-text) | OBGY A4 |
| ADT/beds (Phase 2) | `his_wards`, `his_rooms`, `his_beds`, `his_bed_assignments`, `his_encounter_movements` (admit/transfer/discharge) | net-new (0–1/10 today) |
| Surgery (platform-level per §95 2.6) | `his_surgical_bookings`, `his_operative_notes`, `his_operative_note_staff` (role enum), `his_anesthesia_types`, `his_incision_types` (self-referencing) | OBGY A5 — blueprint designed these module-agnostic for HMS |
| Media | spatie medialibrary + `his_annotated_diagrams`, `his_diagram_markers` (relative coordinates) | OBGY A7 |

### 2.2 `Modules/Obgy` — the specialty plug-in (bucket B only)

Two mechanisms, by sheet complexity:

- **Simple/configurable sheets → forms-engine content, not tables.** Present-history Q&A,
  per-body-system exam options, instruction templates, most of the ~190 curated vocabularies seed
  `his_lookups` under `obgy.*` domains and `his_form_templates` rows. Shipped as Obgy seeders
  (production export mandatory first — risk R7: dump lists are empty).
- **Complex structured sheets → dedicated `obgy_*` tables**, every header FK-ing
  `encounter_id → his_encounters` and `patient_id → lab_patients`:

| Asset | Tables |
|---|---|
| Pregnancy/ANC (3-generation merge) | `obgy_pregnancies` (merge by patient+LMP), `obgy_antenatal_visits` (GA computed accessor), `obgy_antenatal_ultrasounds`, `obgy_pregnancy_losses`, `obgy_delivery_registrations`, `obgy_4d_scan_bookings` |
| IVF/ICSI/IUI | `obgy_ivf_cycles` (one active per patient via partial unique index), `obgy_ivf_cycle_visits`, `obgy_follicle_measurements` (replaces the 26-column `ovst` grid), `obgy_oocyte_retrievals`, `obgy_embryo_transfers`, `obgy_cryopreservations`, `obgy_endometrial_preps`, `obgy_cycle_outcomes` |
| Andrology | `obgy_semen_analyses` (WHO flags), `obgy_hormone_results` + `obgy_hormone_definitions` (links to LIS) |
| Imaging | `obgy_imaging_studies` (unified header, study_type), `obgy_fetal_scan_findings`, `obgy_gyna_scan_findings` (+ follicle grid) |
| Endoscopy | `obgy_endoscopy_procedures` (kind enum), `obgy_endoscopy_findings`, `obgy_endoscopy_terms` |
| Gyn/infertility | `obgy_gyna_sheets`, `obgy_infertility_files` (replaces the 17-table `infertilitysheet` hub) |
| Specialty history | `obgy_menstrual_histories`, `obgy_obstetric_histories` + `obgy_obstetric_babies`, `obgy_contraception_histories`, `obgy_past_art_cycles` |
| LIS bridge | `obgy_lis_test_map` (276 legacy `invests` → LIS catalog; unmapped created in LIS) |

### 2.3 What does NOT exist

- No `Modules/Patients`, no `Modules/Appointments`, no `Modules/Bedding` (D2 rejected splitting).
- No new patient table, ever (D1).
- No Obgy billing, no Obgy drug catalog, no Obgy staff tables — Folio/ChargePosting, Core item
  master + Inventory `StockService`, and HRM `employees` respectively.

---

## 3. Role of OBGY assets — exact

OBGY contributes **four things and only four things**:

1. **Pattern donor for the HIS core (bucket A, ~32%).** The encounter/queue model, visit-period
   capacity, the sheet→prescription/order morph consolidation (18 clones → 4 tables), the Q&A
   engine that becomes the forms engine, per-body-system examination, surgical waiting-list +
   operative note, follow-up card, annotated-diagram media, and the lookup-engine shape. These are
   *designs distilled from ~10 years of production use* — they de-risk exactly the platform's two
   weakest scores (appointments 1/10, encounter 0/10). They enter HIS as **new Laravel-12 designs**,
   never as ported code (rule R12).
2. **First specialty content (bucket B, ~48%)** inside `Modules/Obgy`: forms templates + the
   dedicated `obgy_*` tables above, plus the production-only curated vocabularies (~190 lists)
   seeded into `his_lookups`.
3. **First pilot tenant + ETL rehearsal.** The legacy clinic has a forced security motive to migrate
   (confirmed SQLi, open mobile API, web-accessible dumps — immediate remediation on the legacy box
   regardless). Its production DB is the mandatory ETL target: `patients` → `lab_patients` internal
   rows (`statusno`→`mrn`, NID→`national_id` reusing NPHIES' `national_id_type`), husband data →
   `his_patient_spouses`, `visits` split (booking/queue half → `his_encounters`; rows with
   `detectionid IN (−99, 999, 9999)` are payments → folio transactions, never encounters), clinical
   rows attached via the patient+date heuristic matcher (risk R2).
4. **Domain validation of HIS P1.** OBGY's outpatient-only nature proves the P1 outpatient tier has
   standalone sellable value; it contributes nothing to P2 hoteling and therefore must not gate it.

OBGY is explicitly **not**: the MPI (couple-in-one-row, MAX+1 file numbers, zero FKs), the encounter
model (conflates appointment+encounter+payments with magic `detectionid` codes), the billing layer
(its own cURL `erpSellbill`/`client.obygyPatientId` hacks are natively replaced by
`partner_id`+`AccBpExt`+`CreateJournalEntry`), or a code source (R12).

---

## 4. Dependency graph and rules

```
                Core ◄── everything (BaseModel, DataScope, PermissionDependencyRegistry,
                          SequenceService, SettingsService, Attachments, BusinessPartner)
                  ▲
   Accounting ◄── HIS ──► LIS (forward: CreateLabRequest action)
        ▲          ▲ ▲──► HRM (employees), Inventory (StockService), NPHIES (claims)
        │          │
        │        Obgy ──► LIS (obgy_lis_test_map, lab catalogs — forward, read/order only)
        └──(JE action)
   Events backward only:  LIS ──events──► HIS │ Obgy     HIS ──events──► Obgy
```

Rules (numbered, enforceable in review):

1. **HIS imports Core, LIS, Accounting, HRM, Inventory, NPHIES — forward, via Actions/Services**
   (settled D2). LIS never imports HIS; LIS→HIS information flows only via the existing events
   `LabResultReleased` / `LabRequestCompleted` / `CriticalResultDetected`.
2. **Obgy imports HIS, Core, LIS — forward. HIS never imports Obgy.** This is D2's golden rule
   applied one level up, and it is what keeps Tier-2 "Moon Clinic" sellable without OBGY and the
   Obgy license key meaningful. No other module may import Obgy.
3. **HIS extension points are registries, not imports** — exactly the mechanism W1-4 builds:
   Obgy registers `ObgyPermissionDependencies` via `PermissionDependencyRegistry::register('obgy', …)`
   in `ObgyServiceProvider` boot (the LIS precedent at `LISServiceProvider`), registers its encounter
   tabs/sheet types in a HIS `EncounterContentRegistry` (same pattern), and posts charges through the
   `his_folio_charges` morph. HIS code never names a specialty.
4. **All GL posting funnels through `Modules\Accounting\Actions\CreateJournalEntry`** (the only
   accounting entry point), called by a Core `ChargePostingService` parameterized by settings prefix
   (`his.*`), extracted from `PostLabInvoice` per the approved Generalization Register. Obgy never
   posts GL directly.
5. **D5 stands for both modules:** LIS untouched in performance and behavior; zero added hot-path
   queries; BE+FE ship together; acceptance gate = suites green + before/after curl timing on
   worklist + reception; regression reverts the item.
6. **Anti-double-posting:** lab invoices enter the folio **by reference only** (D4);
   `UNIQUE(source_type, source_id)` on `his_folio_charges` makes single-posting a DB constraint.
7. Because nwidart does not enforce inter-module dependencies (known platform gap, Risk register #6),
   rules 1–4 are enforced by CI grep gates on `use Modules\\Obgy` outside `Modules/Obgy` and
   `use Modules\\HIS` inside `Modules/LIS`.

---

## 5. Event / FK contracts (real names)

### Existing (consumed, zero LIS change)

| Contract | Detail |
|---|---|
| `LabResultReleased`, `LabRequestCompleted`, `CriticalResultDetected` | `Modules/LIS/app/Events/`; HIS listener attaches results to the encounter; Obgy listener renders results inside clinical sheets via `obgy_lis_test_map`; critical alerts feed the HIS physician inbox |
| `lab_requests.encounter_id` | inert column (2026_06_10_160000) gets its FK → `his_encounters.id` at HIS kickoff (W1-3 plan) |
| `Modules/LIS/app/Actions/CreateLabRequest` | HIS/Obgy order labs by calling it with `encounter_id` and `source=in_patient` (enum exists since day 1); pricing, invoice, insurance, sequence numbering come free (D3 — declared template for radiology and all performers) |
| `lab_doctors.employee_id → employees.user_id` | W1-2 chain; `his_encounters.attending_doctor_id → lab_doctors` resolves clinician → HR → login identity |
| `lab_patients` named scopes | HIS/Obgy consume `LabPatient::internal()` only; B2B isolation by `external_lab_id` + `UNIQUE(company_id, ext_scope_key, national_id)` (W2-1) |
| `BusinessPartnerCreated → CreatePartnerAccounts` | AR sub-accounts auto-provisioned via `AccBpExt.ar_account_id` — replaces OBGY's cURL client sync |
| NPHIES | claim columns on the invoice (per `lab_invoices` 2026_04_03_000001 pattern) + `NphiesClaimService::submit()` → `nphies_transactions`; `FhirPatientBuilder` input generalized from `LabPatient` to the shared patient (budgeted task) |

### New in `Modules/HIS` (proposal)

| Event | Payload | Consumers |
|---|---|---|
| `EncounterOpened` / `EncounterClosed` | encounter_id, patient_id, type | Obgy (open sheet context), notifications |
| `PatientAdmitted` / `PatientTransferred` / `PatientDischarged` (P2) | encounter_id, bed ids | folio nightly bed-day job, nursing station |
| `FolioChargePosted` | folio_id, source_type, source_id, total | folio running totals; future revenue dashboards |
| `FolioClosed` | folio_id, payer split | payer-split invoice generation → `ChargePostingService` → `CreateJournalEntry(source_type='his_invoice')` |
| `AppointmentBooked` / `AppointmentCheckedIn` | appointment_id, encounter_id | queue screen, portal notifications |

### New in `Modules/Obgy` (proposal)

| Event | Payload | Consumers |
|---|---|---|
| `PregnancyOpened` / `PregnancyClosed` | pregnancy_id, outcome | HIS patient-360 timeline |
| `IvfCycleStageCompleted` | cycle_id, stage | HIS worklists, notifications |
| `PrescriptionDispenseRequested` | prescription_id | Inventory `StockService::decreaseStock` (movement_type `issue`, reference = prescription) per blueprint §2.3 |

Obgy never emits financial events — it posts `his_folio_charges` rows (`source_type='obgy_service'`,
`'obgy_imaging_study'`, …) and HIS owns the money from there.

---

## 6. Angular frontend organization

Follows the proven three-context LIS pattern (`md/04-frontend.md`):

- **`features/his/`** — standalone components, embedded at `/core/his/*` under MainLayout with
  `data: { permissions: ['his.'] }`; registered in module-activation so `moduleGuard` gates it.
  Plus a fullscreen clinic workspace `/clinic/*` with `HisLayoutComponent`, mirroring
  `lis-standalone.routes.ts` / `/lab/*` (app-in-app proven 3×: POS/HR/Lab).
- **`features/obgy/`** — embedded `/core/obgy/*` with `data: { permissions: ['obgy.'] }`; its
  screens mount **inside** the HIS encounter workspace as routed tabs contributed via a route-config
  registry (the FE twin of `EncounterContentRegistry`), so a Clinic-only license simply never loads
  the Obgy chunks (lazy `loadComponent` everywhere).
- **Services:** `core/services/his-*.service.ts`, `core/services/obgy-*.service.ts` —
  `providedIn:'root'`, `listAll()` forkJoin pagination, `X-Authorization` interceptor, unchanged.
- **Reuse, not rebuild:** clinic queues implement the server-driven worklist contract
  (`lis-worklist.service.ts` `WorklistCard`/`WorklistRow` + `USE_SERVER_WORKLIST`); the booking flow
  clones `request-wizard-v2` (patient → services → billing → payment); LIS lab ordering opens the
  existing wizard in embedded Dialog mode (D3 FE clause); clinical reports (antenatal record,
  ultrasound, operative note) clone `lis-html-report.service.ts` / `lis-report-pdf.service.ts`
  configurable-header engines; patient-facing released reports ride the `/p/:token` portal pattern.
- **Forms engine FE:** one dynamic-form renderer component in `features/his/forms/` consumes
  `his_form_templates`; Obgy sheets that are forms content need **zero new components**.
- **i18n:** `HIS` and `OBGY` UPPER_SNAKE namespaces in `en.json`/`ar.json`, English-first,
  RTL handled by `LanguageService`.
- **License/tier note:** server-side module gating is FE-only today (`auth.guard.ts:162`) — W2-2
  log-only middleware then enforcement is a hard prerequisite for selling Obgy as a priced key.

---

## 7. Migration & build phases (S ≈ ≤1 wk, M ≈ 2–4 wk, L ≈ 5–10 wk; one team unless noted)

| # | Phase | Content | Size |
|---|---|---|---|
| 0 | **Phase-0 readiness** (approved, not started — hard gate) | W1-1 DataScope hoist, W1-2 `employee_id`, W1-3 `CreateLabRequest` + `encounter_id`, W1-4 PermissionDependencyRegistry, W2-1 B2B hardening + `internal()` scopes, W2-2 gating log-only | **S** (~7–10 dev-days) |
| 0b | **Legacy OBGY remediation** (parallel, ops not dev) | Patch/firewall SQLi entry points, kill `mobileservices.php`, remove web-accessible dumps; **fresh production export** of `gynaph`, `sefo`, all lookup content (R7) | **S** |
| 1 | **HIS P1 — outpatient platform** | `Modules/HIS` scaffold + `his.*` permission registry; `his_encounters`/`his_appointments`/`his_visit_periods`/queue; FK `lab_requests.encounter_id`; Folio + `ChargePostingService` extraction (`lis.*`→`his.*`) + deposits; embedded LIS ordering; price-list/insurance generalization (largest register item); FE `/core/his` + `/clinic` workspace + appointments engine (biggest FE build) | **L** (8–14 pw, matches approved roadmap) |
| 1b | **Forms engine + lookup engine** (inside HIS P1, sequenced last so it is extracted against real Obgy templates) | `his_form_*`, `his_lookups`, dynamic-form FE renderer, seeding pipeline | **M** |
| 2 | **Obgy P1 — module + identity ETL** | `Modules/Obgy` scaffold, `ObgyPermissionDependencies`, EncounterContentRegistry tabs; ETL: `patients`→`lab_patients` + `his_patient_spouses` (dedup per R10), `visits` split into encounters vs folio payments (magic-code rule), vocab seeding from production export | **M** |
| 3 | **Obgy P2 — specialty clinical depth** | Pregnancy/ANC merge (3 generations), `obgy_ivf_*` stage tables, andrology, imaging studies + annotated diagrams, endoscopy, infertility file; simple sheets shipped as forms content; clinical report templates (FE) | **L** (≈ blueprint P3–P5) |
| 4 | **Obgy P3 — media + go-live** | 4.8 GB checksummed staged rsync → medialibrary (sonar 3.1 GB), signed URLs; pilot tenant cutover, parallel-run, legacy decommission | **M** |
| 5 | **HIS P2 — inpatient/ADT** (independent of Obgy; funded by Tier-2/3 revenue) | wards/rooms/beds + bed map, ADT movements, nightly bed-day charges → folio, nursing station | **L** (10–16 pw) |
| 6 | **HIS P3 extensions** | clinical pharmacy/eMAR over Inventory+POS, OR module consuming `his_surgical_bookings`/`his_operative_notes`, radiology via the same D3 contract | **M–L** each, independent |

Critical path to a **sellable Tier-3 "Moon Women's Health"**: Phase 0 → HIS P1 (+1b) → Obgy P1–P2
≈ **22–34 person-weeks**. Tier-2 "Moon Clinic" is sellable at the end of HIS P1 alone. HIS P2
(hospital tier) overlaps Obgy P2/P3 with a second stream if staffing allows.

---

## 8. Honest pros / cons

### Pros

1. **Zero reopened decisions.** Conforms to D1/D1b/D2/D3/D4/D5 verbatim; Phase-0 spec items are the
   literal first milestone. Competing proposals must formally reopen owner-approved decisions.
2. **License-separable tiers from one codebase**: Lab → Clinic → Women's Health → Hospital; the
   Clinic-never-imports-Obgy rule is the same mechanism that today keeps LIS sellable standalone.
3. **Proven template, third application**: Obgy repeats the LIS module recipe (prefixed tables, state
   enums, events+ordered listeners, Actions as entry points, JE-only accounting, registered
   permission maps, Core DataScope) — lowest-novelty path the codebase is already optimized for.
4. **OBGY's value lands where the platform is weakest** (appointments 1/10, encounter 0/10) as
   field-proven designs, while its unsalvageable 20% (bucket C) and its conflations (visits magic
   codes, couple-in-one-row) are structurally excluded.
5. **Forms engine turns specialty sheets into content, not code** — the next specialty (cardio,
   derma, dental) ships mostly as seeders + a few tables, compounding the platform investment.
6. **EMR scope-creep (Risk #7) is contained by construction**: HIS v1 stays administrative-financial;
   clinical depth lives only in the priced Obgy plugin where a paying segment funds it.
7. **Single posting source per charge is a DB constraint**, not a convention
   (`UNIQUE(source_type, source_id)`), closing the accounting double-posting risk (#4).

### Cons (honest)

1. **Obgy go-live waits on the platform critical path.** The legacy clinic's security urgency is
   real, but its replacement needs Phase 0 + HIS P1 first (~3–4 months). Mitigation: phase 0b
   remediates the legacy box immediately; OBGY waiting is bounded, not open-ended.
2. **The forms engine is net-new infrastructure with no Moon ERP precedent** and a known failure
   mode (over-generalization before a second consumer exists). Mitigation: extract it *against*
   OBGY's concrete templates (phase 1b sequenced last in P1), and allow complex sheets to bypass it
   into dedicated tables — which this proposal already does for IVF/ANC.
3. **Abstraction risk on Folio morphs and EncounterContentRegistry**: designed with one specialty in
   hand; the second specialty may force rework. Accepted: cheaper than the alternative (specialty
   logic fused into the core, unremovable later).
4. **Two-module coordination overhead**: every OBGY feature now crosses a contract (registry, event,
   morph) instead of a direct table join; more design discipline, slightly slower feature velocity
   inside Obgy.
5. **Dependency direction is convention-only** (nwidart enforces nothing; three inversions already
   exist). Mitigation is CI grep gates — workable but not architectural enforcement.
6. **Tension with the approved "v1 admin-financial" scoping**: Obgy P2 pulls clinical documentation
   earlier than the HMS roadmap planned. This proposal resolves it by funding/owning that depth in
   the plugin, but it is still more total scope in year one than the HMS roadmap alone.
7. **ETL risks unchanged by architecture**: patient+date heuristic encounter matching (R2),
   production-only vocabularies (R7), patient dedup (R10) — they exist under every option; this
   proposal at least rehearses them on a single pilot tenant.

---

## 9. Why not the alternatives (one paragraph each)

- **OBGY-as-HIS-core**: lacks Encounter (§90.1), lacks beds/ADT/ER/eMAR entirely, lacks any
  insurance cycle (cash/visa only) in a NPHIES-mandatory market, is 48% specialty content, and its
  code is barred by its own rule R12. It would also force reopening D1 (its patient model vs
  lab_patients) and D2 — formally blocked.
- **Everything-inside-Modules/HIS (OBGY sheets as HIS folders, no Obgy module)**: defensible under
  D2's "one module" letter, but it kills tier licensing (general hospitals carry OB/GYN tables and
  permissions), bloats the his.* permission graph, violates Risk #7's admin-financial v1 scoping
  inside the core itself, and forfeits the LIS-proven plugin economics. The board should treat
  "one Modules/HIS" as governing the *platform*, with specialties as peers — exactly the seat LIS
  already occupies.
