51.1.1Demo Projects

 

Smile CDR provides a set of sample projects built to demonstrate how to take advantage of various aspects of the system such as hybrid providers, interceptors, theme skinning, CDS hooks, and more.

51.1.1.1Instructions

These demo projects contain complete Maven-based Java code to define functionality around the system. When using a demo project, follow these instructions to make it your own:

  • Download the project using the link in the section, and extract the archive locally.
  • Edit the pom.xml file. The <groupId>, <artifactId>, and <name> tags all contain placeholders. You can leave the examples if you are just experimenting, but it is recommended to replace these with something more useful before committing your code to source control.
  • Open the project in your favourite IDE. This project is designed to use Apache Maven for building, so it can be imported natively as a Maven project in Eclipse and IntelliJ IDEA.
  • The project contains a number of example classes. Pick the one you want to start with, or create your own from scratch. You may want to move the class to a more sensible package name for your organization.
  • Build the project by executing the following command:
mvn clean install
  • Maven will create a JAR containing your interceptor classes in the target/ directory. The exact name of the JAR file will vary depending on the groupId and artifactId you picked, but by default it will be called: cdr-interceptor-starterproject-[version].jar.

  • Copy this JAR file to the customerlib/ directory in your Smile CDR installation

  • Restart Smile CDR.

  • Restart the module.

The remainder of this page will go into the details for each specific demo project.

51.1.2General Purpose Interceptor Demo Project

 
Before you download and use this demo project, it is recommended to have read the Interceptors documentation page.

The cdr-interceptor-starterproject contains a complete example Maven-based Java project to define an interceptor that can be imported into Smile CDR. This project also contains an example showing a Java Consent Service implementation.

51.1.2.1Downloads

51.1.2.2Template Classes

The Interceptor Starter Project ships many pre-built java classes. These classes have sample implementations making use of each pointcut available to them.

Class NameWhat it is implementing
com.smilecdr.demo.fhirendpoint.ServerInterceptorTemplateFHIR Endpoint Server interceptor
com.smilecdr.demo.hl7v2listening.Hl7V2ListeningInterceptorTemplateHL7v2 Endpoint Server interceptor
com.smilecdr.demo.fhirstorage.StorageInterceptorTemplateFHIR Storage interceptor
com.smilecdr.demo.fhirgateway.GatewayInterceptorTemplateFHIR Gateway interceptor
com.smilecdr.demo.fhirclient.ClientInterceptorTemplateFHIR Client interceptor
com.smilecdr.demo.mdm.MDMInterceptorTemplateMDM interceptor
com.smilecdr.demo.subscription.SubscriptionInterceptorTemplateSubscription interceptor
com.smilecdr.demo.channelimport.ChannelImportInterceptorTemplateChannel Import interceptor
com.smilecdr.demo.priorauthcrd.PriorAuthCRDInterceptorTemplatePrior Auth CRD interceptor
com.smilecdr.demo.s2sdataexchange.S2SDataExchangeInterceptorTemplateSystem To System Data Exchange interceptor

51.1.2.3Instructions

  • Follow the basic instructions to create your jar.
  • Edit the module configuration for the relevant module to either:
    • Add the fully qualified class name for your interceptor (e.g. com.smilecdr.demo.fhirstorage.ExampleAttributeEnhancingInterceptor) to the Interceptor Bean Types property in your module configuration
    • Or, add the fully qualified class name for your interceptor Spring Configuration class (annotated with @Configuration e.g. com.smilecdr.demo.server.r4.TestServerAppCtx) to the Interceptor Bean Types property in your module configuration, which will allow you to register one or more interceptor beans and use dependency injection with your interceptors
  • Restart the module.

51.1.3HL7V2 Interceptor Demo Project

 
Before you download and use this demo project, it is recommended to have read the HL7V2 inbound documentation page.

This demo project specifically shows complete solutions for preConvert and postConvert mapping rules, via the HL7V2IN_PRE_HL7V2_TO_FHIR_MAPPING_PROCESSING and HL7V2IN_POST_HL7V2_TO_FHIR_MAPPING_PROCESSING pointcuts.

51.1.3.1Downloads

51.1.3.2Instructions

  • Follow the basic instructions to create your jar.
  • Add the fully qualified class name for your interceptor(s) (e.g. com.example.endpoint.hl7v2.inbound.PreConvertInterceptor) to the Interceptor Bean Types property in your module configuration.
  • Restart the module.

