50.7.1CDA Exchange+ Processors

 

CDA Exchange+ processors require that the CDA Exchange+ (CDA_EXCHANGE_PLUS) module is running. These processors execute each step of the CDA Exchange+ bidirectional transformation CDA Exchange+.

50.7.2CDA Import (CDA to FHIR) Processors

 

These processors integrate the existing CDA Exchange+ Import functionality with Apache Camel.

CDA Import processors are used for converting CDA documents to FHIR resources. Each processor has the specifications below:

50.7.2.1CDA to FHIR Pre-Convert Script Processor

Executes the logic found in the pre-import script method (onPreImportCDA) that is configured in the CDA Exchange+ module. The resulting changes are set in the modifiableDocument property on the CdaToFhirConversionResultJson.

50.7.2.2CDA to FHIR Pre-Convert Interceptor Processor

Invokes the pointcut CDA_PRE_IMPORT, executing any interceptor code that is configured in the CDA Exchange+ module. The resulting changes are set in the modifiableDocument property on the CdaToFhirConversionResultJson.

50.7.2.3CDA to FHIR Conversion Processor

Translates an incoming CDA Exchange document into a FHIR transaction Bundle using the CDA Exchange+ engine. This Bundle is placed in the bundle field of the outputted CdaToFhirConversionResultJson.

50.7.2.4CDA to FHIR Post-Convert Script Processor

Executes the logic found in the post-import script method (onPostImportCDA) that is configured in the CDA Exchange+ module. The resulting changes to the bundle are set in the bundle property on the CdaToFhirConversionResultJson.

50.7.2.5CDA to FHIR Post-Convert Interceptor Processor

Invokes the pointcut CDA_POST_IMPORT, executing any interceptor code that is configured in the CDA Exchange+ module. The resulting changes to the bundle are set in the bundle property on the CdaToFhirConversionResultJson.

50.7.2.6Sample CDA Import Route Configuration

<route>
    <from uri="kafka:in-topic?brokers=localhost:9092"/>

	<setProperty name="originalCcd">
		<spel>#{body}</spel>
	</setProperty>

	<to uri="smile:camel/txLogStart"/>
	<to uri="smile:camel/wrapInDocumentReferenceProcessor?status=current&amp;contentType=application/xml&amp;docStatus=final&amp;typeCode=34133-9&amp;formatCode=urn:hl7-org:sdwg:ccda-structuredBody:2.1" />
	<to uri="smile:persistence/singleResourceProcessor?method=CREATE" />

	<setBody>
		<spel>#{exchange.getProperty('originalCcd')}</spel>
	</setBody>
	
    <to uri="smile:cda_exchange_plus/cdaToFhirPreConvertScriptProcessor"/>
    <to uri="smile:cda_exchange_plus/cdaToFhirPreConvertInterceptorProcessor"/>
    <to uri="smile:cda_exchange_plus/cdaToFhirProcessor"/>
    <to uri="smile:cda_exchange_plus/cdaToFhirPostConvertScriptProcessor"/>
    <to uri="smile:cda_exchange_plus/cdaToFhirPostConvertInterceptorProcessor"/>
    <choice>
        <when>
            <spel>#{body.isDoProcess()}</spel>
            <setBody>
                <spel>#{body.bundle}</spel>
            </setBody>
            <to uri="smile:persistence/bundleProcessor"/>
        </when>
    </choice>
</route>

50.7.3CDA Export (FHIR to CDA) Processors

 

These processors integrate the existing CDA Exchange+ Export functionality with Apache Camel.

50.7.3.1FHIR to CDA Script Processor

This processor uses the Parameters resource in the message body, and the scriptName parameter to create a Composition resource which is added to the FhirToCdaConversionResultJson.composition output.

Note: A Script Template must be created before this processor can be used. The scriptName parameter corresponds with a Script Template ID. See the Creating a CDA Template section for more details.

50.7.3.2FHIR to CDA Composition Processor

This processor uses a Composition resource to create a Bundle resource which is added to the FhirToCdaConversionResultJson.bundle output.

A Composition resource, or FhirToCdaConversionResultJson with the composition property set, may be provided as input.

50.7.3.3FHIR to CDA Bundle Processor

