MDHT Template Sub Project

From HL7Wiki
Jump to navigation Jump to search

Back to Structured Document Template Design Pilot

Overview

The goal of this pilot is to demonstrate how the Model-Driven Health Tools (MDHT) CDA Tools project can be used to author, publish, validate, and implement CDA templates. Using a model-driven tooling architecture, the template specification model in UML is used to generate a published implementation guide, example XML instances, and an EMF-based Java runtime API that supports programmatic production, consumption, and validation of CDA XML instances.

Project leads:

  • Dave Carlson (VA contractor): dcarlson@xmlmodeling.com, or David.Carlson@va.gov
  • John Timm (IBM Research Labs): johntimm@us.ibm.com

Project Status

  • Milestone 1 -- February 26, 2010
    • Completed UML model of all pilot conformance rules
    • Generated implementation guide to PDF and Eclipse Help format (html)
    • Generated Java runtime classes for creating, consuming, and validating CDA instances based on the pilot templates. Wrote small test Java program to demonstrate use.
    • Total time to review requirements and complete these three steps: 2 hours
  • Milestone 2 -- March 26, 2010
    • Updated value set representation
    • Updated implementation guide publishing to include CDA base type hyperlinks
    • See example published guide below
  • Milestone 3 -- April 30, 2010
    • Completed example web application for validating CDA documents
    • Validated sample documents for this pilot and linked results to this page
  • Milestone 4 -- May 7, 2010
    • Add prototype for XML instance generation from template model
    • Add prototype for instance validation in Eclipse XML editor
  • Next steps:
    • Expand example Java program to illustrate embedding TB Progress Note in a small application
    • Collaborate with architectural integration analysis

Deliverables

Presentation slides for May 2010 working group meeting:

Template Authoring

We created a UML class for each template and specified all conformance rules using property redefinitions, directed associations, and directly using OCL expressions (for only one rule).

We have found that the most intuitive and efficient editor for template definitions is a spreadsheet-style table editor. This editor directly modifies the underlying UML model, but with a different interface from the typical class diagram.

MDHT TableEdior.jpg

We are working on integrating an open source UML class diagram editor provided by the Eclipse UML2Tools project, but it is not yet ready for end-users. When templates are created using the table editor, one or more class diagrams may be created as views of the model. For example,

MDHT-CDA-pilot-diagram.png

Implementation Guide Publishing

The UML model created with template definitions is automatically transformed to DITA XML (OASIS standard), which is then published to PDF and Eclipse Help HTML format using the open source DITA-OT toolkit.

We have received several requests for an alternative implementation guide format that is tailored to developers, and not to standards committees. They have asked for each template to include the complete aggregate list of all inherited elements and conformance rules. Thus, a developer does not need to "follow the breadcrumbs" of template conformance references.

An implementation guide formatted for developers is included here as PDF:

We are working on a new feature to automatically generate XML example snippets for every template (from the UML model representation) and insert this into the published implementation guide. This is not yet complete (still missing some inherited template associations and sample attribute data), but is very promising. See, for example, the TB Result Organizer template.

  <organizer moodCode="EVN">
    <templateId root="2.16.840.1.113883.10.20.1.32"/>
    <templateId root="2.16.840.1.113883.10.20.15.3.21"/>
    <id root="35428f7f-f994-44e4-a83c-d6eb374b1982"/>
    <code codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
    <statusCode/>
    <component>
      <observation classCode="OBS" moodCode="EVN">
        <templateId root="2.16.840.1.113883.10.20.1.31"/>
        <templateId root="2.16.840.1.113883.10.20.15.3.13"/>
        <id root="b7e48f8f-bda4-4d9c-be57-151c25a655c7"/>
        <code codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
        <statusCode code="completed"/>
        <effectiveTime>
          <low value="1972"/>
          <high value="2008"/>
        </effectiveTime>
        <interpretationCode/>
        <methodCode/>
      </observation>
    </component>
  </organizer>

Instance Validation

The template conformance rules represented in UML are transformed to OCL as part of the automated code generation. The resulting Java classes encapsulate all validation rules and may be used to parse and validate a CDA document instance. We have created an example web application (deployed using Apache Tomcat) that may be used to validate CDA documents for implementation guides that we have modeled. This pilot project model is included in the example site.

You may click the following URL link to upload and validate the 7 sample documents for this project:

Validation results captured as PDF from browser:

We are also starting work on integrating validation from the generated Java libraries into the Eclipse open source XML instance editor. This editor already includes good support for "content assist" and validation based on the CDA.xsd schema. But we have used the Eclipse extension points to also validate CDA instances using the conformance rules that go beyond schema structure.

Here is a screen shot of the XML instance editor showing validation errors for one of the pilot sample documents. We hope to include this editor validation support in the next milestone of MDHT CDA tools. MDHT CDAInstanceEditorValidation.jpg

Architectural Integration

