onc-healthit / reference-ccda-validator

Deployable C-CDA Validator war source code. Use this repository to build and deploy a validator on your local environment.
BSD 2-Clause "Simplified" License
35 stars 37 forks source link

Support

GitHub Issues are not used to manage issues for this repository. Please report any issues you may have on the ETT Google Group. Our technical team will address all questions there. Thank you.

Reference C-CDA Configuration and Deployment

This document is meant to outline the steps to successfully configure and deploy the reference ccda application.

If you would like to get a test virtual machine up and running quickly, check out https://github.com/mieweb/vagrant-ccda-validator for a Vagrant build or https://github.com/mieweb/docker-ccda-validator for a docker container. Note: These are 3rd-party options and are not directly supported by SITE/the ONC. They intend to pull, configure, and deploy the data from our codebase based on these instructions. Otherwise, please continue to follow the full instructions below to create a local, external, or customized instance of the validator.

1. Assumptions

a. Tomcat 8.5.x (8.5.81 recommended) or above has been installed and NOT running. ((https://tomcat.apache.org/download-80.cgi#8.5.85))
b. You are using a pre-built referenceccdaservice.war file. In other words, the .war file was not built from the project directly.
    Such a thing is possible but beyond the scope of this document.
c. With Tomcat installed and the referenceccdaservice.war in your hands, you are ready to begin configuration and deployment.
d. Java 8 is installed and a JAVA_HOME is set. We do not support any Java version above JDK 8.

2. Configuration Instructions

Vocabulary Artifacts

  1. Create a directory that will hold the vocabulary artifacts. For example, path/to/configs_folder
      a. this folder will contain the needed vocabulary configuration files

  2. Place the default ccdaReferenceValidatorConfig.xml in this folder. For example, path/to/configs_folder/ccdaReferenceValidatorConfig.xml. This file is located in this repository.
      a. this file contains the xpath expressions that target particular nodes in the given C-CDA to be validated. Each expression is configured with at least one validator. For example:
       <expression xpathExpression="/v3:ClinicalDocument/v3:templateId[@root='2.16.840.1.113883.10.20.22.1.1' and @extension='2015-08-01']/ancestor::v3:ClinicalDocument[1]/v3:confidentialityCode[not(@nullFlavor)]">
              <validator>
                  <name>ValueSetCodeValidator</name>
                  <validationResultSeverityLevels>
                      <codeSeverityLevel>SHOULD</codeSeverityLevel>
                  </validationResultSeverityLevels>
                  <allowedValuesetOids>2.16.840.1.113883.1.11.16926</allowedValuesetOids>
              </validator>
          </expression>
3. Create a local directory for Codes, Valuesets and Scenario files. For example,
   a. path/to/validator_configuration/vocabulary/code_repository/
   b. path/to/validator_configuration/vocabulary/valueset_repository/VSAC/
   c. path/to/validator_configuration/scenarios/

4. Optional: Add custom configurations to the existing path (path/to/your/configs_folder) or create a separate local directory for your custom vocabulary configurations (xml files). Using the existing path is preferred but either option works fine. This allows one to take advantage of dynamic vocabulary configurations which can be changed in realtime for each validation via the API by sending the "vocabularyConfig" key and the filename without extension as the value. The default configuration file is the one that was added earlier and is located in this repository (ccdaReferenceValidatorConfig.xml). If "referenceccda.isDynamicVocab" is set to "false" or not set at all the default file (ccdaReferenceValidatorConfig.xml) will be used. If it is set to "true" and the path is set as described, one can use any config in the directory.

NOTES:

The referenceccdaservice.war

1. Navigate to the webapps directory in your Tomcat instance. For example, ~/apache-tomcat-7.0.53/webapps
2. Place the referenceccdaservice.war file here

Server Configuration

1. Place a copy of referenceccdaservice.xml in $CATALINA_BASE/conf/[enginename]/[hostname]/
Note: You will likely be using the "Catalina" engine and the default host for Tomcat is "localhost". 
For example, ~/apache-tomcat-7.0.53/conf/Catalina/localhost

At this point, your directory structure should contain at least the following:
-tomcat
--conf
---Catalina
----localhost
----referenceccdaservice.xml
--webapps
---referenceccdaservice.war  

2. Edit the referenceccdaservice.xml key values to point to the locations configured in the previous steps and setup other values. For example:
        <Context reloadable="true">
            <Parameter name="vocabulary.localCodeRepositoryDir" value="path/to/your/code_repository" override="true"/>
            <Parameter name="vocabulary.localValueSetRepositoryDir" value="path/to/your/valueset_repository" override="true"/>
            <Parameter name="referenceccda.configFile" value="path/to/your/configs_folder/ccdaReferenceValidatorConfig.xml" override="true"/>
            <Parameter name="referenceccda.isDynamicVocab" value="false" override="true"/>
            <Parameter name="referenceccda.configFolder" value="path/to/your/configs_folder" override="true"/>
            <Parameter name="content.scenariosDir" value="path/to/your/scenarios_directory" override="true"/>

            <Parameter name="keycloak.enabled" value="false" override="true"/>
            <Parameter name="keycloak.auth.server" value="Replace with KeyCloak auth URL" override="true"/>
            <Parameter name="keycloak.realm" value="Replace with KeyCloak Realm" override="true"/>
            <Parameter name="keycloak.client.id" value="Replace with KeyCloak client id for introspect" override="true"/>
            <Parameter name="keycloak.client.secret" value="Replace with KeyCloak client secret for introspect" override="true"/>
         </Context>

3. To disable KeyCloak set keycloak.enabled flag to false

3. Run the application

1. Start your tomcat instance - you should see output showing the databases getting initialized and the .war file getting deployed.
NOTE: Allow a few minutes for the vocabulary valuesets and codes to be inserted into the in-memory database.
2. Access the endpoint. For example, localhost:8080/referenceccdaservice/
3. For convenience, API documentation and a validation UI is included:
    API documentation - /referenceccdaservice/swagger-ui.html
    UI - referenceccdaservice/ui

4. Troubleshooting (please feel free to submit PRs with updates from your own issues/solutions)

5. API Usage