Skip to content
All Projects
AIIn Progress

AI-Assisted HL7 to FHIR Integration Hub

An integration hub that normalizes messy clinical feeds into validated US Core FHIR. Claude proposes mappings from de-identified samples, analysts approve them, and structured messages then run through a deterministic pipeline with no model in the path. Agents reach the resulting data through a scoped FHIR MCP server.

20264 months, ongoing
5 source formats to US Core FHIRNo model calls for structured feeds99.4% validator pass on synthetic replay
AI-Assisted HL7 to FHIR Integration Hub

My Role

Architecture and engineering — designed the design-time mapping loop, the deterministic runtime pipeline, the terminology service, and the FHIR MCP gateway.

Duration

4 months, ongoing

Year

2026

Tech Stack

Claude Opus 5.5MCPFHIR R4 / US Core 9HAPI FHIR 8SMART on FHIR 2.2Open Integration EngineTemporalPostgreSQL 18pgvectorNext.js 16

Status

In Progress
Overview

An integration hub that normalizes messy clinical feeds into validated US Core FHIR. Claude proposes mappings from de-identified samples, analysts approve them, and structured messages then run through a deterministic pipeline with no model in the path. Agents reach the resulting data through a scoped FHIR MCP server.

The Challenge

Health systems still exchange most clinical data over interfaces built decades apart: HL7 v2 feeds full of site-specific codes, C-CDA documents that vary by vendor, and a steady stream of faxes. Each new interface takes weeks of hand-mapping by a scarce integration analyst, and small feed changes quietly break downstream apps. Sending every message through an LLM is not the answer either. It is expensive, nondeterministic, hard to audit, and puts PHI in every request.

The Approach

I separated design time from run time. At design time, Claude Opus 5.5 reads de-identified feed samples and proposes a typed mapping, along with explicit questions for the analyst. The proposal is replayed against a golden set, validated against US Core 9.0, and published only after human approval. At run time, those mappings are compiled into deterministic transforms, so structured messages never call a model. Faxed PDFs are the one deliberate exception: a vision model reads them, and every result goes to review. All testing so far has used synthetic Synthea patients and public FHIR sandboxes.

Key Features
1

Agentic Mapping Studio

Claude proposes field mappings, transforms, and LOINC candidates from de-identified samples, and asks the analyst when the source is ambiguous instead of guessing, such as which CKD-EPI equation year a local eGFR code uses.

2

Golden Replay Before Every Release

Each draft mapping is replayed against reviewed fixtures and shown as a diff of identical, improved, and regressed messages. Any regression blocks publishing.

3

Deterministic Runtime Pipeline

Open Integration Engine handles MLLP and acknowledgments, then versioned mappings, terminology lookups, and validation run with no model in the path. Failed messages are quarantined with a reason, never dropped.

4

Terminology Normalization

Local lab codes, units, and free-text values resolve to LOINC, SNOMED CT, RxNorm, and UCUM, using a reviewed crosswalk first and pgvector candidate search for the long tail.

5

Scoped FHIR MCP Gateway

Agents reach data through narrow tools mapped to SMART on FHIR v2 scopes. The server pins the patient from launch context, never passes tokens through, and writes an AuditEvent for each call.

Technical Decisions

Key technology choices and the reasoning behind each decision.

Claude Opus 5.5

AI / ML

Used for mapping proposals, where reasoning over ambiguous local conventions matters more than speed. Because it runs only at design time on de-identified samples, per-call cost and latency stay out of the message path.

Open Integration Engine

Infrastructure

Chose it over Mirth Connect after Mirth moved to a closed-source commercial license at version 4.6. As the community fork, it keeps the familiar channel model and MLLP handling with an open license.

HAPI FHIR 8 + US Core 9.0

Data

HAPI provides both the FHIR store and the validator, so mapping releases and live messages are checked by the same engine. US Core 9.0 aligns with USCDI v6 and stays on FHIR R4, which is what EHR APIs expose today. R6 is still in ballot.

Temporal

Backend

Mapping tasks can wait for days while an analyst answers questions. Durable workflows keep that state, the retries, and the approval signals in one place, where a queue and cron jobs would have scattered them across services.

MCP (2026-07-28 spec)

AI / ML

Standardizes how agents call clinical tools and brings OAuth 2.1, resource indicators, and scope challenges. Custom function endpoints would have meant rebuilding that authorization model for every agent.

Next.js 16

Frontend

Server Components keep the operations console fast and keep message previews on the server, out of client bundles, which matters when those previews can contain clinical data.

Architecture

A deterministic runtime path, with AI confined to a reviewed design-time loop.

01

Ingestion

HL7 v2 over MLLP, C-CDA over Direct, and faxed PDFs arrive through Open Integration Engine. Raw messages are encrypted, stored, and acknowledged.

02

Transform

Messages are parsed and routed to the active mapping version. Compiled transforms produce FHIR resources: same input, same output.

03

Terminology

Local codes and units resolve through the reviewed crosswalk to LOINC, SNOMED CT, RxNorm, and UCUM.

04

Validate and Store

HAPI FHIR validates each resource against US Core 9.0 and commits it, or quarantines it with the reason.

05

Exception Loop

Failures start a Temporal workflow: de-identify, Claude proposes a fix, golden replay, analyst approval, new mapping version.

06

Agent Access

Clinical agents query through the FHIR MCP server, with SMART scopes, minimum-necessary filtering, and AuditEvents.

Challenges & Learnings

Key technical challenges I faced and how I solved them.

Challenge 1

Valid Output That Was Still Wrong

Problem

Early proposals looked right but were not. A local code such as EGFR carries meaning that is not in the message, and the model would pick the most likely LOINC without saying so. Those guesses passed validation every time, because a wrong code that exists is still a valid code.

Solution

Added a required open_questions field to the mapping schema and seeded the golden set with known-ambiguous codes. A proposal that maps a seeded code without raising a question fails, and unresolved questions route to the analyst.

Outcome

On the synthetic test feed, 3 of 412 local codes were escalated as questions, including the eGFR equation year, and no seeded ambiguous code was mapped silently.

Challenge 2

Timestamps Without Offsets

Problem

HL7 v2 timestamps often omit a UTC offset, but FHIR requires one whenever a time is present. A large share of test messages failed validation, and a naive default would have shifted results by hours.

Solution

Made the site timezone an explicit, versioned part of feed configuration, applied during mapping with IANA zone rules, and added fixtures that straddle daylight-saving changes.

Outcome

Timestamp validation failures dropped to zero on replay, including the daylight-saving fixtures.

Challenge 3

Keeping PHI Out of the Improvement Loop

Problem

The exception loop needs failing messages to diagnose a problem, and that is exactly where PHI could leak into prompts and logs.

Solution

Messages are de-identified before reaching the model, keeping structure and local codes while replacing identifiers with surrogates. A second scan blocks any prompt that still matches identifier patterns, and traces carry hashed IDs only.

Outcome

Seeded canary identifiers in the test feed never appeared in prompts or traces.

NEXT

Interested in working with TwilightCore?

We build production systems like this for teams and founders who value quality engineering.