An example application developer scenario would be to use the generated Java library to create an EHR system adapter that exports CDA TB Progress Note instances for exchange with external entities, or receive TB Progress Note instances and load them into domain-specific Java objects that may be processed to display or import data into the EHR system, and to validate instance (imported or exported) for conformance to the implementation guide template rules.

Generate Java-based Runtime API

The UML template model is transformed and imported into EMF, which is used to produce Java source code that supports:

  • Programmatic creation of CDA documents based on this implementation guide and serialization to conformant CDA instances
  • Parsing CDA XML documents into the domain-specific Java classes for this guide, which can then be used to process the contents, e.g. to import the data into other EHR applications
  • Validate CDA documents for conformance with this guide's templates

A simple Java program was written that creates a partial CDA document for this guide. We will expand the example during the next project milestone.

This program produces the following CDA document:

<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
  <templateId root="2.16.840.1.113883.10.20.15.2.6.1.1.1.1.1.2.3"/>
  <recordTarget>
    <patientRole>
      <patient>
        <name><family>Doe</family><given>John</given><prefix>Dr.</prefix></name>
        <name><family>Doe</family><suffix>M.D.</suffix></name>
      </patient>
    </patientRole>
  </recordTarget>
  <component>
    <structuredBody>
      <component>
        <section>
          <templateId root="2.16.840.1.113883.10.20.1.14"/>
          <templateId root="2.16.840.1.113883.10.20.15.2.6"/>
          <code code="30954-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Relevant diagnostic tests and/or laboratory data"/>
          <title>Relevant diagnostic tests and/or laboratory data</title>
          <entry>
            <organizer classCode="BATTERY" moodCode="EVN">
              <templateId root="2.16.840.1.113883.10.20.1.32"/>
              <templateId root="2.16.840.1.113883.10.20.15.3.21"/>
              <code codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
              <component>
                <observation classCode="OBS" moodCode="EVN">
                  <templateId root="2.16.840.1.113883.10.20.1.31"/>
                  <templateId root="2.16.840.1.113883.10.20.15.3.13"/>
                  <code code="645-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
                  <statusCode code="completed" codeSystem="2.16.840.1.113883.5.14" codeSystemName="ActStatus"/>
                </observation>
              </component>
            </organizer>
          </entry>
        </section>
      </component>
    </structuredBody>
  </component>
</ClinicalDocument>

Using the generated Java classes to validate this sample yields the following validation errors:

ERROR: Diagnosis of org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}
ERROR: The required feature 'id' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' must be set
ERROR: The required feature 'code' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' must be set
ERROR: The required feature 'effectiveTime' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' must be set
ERROR: The required feature 'confidentialityCode' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' must be set
ERROR: The feature 'author' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' with 0 values must have at least 1 values
ERROR: The required feature 'custodian' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TuberculosisFollowUpProgressNoteImpl@1412e75{urn:hl7-org:v3#//@clinicalDocument}' must be set
ERROR: CCD Results Section SHALL contain [1..1] text
ERROR: TBPN TB Results Section SHALL contain [1..1] text
INFO: TBPN TB Results Section MAY contain [0..*] entry such that it, SHALL contain [1..1] @typeCode="DRIV" DRIV (is derived from), SHALL contain [1..1] TB Result Organizer (templateId: 2.16.840.1.113883.10.20.15.3.21)
INFO: TBPN TB Results Section MAY contain [0..*] entry such that it, SHALL contain [1..1] @typeCode="DRIV" DRIV (is derived from), SHALL contain [1..1] TB Result Observation (templateId: 2.16.840.1.113883.10.20.15.3.13)
ERROR: The required feature 'statusCode' of 'org.openhealthtools.mdht.uml.cda.pilot.impl.TBResultOrganizerImpl@1dfc8a0{urn:hl7-org:v3#//@clinicalDocument/@component/@structuredBody/@component.0/@section/@entry.0/@organizer}' must be set
ERROR: CCD Result Organizer SHALL satisfy: Contains one or more sources of information.
ERROR: CCD Result Organizer SHALL contain [1..*] id
ERROR: CCD Result Organizer SHALL contain [1..1] statusCode
ERROR: TBPN TB Result Organizer SHALL contain [1..1] code, which SHALL be selected from ValueSet 2.16.840.1.114222.4.11.3205 Lab Test Result Name (TB) DYNAMIC
WARNING: CCD Result Observation SHOULD satisfy: Contain one or more referenceRange to show the normal range of values for the observation result
ERROR: CCD Result Observation SHALL satisfy: Contains one or more sources of information.
ERROR: CCD Result Observation SHALL contain [1..*] id
WARNING: CCD Result Observation SHOULD contain [1..1] effectiveTime
INFO: CCD Result Observation MAY contain [0..1] methodCode
WARNING: CCD Result Observation SHOULD contain [0..*] interpretationCode
ERROR: CCD Result Observation SHALL contain [1..1] value