5 Jun 2015

CDA®R2 Validator Jar available for distribution

Submitted by Eric Poiseau

Following the Gazelle ObjectsChecker presentation at IHIC in Pragues in February 2015, we are posting here the JAR file for checking the conformance of a CDA® document to the HL7® CDA® R2 specification. 

The jar file can be downloaded here 

T he aim of this jar is to validate CDA® document with avoiding access to internet resources as gazelle ValueSet provider, or EVSClient resources (http://gazelle.ihe.net/EVSClient). There are two possible use cases of this jar : 

  1. using the jar as an executable (.sh for unix system / .bat for windows system)
  2. including the jar on a pre-existing java project, and using classes of the tool for validation.

1 - using the jar as a part of an executable (or command line interface CLI)

We have created this executable, so a user can specify the file to be validated and the CDA® validator to be used. 

After unzipping the downloaded file, you will find that it contains two repository : bin and repo. By accessing to the folder bin you will find two files : validator.sh and validator.bat, the first for unix systems, the second shall be used for windows systems.

Example of use : 

You can execute these command line on the repository bin :

chmod u+x validator.sh
./validator.sh -path ../samples/test_CDA.xml -out ../samples/res.xml ;        #### generates XML validation result
./validator.sh -path ../samples/test_CDA.xml -out ../samples/res.html -html ; #### generates a html output 

 

if you run the validator.sh from a folder which is not the bin folder, you have to add the reference to the resources folder, which contains the schema for the XSD validation, the valueSet used on the validation, and the xsl that allow to generate html result, example of use : 

 ./validator.sh -path ../samples/test_CDA.xml -out ../samples/res.html -html -resources /home/users/..../bin/resources/

 

for windows users : 

./validator.bat -path ../samples/test_CDA.xml -out ../samples/res.html -html  ==> generate a html output
./validator.bat -path ../samples/test_CDA.xml -out ../samples/res.xml ==> generate XML validation result

 

The option -html if presents will indicate that the output result is a html result

The option -out if presents will indicate the outputFile in which the validation result is saved. If -out is not present, the validation result will be printed on the console 

to view the documentation of the different attributes supported by the tool : ./validator.sh -help

II - include the jar on a pre-existing java project

a - maven project

To use the jar on a pre-existing maven project, you have only to add the dependency of the jar to your pom.xml

<dependency>
<groupId>net.ihe.gazelle.cdabasic.validator</groupId>
<artifactId>cdabasicapp-validator-jar</artifactId>
<type>jar</type>
<version>x.x</version>
</dependency> 

You have also to add in your miror project the path to the repository of gazelle on your pom.xml : 

 

<repositories>
<repository>
<id>irisa-sumo</id>
<name>Sumo Irisa Public Maven Repository Group</name>
<url>http://gazelle.ihe.net/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

 

The class to be used for the validation is net.ihe.gazelle.cdabasic.validator.GazelleValidatorCore.validateDocument(String document, String validator) where 

  • document : the CDA XML document to be validated
  • validator : "HL7 - CDA Release 2 (strict)"

And , before calling this method, you have to configure the properties of the validator : 

  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.CDA_XSD : url to basic CDA schema
  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.CDA_XSL_TRANSFORMER : url to the xsl for transaformation of the result to HTML
  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.VALUE_SET_REPOSITORY : url to the repository containing all the valueSet for validation

 b - ant project

 You have to add all the jar on the repository "repo" on the lib folder of your project

 The class to be used for the validation is net.ihe.gazelle.cdabasic.validator.GazelleValidatorCore.validateDocument(String document, String validator) where 

  • document : the CDA XML document to be validated
  • validator : "HL7 - CDA Release 2 (strict)"

And , before calling this method, you have to configure the properties of validator : 

  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.CDA_XSD : url to basic CDA schema
  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.CDA_XSL_TRANSFORMER : url to the xsl for transaformation of the result to HTML
  • net.ihe.gazelle.cdabasic.utils.ProjectDependencies.VALUE_SET_REPOSITORY : url to the repository containing all the valueSet for validation

source files : you can checkout sources of the project from https://scm.gforge.inria.fr/anonscm/svn/gazelle/validators/packaging/cdabasicapp-validator-jar/

svn co https://scm.gforge.inria.fr/anonscm/svn/gazelle/validators/packaging/cdabasicapp-validator-jar/