DEV Community

Cover image for FHIR Facade: A Modern API on a Legacy System, No Migration
Nirmitee.io
Nirmitee.io

Posted on Originally published at nirmitee.io

FHIR Facade: A Modern API on a Legacy System, No Migration

How a FHIR facade works, when a repository or hybrid is the better choice, and how to roll one out without overloading the old system.

Originally published on Nirmitee.io: FHIR Facade Architecture Guide: FHIR for Legacy EHR Integration and Legacy Healthcare Systems

Many healthcare organizations need FHIR APIs, for regulation, partners or new apps, but their data lives in systems that do not speak FHIR: a legacy EHR, an HL7 v2 message store, a relational database. Migrating all of it is slow, risky and often unnecessary.

A FHIR facade is the alternative. It puts a FHIR API on top of the old system. The data stays where it is: the facade translates each FHIR request into a query the old system understands, and maps the answer back into FHIR.

How a facade works

FHIR facade architecture diagram: client apps call a FHIR R4 API on a facade with SMART auth, request router, mapping engine and response assembler, which reaches HL7 v2, SQL and proprietary EHR systems

A FHIR facade in front of legacy systems. Source: Nirmitee.io

In plain terms, a FHIR facade is a FHIR server with no FHIR database behind it. It offers the resources and searches you choose to support, and answers from the source system at the moment of each request. Every facade does three jobs:

  • Receive and route each FHIR request to the right connector for the source system.
  • Map legacy data into FHIR, for example turning a name field in an HL7 v2 message into a FHIR patient name.
  • Assemble valid FHIR responses, including errors.

It also checks each app's access token and permissions before touching any data. Of all the parts, the source calls the mapping engine the hardest, because mapping work grows with every resource type and search you add.

Facade, repository or hybrid?

Decision flowchart: a retired source leads to a repository, bulk export or unserved searches lead to a hybrid, main write workflows lead to a repository or hybrid, otherwise a FHIR facade

Facade, repository or hybrid. Source: Nirmitee.io

A facade is not always the right answer. The source compares three options:

  • Facade: data stays in the source and is as current as the source. Reads are only as fast as the source system, search covers only what you map, and writes are hard because each one must map back. The main risk is load on the source. Best for read-heavy access to systems that are staying.
  • Repository: data is copied into a FHIR store. Reads are fast and search is full, but data is only as current as the last load, and the copy can drift from the source. Best for analytics, bulk export and new systems.
  • Hybrid: some data copied, some read live. Best for mixed workloads and gradual migration, at the cost of running and reconciling both paths.

The source's guidance in short: if the source system is being retired, use a repository. If you need bulk export or searches the source cannot serve, consider a hybrid. If the main workflows write data, look at a repository or hybrid. Otherwise, a facade.

A worked example

Consider a payer whose claims live in a legacy system. Apps want to pick up recent changes, and the payer also wants bulk export for analytics. With a facade alone, every change search hits the claims system, and a bulk export means reading and mapping every claim on request, which can load production for hours.

The likely answer is a hybrid: a live facade for single-member reads that must match the claims system, and a FHIR store for change searches and bulk export. Agree on freshness in writing, for example "changes visible within 15 minutes", so everyone tests against the same target.

Build or buy

There are four routes: an open-source framework (HAPI FHIR), a commercial platform (Firely Server, Smile CDR, InterSystems IRIS), a cloud FHIR service, or a custom build. Not every "FHIR server" is a facade: cloud FHIR services mainly store FHIR data, so they fit the repository or hybrid model. The original guide compares all four routes, along with the legacy sources a facade can wrap and their difficulty.

Roll it out one resource group at a time

Start with Patient and add resources only when a client needs them, because each brings its own mapping and terminology work. The source's order: patient, then the clinical core (conditions, allergies, medications), then lab and diagnostic results, then documents and visits, then writes and subscriptions.

Two common mistakes: mapping everything at once (FHIR R4 lists about 145 resource types, and no client needs all of them), and underestimating search, where each search parameter needs its own translation rule.

From the source's own multi-EHR facade work in front of Epic, Oracle Health and athenahealth: athenahealth needed the most connector work, code translation never finished, and EHR version drift was a real problem, so retest every connector after each vendor upgrade. The full guide includes tested example code and what current regulations require.


Nirmitee.io builds FHIR facades and FHIR APIs on legacy EHRs, databases and HL7 v2 systems. For the architecture diagram, comparison and code, read the original: FHIR Facade Architecture Guide on Nirmitee.io.

Dinesh Thorat is Healthtech Growth Partner at Nirmitee.io.

Originally published at nirmitee.io.

Top comments (0)