51.1.3.3Using Terminology Translate operation in interceptors

HL7V2IN_PRE_HL7V2_TO_FHIR_MAPPING_PROCESSING and HL7V2IN_POST_HL7V2_TO_FHIR_MAPPING_PROCESSING pointcuts can autowire an ITermConceptClientMappingSvc in order to perform ContextMap translations.

For this bean to be available for autowiring, the HL7V2 inbound module must have a persistence dependency configured any FHIR Storage Module (any FHIR version).

This sample project uses the HL7V2IN_PRE_HL7V2_TO_FHIR_MAPPING_PROCESSING and HL7V2IN_POST_HL7V2_TO_FHIR_MAPPING_PROCESSING pointcuts with an autowired ITermConceptClientMappingSvc which allows performing ConceptMap translations. You can see this code in the com.example.endpoint.hl7v2.inbound.term package.

51.1.3.4Using Transaction Bundle Building Helper in interceptors

HL7V2IN_PRE_HL7V2_TO_FHIR_MAPPING_PROCESSING and HL7V2IN_POST_HL7V2_TO_FHIR_MAPPING_PROCESSING pointcuts can instantiate a BundleBuilder by autowiring a FhirContext and using it as constructor parameter, in order to facilitate transaction bundle building.

A sample project that uses the HL7V2IN_PRE_HL7V2_TO_FHIR_MAPPING_PROCESSING pointcut to instantiate a BundleBuilder can be seen in the com.example.endpoint.hl7v2.inbound.transaction package of this demo project.

51.1.4Camel Demo Project

 
Before you download and use this demo project, it is recommended to have read the Camel Overview documentation page.

The Camel Demo Project includes sample routes, context configuration classes, and processors.

51.1.4.1Downloads

51.1.4.2Instructions

As camel is slightly more complex than the basic interceptors, see the camel page for detailed packaging and deployment instructions.

51.1.4.3Sample Route Using Example Project

This project uses the Timer Component to create a Message every second with an empty body. This Message is then passed to the TestCustomProcessor which calls the process(Exchange) method. This method simply logs the incoming Message body and headers, modifies them, and then logs them again.

Here is the route in the XML format:

<route>
	<from uri="timer:test"/>
	<to uri="bean:testCustomProcessor"/>
</route>

Here is the same route in YAML format:

   - from:
      uri: "timer:test"
      steps:
        - to:
            uri: "bean:testCustomProcessor"

51.1.5CDS Hooks Demo Project

 
Before you download and use this demo project, it is recommended to have read the CDS Hooks documentation page.

51.1.5.1Downloads

51.1.6Custom Resources Demo Project

 
Before you download and use this demo project, it is recommended to have read the Custom Resources documentation page.

51.1.6.1Downloads

51.1.6.2Instructions

  • Follow the basic instructions to create your jar.
  • Place this JAR file in the customerlib/ directory within your Smile CDR installation.
  • Populate the Custom Resource Types configuration item on your Persistence Module with the fully-qualified class names of your custom resources.

51.1.7Hybrid Provider Demo Project

 
Before you download and use this demo project, it is recommended to have read the Hybrid Providers documentation page.

51.1.7.1Downloads

51.1.7.2Instructions

Instructions on how to write a Hybrid Provider can be found in the Hybrid Providers Intro page. Once the code is written, it can be packaged as follows.

  • Follow the basic instructions to create your JAR.
  • This JAR should be placed in the customerlib/ directory of the Smile CDR installation
  • Restart Smile CDR.
  • Populate the Spring Context Config Class property of the Hybrid Providers module with the fully qualified class name for your Spring Context Config Class.
  • Restart the Module.

51.1.8Outbound Security Demo Skin Project

 
Before you download and use this demo project, it is recommended to have read the SMART Outbound Security Skinning documentation page.

51.1.8.1Downloads

51.1.8.2Instructions

  • A sample set of skin files can be found in the path src/main/resources. You can modify these files to your liking, or replace them entirely with new files with the same names, at the same path.
  • Follow the basic instructions to create your JAR.

51.1.9International Patient Summary Demo Project

 
Before you download and use this demo project, it is recommended to have read the IPS documentation.

51.1.9.1Downloads

51.1.9.2Instructions