HL7 for interface-engine transformations

Most HL7 interface-engine work is not parsing. It is mapping, routing, filtering, enrichment, validation, acknowledgement handling, retries, and making sure the operational behavior matches the clinical contract. A transformation should make an interface easier to reason about, not turn it into a private dialect nobody can debug.

The basic rule is to transform as late and as little as the receiving contract allows. Preserve the raw inbound message, keep identifiers intact, and make every irreversible decision visible. When in doubt, open the raw message in HL7 Soup Web and ask whether the transformation has removed information someone will need during support.

MSH|^~\&|LIS|CITYLAB|ENGINE|CITYHOSP|20260715150000||ORU^R01^ORU_R01|MAP000501|P|2.5.1 PID|1||123456^^^CITYHOSP^MR||Smith^Jane^Anne^^Ms^^L||19800314|F ORC|RE|ORD4488^EHR|FILL7788^LIS OBR|1|ORD4488^EHR|FILL7788^LIS|58410-2^CBC panel^LN|||20260715143000|||||||||12345^Careful^Clara^^^^^^NPI||||||20260715145500|||F OBX|1|NM|718-7^Hemoglobin^LN||132|g/L|115-155|N|||F|||20260715145000 OBX|2|NM|789-8^Erythrocytes^LN||4.6|10*12/L|3.8-5.2|N|||F|||20260715145000

This is synthetic sample data for learning and testing. Open it in HL7 Soup Web before mapping it so the segment groups, repeated fields, and coded values are visible.

Map At The Right Grain

A common mistake is mapping one message to one output record when the message contains repeated business objects. Lab ORU messages repeat OBX. Billing DFT messages repeat FT1. Scheduling messages repeat resource groups. Documents may have multiple payload observations. Map the real repeat, not the container.

The destination format should not decide the clinical meaning. If a CSV cannot represent multiple identifiers, do not silently choose the first PID-3 without documenting the rule.

  • Keep assigning authority with identifiers.
  • Keep order and result identifiers separate.
  • Do not flatten repeated values without an explicit repeat rule.

Receive, Transform, Route, Log

A useful production checklist is receive, transform, route, log. Receive the raw message and preserve it. Transform only the fields required by the receiving contract. Route using explicit message, facility, status, and destination rules. Log the raw control ID, transformed control ID, destination, ACK, and any variables that explain why the message took that path.

This matters most for workaround interfaces. A temporary mapping table, value-set cleanup, or SQL insert can still be supportable if those four stages stay visible in Integration Soup. If the transformation hides the inbound message, the outbound message, or the receiver response, the next support call will start with guesswork.

ACKs, Errors, And Retry Behavior Are Part Of The Design

The interface engine should decide when to accept, reject, retry, quarantine, alert, or transform-and-forward. Those choices are as important as field mapping. Logging only the final output file is not enough; support needs the original control ID, the receiver response, error text, and the transformation path.

A Practical Integration Soup Workflow

In Integration Soup, build transformations around message templates so the source and destination trees stay visible. Use variables for values that also need to appear in filenames, logs, routing, or downstream messages. Keep transformer order intentional because later rules often depend on values created earlier.

The HL7 Soup transformers tutorial, custom transformer tutorial, and file-processing tutorial together cover the everyday toolbox for production interface work.

The Test Pack I Would Ask For

Ask for every message type, every repeat case, bad codes, missing required values, multiple identifiers, large payloads, receiver rejections, network retries, duplicate resends, and one sample from each sender facility.