Skip to main content

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:

PhaseAction
PrepareDeploy gateway (gepgw_* schema); enable entitlement for tenant
Dual-write periodConfigure orders-service to write MR to BOTH legacy path AND gateway; verify parity
Pharmacy cutoverRedirect pharmacy-service to receive MR via gateway Subscriptions instead of legacy polling
EHR cutoverRemove legacy MR direct call from orders-service; gateway is sole national interop path
Legacy cleanupDisable 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:

  1. Export historical MedicationRequest records from source system (FHIR Bundle or CSV).
  2. Use admin bulk import endpoint (POST /admin/v1/migration/medication-requests) to insert with gepgw_migration_source metadata.
  3. Prescription business IDs generated retroactively; ETag assigned at time of import.
  4. No Subscription notifications fired for historical imports (flag: skipNotifications=true).
  5. Verify imported records via FHIR search.

Scenario 4: Third-party EMR onboarding (Phase 3)

New external EMRs register as B2B clients:

  1. Register OAuth2 client credentials with ehr-backend persona scope.
  2. Configure IG package for tenant (pinned version).
  3. Pass contract test harness (three-party golden fixtures).
  4. Onboard via Director search (Organization + Endpoint registration).
  5. Pilot with 1 pharmacy; expand after monitoring period.

Rollback

  • Disable ehr.ghasi_eprescribing_gateway entitlement → 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_source column in gepgw_medication_requests) retained permanently for audit trail.