You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,45 @@ Demo for bidirectional HL7v2 ↔ FHIR conversion, built on [Aidbox](https://www.
5
5
-**HL7v2 → FHIR:** ADT (admissions), ORU (lab results), ORM (orders), VXU (immunization), MDM (documents) → Patient, Encounter, DiagnosticReport, Observation, etc.
6
6
-**FHIR → HL7v2:** Invoice/Account + related resources → BAR^P01/P05/P06 (billing).
7
7
8
+
## Motivation
9
+
10
+
Healthcare integration is stuck between two standards. Most clinical systems — labs, ADT feeds, billing — still speak HL7v2, a pipe-delimited format from the 1980s. New apps, analytics, and patient-facing tools want FHIR (modern JSON resources). Teams end up writing custom translation code for every interface, with no shared queue, no retry, no error visibility.
11
+
12
+
Traditional HL7v2 integration projects are expensive, slow, and brittle. Vendor interface engines cost six figures per year, every new sender variant needs hand-tuned mapping by a specialist, and the underlying tooling — interface engines, mapping DSLs, ops dashboards — is decades old. A single ORU feed from a new lab can take months and a dedicated integration analyst.
13
+
14
+
**AI-first by design.** This project is built to be driven by AI agents, not just edited by humans. Every layer — converters, fixtures, error queues, code-mapping tasks, FHIR/HL7v2 spec lookups — is exposed through skills (`hl7v2-info`, `fhir-info`, `message-lookup`, `check-errors`, `hl7v2-to-fhir-pipeline`) so an agent can add a new message type, debug a stuck message, or resolve unmapped codes end-to-end. CLAUDE.md captures the rules; `.claude/skills/` captures the workflows. The aim: collapse months of integration work into a guided agent loop.
15
+
16
+
This shows how we at Health Samurai solve that:
17
+
18
+
-**Durable message queue.** Every inbound message is persisted as a custom `IncomingHL7v2Message` resource with status (`received` → `processed` / error). Retries, deferrals, and reprocessing are first-class — not lost in memory.
19
+
-**Local code → LOINC mapping.** Labs send their own codes (`K_SERUM`, `GLU_FAST`). The system tracks unmapped codes per-sender (`MSH-3`/`MSH-4`), surfaces them as Tasks, and saves resolutions to a per-sender ConceptMap. Mapping grows incrementally instead of being a blocking up-front project.
20
+
-**Visible failures.** Parsing errors, conversion errors, code-mapping gaps, and send failures each have their own status. UI pages show the queue; operators see exactly where a message stopped and why.
21
+
-**Custom resources via Aidbox FHIR Schema.**`IncomingHL7v2Message` and `OutgoingBarMessage` are project-specific resource types — no separate database, same auth, same search, same audit as core FHIR data.
22
+
23
+
The goal isn't to be a production HL7v2 engine. It's a working reference: how to model HL7v2 traffic on top of FHIR, where to put the seams (parse / convert / submit / send), and what the operator UI looks like when things go wrong.
Three horizontal bands wrap a left-to-right data flow.
30
+
31
+
**Data flow (middle row):**
32
+
33
+
1.**EHR sources** — Meditech, Cerner, Epic and similar systems push HL7v2 over MLLP.
34
+
2.**Work queue** — every message lands as `IncomingHL7v2Message` with a status (`received`, `error`, `mapping_error`, ...). Queue is a FHIR resource in Aidbox, not a separate broker.
35
+
3.**Processing pipeline** — five stages, each isolated and independently testable:
**Operations UI (top band):** message queue browser, mapping-task workspace, error recovery (defer, retry, reprocess). Operators don't read logs — they work the queue.
44
+
45
+
**Developer Workspace (bottom band):** mappings as code (TypeScript, not a DSL), type-safe SDKs generated from FHIR + HL7v2 specs, AI-agent skills, HL7v2 spec lookup tool. Everything an engineer or agent needs to add a new sender or message type without leaving the repo.
0 commit comments