Ghasi e-Prescribing Gateway Service — Migration Plan
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD
Context
The ghasi-eprescribing-gateway-service is a new interoperability layer. Before its introduction, Ghasi EHR and Ghasi Pharmacy exchanged medication data via direct service calls or through the generic fhir-gateway. This migration plan covers the transition from legacy medication routing to the new gateway.
Migration Scenarios
Scenario 1: Greenfield tenant
No migration required. New tenants activate the ehr.ghasi_eprescribing_gateway entitlement and begin using the gateway natively from day one.
Scenario 2: Existing Ghasi EHR ↔ Pharmacy (first-party) migration
For existing first-party deployments using direct service calls or generic FHIR routes:
| Phase | Action |
|---|---|
| Prepare | Deploy gateway (gepgw_* schema); enable entitlement for tenant |
| Dual-write period | Configure orders-service to write MR to BOTH legacy path AND gateway; verify parity |
| Pharmacy cutover | Redirect pharmacy-service to receive MR via gateway Subscriptions instead of legacy polling |
| EHR cutover | Remove legacy MR direct call from orders-service; gateway is sole national interop path |
| Legacy cleanup | Disable legacy medication routing; decommission old integration code |
Duration: 2-4 week dual-write period per tenant; rollback by disabling entitlement.
Scenario 3: Legacy medication records (historical prescriptions)
For tenants requiring historical prescriptions to be visible via gateway:
- Export historical
MedicationRequestrecords from source system (FHIR Bundle or CSV). - Use admin bulk import endpoint (
POST /admin/v1/migration/medication-requests) to insert withgepgw_migration_sourcemetadata. - Prescription business IDs generated retroactively; ETag assigned at time of import.
- No Subscription notifications fired for historical imports (flag:
skipNotifications=true). - Verify imported records via FHIR search.
Scenario 4: Third-party EMR onboarding (Phase 3)
New external EMRs register as B2B clients:
- Register OAuth2 client credentials with
ehr-backendpersona scope. - Configure IG package for tenant (pinned version).
- Pass contract test harness (three-party golden fixtures).
- Onboard via Director search (Organization + Endpoint registration).
- Pilot with 1 pharmacy; expand after monitoring period.
Rollback
- Disable
ehr.ghasi_eprescribing_gatewayentitlement → all gateway writes blocked. - Reactivate legacy medication routing in orders-service and pharmacy-service.
- Historical data in
gepgw_*tables retained (no delete on rollback).
Data Retention Post-Migration
- Legacy integration code retained for 6 months post-cutover.
gepgw_*records: clinical retention (10 years).- Migration metadata (
gepgw_migration_sourcecolumn ingepgw_medication_requests) retained permanently for audit trail.