Meaningful Use Validator based on NIST’s own.
NIST’s Meaningful Use Validator is great to check if your CCDs are valid. However it runs as as a Command Line Utility that outputs XML. If you want to make validation part of your unit tests, you need it to be callable from code. This project aims to do just that. NIST made its code available here. Also they consider their code to be public domain. That makes it possible for this project to exist. I am thankful for that.
This supports the legacy CLI usage as well as programmatic usage
Download the jar from here
Then use it
java -jar muval-all.jar -input sampleCCD.xml -output result.xml
Import the dependency using maven, gradle, sbt, leingen or ivy. Example below is for gradle. Look up instructions for your build tool from this badge.
dependencies {
// ...
compile 'com.github.rahulsom:muval:<VERSION>'
}
Then use it in your code. This example is a Spock Specification. You could use it in test or production code.
import spock.lang.Specification
import static gov.nist.mu.validation.Rulesets.*
import static gov.nist.mu.validation.Validator.validate
class MyCcdSpec extends Specification {
private InputStream file(String resourceName) {
this.class.getClassLoader().getResourceAsStream(resourceName)
}
def "sample ccd should validate"() {
when: "I validate a CCD"
def result = validate(Cdar2c32, file('SampleCCDDocument.xml'), Ccd, Cda4Cdt, C32_v_2_5_c83_2_0)
then: "There are 50 errors and 98 issues"
result.allIssues.size() == 98
result.errors.size() == 50
result.otherIssues.isEmpty()
}
}
The downloadResources
task will do the job. You need to delete the nist
directory before that.
./gradlew downloadResources
If you run into network problems, you may rerun that command.