Skip to main content

Ghasi e-prescribing gateway — canonical overview

Product name: Ghasi e-prescribing gateway
Deployable service (repository): e-prescribing-gateway (apps/services/e-prescribing-gateway)
Kong route prefix: /v1/ghasi-e-prescribing-gateway
Module spec folder: specs/modules/ghasi-e-prescribing-gateway/
Status: Normative product architecture summary (aligns with ADR-0043, ADR-0044)
Last updated: 2026-04-05


1. Purpose and scope

The Ghasi e-prescribing gateway is the platform component that connects prescriber-side systems (EMRs, EHRs, and other health provider platforms) with pharmacies using a national / enterprise interoperability contract: HL7 FHIR R4 medication workflows, durable notifications, tenancy, and audit at the prescription–fulfillment boundary.

First integration (in scope now): Ghasi EHR (prescribing) and Ghasi Pharmacy (dispensing).

Ghasi EHR prescribing vs pharmacy: Interoperable MedicationRequest create/update on the national gateway is owned by orders (CPOE) when clinicians activate medication orders. pharmacy does not submit MedicationRequest on behalf of prescribers; it fulfills by ingesting MR and posting MedicationDispense.

Future: Additional third-party EMRs/EHRs and pharmacy systems attach to the same gateway contract (OAuth2/mTLS B2B clients, scoped personas, idempotent APIs).

The gateway does not replace the clinical medication list, CPOE order lifecycle, or terminology services inside Ghasi EHR; it mediates interoperable copies and workflow state for cross-system prescribing and dispensing per ADR-0044.


2. Relationship to fhir-gateway

Aspectfhir-gateway (/fhir/R4)Ghasi e-prescribing gateway (e-prescribing-gateway, /v1/ghasi-e-prescribing-gateway)
Primary goalSingle unified FHIR R4 surface for partners integrating with Ghasi clinical domainsMedication interop spine: routing, validation at boundary, subscriptions, idempotency, multi-tenant pharmacy mediation
Typical consumersExternal integrators, HIEs, apps reading/writing FHIR owned by domain servicesGhasi EHR backend, Ghasi Pharmacy backend, future national connectors
MedicationRequest / MedicationDispense on /fhir/R4Routed per ownership map to pharmacyread/search projection over local fulfillment rows (queue), not prescriber creation of national interop MRNot the same path: authoritative national MR/MD live under /v1/ghasi-e-prescribing-gateway FHIR façade and gepgw_ persistence (see §2.1)
National MR/MD from first-party backends/fhir/R4/interop/ghasi-eprescribing/... on fhir-gateway proxies to e-prescribing-gateway (GHASI_EPRESCRIBING_GATEWAY_UPSTREAM_URL). orders uses this path to POST interoperable MedicationRequest (e.g. on medication order activation). pharmacy uses it to GET MR (enrichment) and POST MedicationDispense — it does not POST MedicationRequest as the prescriber. Prefer this path over calling the gateway URL directly from domain services.Same persistence and behaviour as direct gateway HTTP
Subscriptions / outbox / DLQNot a responsibility of the generic FHIR gatewayCore responsibility
NCPDP SCRIPTN/A at gatewayNot mandatory; international FHIR baseline per ADR-0043