This processor uses a Bundle resource to create a String CDA document which is added to the FhirToCdaConversionResultJson.modifiableDocument output.

A Bundle resource, or FhirToCdaConversionResultJson with the bundle property set, may be provided as input.

50.7.3.4FHIR to CDA Post-Convert Script Processor

Invokes the onPostExportCDA script method (configured in the CDA Exchange+ module) which will modify the FhirToCdaConversionResultJson.modifiableDocument property.

See the CDA Post Export JavaScript Hook section for more details.

50.7.3.5FHIR to CDA Post-Convert Interceptor Processor

Invokes interceptors with the CDA_POST_EXPORT pointcut (configured in the CDA Exchange+ module) which will modify the FhirToCdaConversionResultJson.modifiableDocument property.

See the CDA_POST_EXPORT Pointcut Javadocs for more details.

50.7.3.6Sample CDA Export Route Configuration

The route below is equivalent to a system-level /$smile-generate-cda operation using the CDA Exchange+ module. See the Apply a template section for more details.

<route>
	<!-- Consume messages from a Kafka `in-topic` (expected to be `Parameters` resources) -->
	<from uri="kafka:in-topic?brokers=localhost:9092"/>

	<!-- Uses the scriptName and Parameters in the message body to create a Composition -->
	<to uri="smile:cda_exchange_plus/fhirToCdaScriptProcessor?scriptName=default-ccd-template"/>
	<setVariable name="conversionResult"><spel>#{body}</spel></setVariable>

	<!-- Performs the same functionality as the CDA Exchange+ `persist_generated_composition` configuration property -->
	<setBody><spel>#{exchange.getVariable('conversionResult').composition}</spel></setBody>
	<to uri="smile:persistence/singleResourceProcessor?method=CREATE" />

	<!-- Converts the Composition from fhirToCdaScriptProcessor to a Bundle -->
	<to uri="smile:cda_exchange_plus/fhirToCdaCompositionProcessor"/>
	<setVariable name="conversionResult"><spel>#{body}</spel></setVariable>

	<!-- Performs the same functionality as the CDA Exchange+ `persist_generated_bundle` configuration property -->
	<setBody><spel>#{exchange.getVariable('conversionResult').bundle}</spel></setBody>
	<to uri="smile:persistence/singleResourceProcessor?method=CREATE" />

	<setBody><spel>#{exchange.getVariable('conversionResult')}</spel></setBody>
	
	<!-- Converts the Bundle from fhirToCdaCompositionProcessor to a CDA Document -->
	<to uri="smile:cda_exchange_plus/fhirToCdaBundleProcessor"/>
	
	<!-- Invokes the `onPostExportCDA` script method provided in the CDA Exchange+ module configuration  -->
	<to uri="smile:cda_exchange_plus/fhirToCdaPostConvertScriptProcessor"/>

	<!-- Invokes the `CDA_POST_EXPORT` pointcut method provided in the CDA Exchange+ module configuration -->
	<to uri="smile:cda_exchange_plus/fhirToCdaPostConvertInterceptorProcessor"/>
	<setVariable name="conversionResult"><spel>#{body}</spel></setVariable>

	<!-- Performs the same functionality as the CDA Exchange+ `persist_generated_document_as_binary` configuration property -->
	<setBody><spel>#{exchange.getVariable('conversionResult')}</spel></setBody>
	<to uri="smile:camel/wrapInBinaryResourceProcessor" />
	<to uri="smile:persistence/singleResourceProcessor?method=CREATE" />
	<setVariable name="binaryUrl"><spel>#{'/' + exchange.getVariable('resourceId')}</spel></setVariable>

	<!-- Performs the same functionality as the CDA Exchange+ `persist_generated_document_as_document_reference` configuration property -->
	<setBody><spel>#{exchange.getVariable('conversionResult')}</spel></setBody>
	<toD uri="smile:camel/wrapInDocumentReferenceProcessor?contentUrl=${variable.binaryUrl}" />
	<to uri="smile:persistence/singleResourceProcessor?method=CREATE" />

	<!-- Send the exported CDA document to a Kafka `out-topic` -->
	<setBody><spel>#{exchange.getVariable('conversionResult').modifiableDocument}</spel></setBody>
	<to uri="kafka:out-topic?brokers=localhost:9092"/>
</route>