Generating a C-CDA Document from an HL7 Message
InterSystems products includes transformations that can accept an HL7 message, transform it into SDA (an internal representation), and then transform it into a C-CDA document. You can then provide and register the C-CDA to an XDS document repository.
HL7 to C-CDA Provide and Register Message Trace
The following diagram is an annotated message trace for an HL7 message transformed into a C-CDA followed by an XDS provide and register. The provide and register includes a PIX search to get the MPI ID from the MRN extracted from the C-CDA.
The test service shown in the diagram is a simple message router. Trace operations is a utility that makes intermediate processing steps visible in the trace. The numbers in the diagram match the steps in the procedure below.
HL7 to C-CDA Provide and Register Procedure
To set up InterSystems products to convert HL7 into C-CDA:
-
Create an HL7 input service (for example, an HL7 file service). Set up the HL7 input service to forward HL7 messages to some operation named in the TargetConfigNames setting.
-
Create the operation named in the previous step, and set it up to:
-
transform the HL7 message into SDA3.
-
transform the SDA into a C-CDA 1.1 or 2.1 document
-
package the C-CDA into a Provide and Register request.
-
send the Provide and Register request to the InterSystems Document Source.
-
-
The Document Source then follows the path laid out in the section “Provide and Register a CDA document”.
HL7 to C-CDA Provide and Register Components and Settings
Component | Setting |
---|---|
Business Hosts | HL7 Service: EnsLib.HL7.Service.FileServiceOpens in a new tab (or similar) |
Business Hosts | HL7 to C-CDA Transformer: Custom Business Operation |
Business Hosts | Document Source: HS.IHE.XDSb.DocumentSource.OperationsOpens in a new tab |
Business Hosts | PIX Consumer: HS.IHE.PIXv3.Consumer.OperationsOpens in a new tab |
Production Settings | TargetConfigNames in the HL7 Service |
Production Messages | HS.Message.IHE.XDSb.ProvideAndRegisterRequestOpens in a new tab |
Production Messages | HS.Message.XMLMessageOpens in a new tab:
|
Production Messages | HS.Message.PatientSearchRequestOpens in a new tab |
Production Messages | HS.Message.PatientSearchResponseOpens in a new tab |
XSL Transformations | SDA-to-CCDAv21-CCD.xsl or other SDA to C-CDA transformation |
Service Registry Entries | XDSb.Repository |
Service Registry Entries | PIXv3.Manager |
External IHE Actor Endpoints | XDS Document Repository |
External IHE Actor Endpoints | PIX Manager |
Example Transformer Business Operation to Generate a C-CDA Document from an HL7 Message
Below is a sample business operation that accepts an HL7 message and transforms it into a C-CDA document:
Class Test.HL7Transformer Extends (Ens.BusinessOperation)
[ Inheritance = right, ProcedureBlock ]
{
Parameter INVOCATION = "Queue";
/// XDSb source operations component
Property XDSbSourceOperations As Ens.DataType.ConfigName
[ InitialExpression = "HS.IHE.XDSb.DocumentSource.Operations"];
Parameter SETTINGS As %String = "XDSbSourceOperations";
XData MessageMap
{
<MapItems>
<MapItem MessageType="EnsLib.HL7.Message">
<Method>ProcessHL7Message</Method>
</MapItem>
</MapItems>
}
/// Process an inbound HL7 v2.5.1 message
Method ProcessHL7Message(pRequest As EnsLib.HL7.Message,
Output pResponse As EnsLib.HL7.Message) As %Status
{
Try {
// Convert the HL7 message to SDA3
Set tSC = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(pRequest,.tSDA3Stream)
Quit:$$$ISERR(tSC)
// Transform the SDA3 to a C-CDA
Set tTransformer = ##class(HS.Util.XSLTTransformer).%New()
Set tSC= tTransformer.Transform(tSDA3Stream,"SDA3/SDA-to-CCDA-CCD.xsl",.tCDAStream)
Quit:$$$ISERR(tSC)
// Create a Provide and Register
Set tRequest = ##class(HS.Message.IHE.XDSb.ProvideAndRegisterRequest).%New()
Set tDocument = ##class(HS.Message.IHE.XDSb.Document).%New()
Set tDocument.FormatCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"urn:hl7-org:sdwg:ccda-structuredBody:1.1","1.3.6.1.4.1.19376.1.2.3",
"Consolidated CDA R1.1 Structured Body Document")
Set tDocument.MimeType="text/xml"
// Copy the C-CDA into the message
Do tDocument.BodyCharacter.CopyFrom(tCDAStream)
Do tRequest.Documents.Insert(tDocument)
// Call the document source operation
Set tSC = ..SendRequestSync(..XDSbSourceOperations,tRequest,.tResponse)
Quit:$$$ISERR(tSC)
} Catch ex {
Set tSC= ex.AsStatus()
}
Quit tSC
}
}