Explicit statement: External partners use the generic FHIR edge (fhir-gateway, Kong /fhir). National e-prescribing semantics are available either via Kong /v1/ghasi-e-prescribing-gateway (direct) or via fhir-gateway /fhir/R4/interop/ghasi-eprescribing/* (proxied). First-party services SHOULD use the interop path on fhir-gateway for centralized policy, auditing, and consistent routing.

2.1 Decision B1 — dual path for medication FHIR (accepted)

Who writes what (Ghasi first-party, national path)

ResourceAuthoritative interop persistenceFirst-party submitter
MedicationRequeste-prescribing-gateway (gepgw_*)orders (CPOE) only — e.g. POST on medication order activation via fhir-gateway /fhir/R4/interop/ghasi-eprescribing/MedicationRequest. pharmacy does not create or “request” prescriptions on behalf of clinicians; it ingests MR from gateway NATS events and optional GET for fulfillment projection.
MedicationDispenseSame gatewaypharmacyPOST via the same interop path on fhir-gateway.

Paths

  1. Generic /fhir/R4 + MedicationRequest / MedicationDispense: Ownership mappharmacy for FHIR read/search aligned to local fulfillment projection (partner/clinical read model). This is not where orders publishes the national interoperable MedicationRequest.
  2. National interop (authoritative): Persisted by e-prescribing-gateway. First-party backends SHOULD call fhir-gateway /fhir/R4/interop/ghasi-eprescribing/... (see MEDICATION_EPRESSCRIBING_WORKFLOW_GAP_ANALYSIS.md) rather than the Kong gateway URL directly.
  3. Direct Kong /v1/ghasi-e-prescribing-gateway: Valid for B2B integrators and tooling that target the gateway product URL explicitly.

Implementations must not assume a single URL for both concerns. Consumer documentation SHALL state which entrypoint applies and which service may POST each resource type on the national path.


3. Relationship to Ghasi EHR platform services

ServiceRole relative to e-prescribing
terminologyCanonical LOINC, SNOMED CT, RxNorm, ICD-10-CM (and tenant extensions) for search, validation, expansion — medication coding for order entry is rooted here / in EHR UX, not reimplemented in the gateway.
orders (CPOE)Only first-party service that submits national interoperable MedicationRequest to the gateway (on medication order activation): fhir-gateway POST /fhir/R4/interop/ghasi-eprescribing/MedicationRequest. Also owns order lifecycle, CDS, events — it is the prescriber-side HTTP client for MR create on the national path; not a duplicate of gateway validation/persistence.
medicationLongitudinal medication list, reconciliation, MAR / MedicationAdministrationclinical semantics; does not POST national MedicationRequest for the CPOE→pharmacy path. Gateway stores interop FHIR per ADR-0044.
pharmacyFulfillment only on the national path: ingest gateway MedicationRequest notifications (NATS / optional GET), maintain local queue, POST MedicationDispense via fhir-gateway interop path. Does not POST MedicationRequest as prescriber or “request medication” for clinicians. Generic /fhir/R4 routing to pharmacy per ownership map is the read/search projection over fulfillment data — see §2.1.
Patient identityADR-0042 — authoritative identifiers for cross-system matching; gateway carries references and correlation IDs consistent with platform strategy.

4. Deployable naming

NameUse
Ghasi e-prescribing gatewayProduct and documentation
e-prescribing-gatewayRepository folder, Docker/Kubernetes service name, npm package scope
Ghasi e-prescribing gatewayShort module label in specs (GHASI-EPGW-EPX) — synonymous with the product in module docs
Kong/v1/ghasi-e-prescribing-gatewaye-prescribing-gateway

5. Normative contracts

  • ADR-0043 — Bounded context, FHIR R4, Subscription HTTPS channel, ownership (prescriber / CPOEMedicationRequest; pharmacyMedicationDispense). For Ghasi first-party, MR is submitted by orders; MD by pharmacy. ETag concurrency.
  • ADR-0044e-prescribing-gateway stores authoritative interop FHIR for mediated resources; EHR/Pharmacy remain clinical owners.
  • Module SPEC: specs/modules/ghasi-e-prescribing-gateway/SPEC.md (FR-RX-*), API_DOCS.md, EVENT_MODEL.md.

6. As-built vs roadmap

Summary aligned to specs/modules/ghasi-e-prescribing-gateway/IMPLEMENTATION_CHECKLIST.md:

ThemeShipped / partialNext (see phased plan)
Kong, JWT, module entitlement, Postgres, NATS, auditHarden CI, optional Redis
FHIR MR/MD CRUD, roles, Zod validation, idempotency (MR POST), ETag, routing, subscriptions, outbox, DLQ, NATS events✅ / 🟡Full IG validator, $validate, fuzz tests
Task, Directory search🟡FR-RX-020/021 depth, real Organization/Endpoint data
P2 (bulk export, CDS, multi-region)Gated in P2_GATED.md

7. International alignment (non-normative references)

These inform enterprise gateway expectations; they do not mandate a single national profile:

  • HL7 FHIR R4MedicationRequest, MedicationDispense, Subscription, workflow patterns.
  • IHE — Directory and patient identity patterns where applicable (e.g. mCSD, PMIR) — see national program requirements.
  • EU European ePrescription (EESSI) and similar cross-border/national gateway programs — reference models for routing, audit, and dispense reporting (not adopted verbatim).
  • WHO medication safety and SMART Guidelines — documented alignment at capability level in module architecture, not a certification claim.

Excluded as mandatory default: NCPDP SCRIPT and other U.S.-exclusive licensed stacks (ADR-0043 rejected alternatives).


DocumentRole
IMPLEMENTED_PLATFORM_ARCHITECTURE.mdAs-built platform map
architecture/interop/SOLUTION_DESIGN.mdInterop topology; §3.1.1 medication routing
specs/modules/ghasi-e-prescribing-gateway/PHASED_IMPLEMENTATION_PLAN.mdDelivery phases