Validate CDA

Using general API’s to validate instance against constraints in the model.


There are two types of validation at work. Schema validation takes place on a DOM-based representation of the document to ensure the document is conformant to the base CDA standard. The results of schema validation are stored in the validation result object. Then the EMF deserializer converts the DOM-based representation into an EMF representation. After conversion, EMF validation is performed. This ensures the EMF-based representation is conformant to the constraints defined in the template model. These two types of validation are used together to achieve complete validation. Different Validators process the content tree and produce diagnostics. Diagnostics contain information about a constraint that was violated. This includes severity, source, target and message. Severity of the constraint violation is one of ERROR, WARNING or INFO. Source is the fully-qualified name of the Validator that produced the diagnostic. Target is the object being validated. Message is a human-readable informational message related to the constraint that was violated. Typically this would be in the form of a structured English conformance statement such as: " CCD Medication Activity SHOULD satisfy: Contains exactly one doseQuantity or rateQuantity. (CONF-311)"

Another option is to validate a clinical document object after it has been deserialized. This will check the document against IG-specific constraints defined in the template model and will check partial base schema conformance. The BasicValidationHandler class allows the developer to implement which diagnostics to respond to by overriding the handleError, handleWarning and handleInfo methods.