Docstoc

HL Implementation

Document Sample
HL Implementation Powered By Docstoc
					               HL7 version 3

In-memory object processing

 Scope: object based onformance/validation testing, class generators,
                      M2M transoformations


   Slide contents published under the Creative Commons / Attribute-Share Alike license
   Source: www.ringholm.de/download/HL7v3_implementation.zip


 Ringholm bv                      Integration Consulting
                 Agenda

• Class generators
  – MDE principles
  – MIF/Schema based generators
• M2M transformations
  – Model versioning
• OO-based conformance/validation
• Implementation experiences


    Ringholm bv    Integration Consulting   2
        RIMBAA Technology Matrix
                            Persistent        Object          Serialized
     (generic)            Representation   Representation   Representation
      Model


                            RP               RO               RS
       RIM
Application Constrained
 specific Information




                            CP               CO               CS
              Model
               RIM


  Model




                             AP              AO               AS

    Ringholm bv                             Integration Consulting
In-memory object processing

            Class Generators



   Slide contents published under the Creative Commons / Attribute-Share Alike license
   Source: www.ringholm.de/download/implementation_mechanics.ppt


  Ringholm bv                     Integration Consulting
    Traditional Software Development




   Gather                       Build
requirements
                Image credits: Johan den Haan, Mendix.nl
       Ringholm bv    Integration Consulting
Model Driven Software Development
              (MDD)




 Model                                Generate

           Image credits: Johan den Haan, Mendix.nl
   Ringholm bv      Integration Consulting
MDD - Application Generation

                                       Generic Software
                                         Components
                                       -Terminology
                                          -Data types




                   Software
                  application



                                               RIM




                                            Persistence
                                             Database


Ringholm bv   Integration Consulting
MDD –Prescription Example

    • RIM based
      model for
      Prescription
    • Business                          Software
                                       application
      workflow
    • Exchange
      Pattern


Ringholm bv   Integration Consulting
            Class-based Parsing
• Class generators – XML Schema driven
  – Every major development platform provides
    tools to generate classes from XML Schemas
  – E.g. JAXB, .NET Framework/Mono (XSD.EXE), XML
    Beans…
• Class Generators – Model driven
  – Model Driven Software development
    environments allow classes to be generated
    from (UML-) models
  – E.g. MARC Everest API Generator (XML ITS/RIM ITS)


      Ringholm bv      Integration Consulting
           Class-Based Parsing
            Using Coding Techniques

        Pros                             Cons

• Don‟t have to learn        • Harder to build
  XML, XSD, XSLT,              loosely coupled
  XQuery…                      systems
• Use OO frameworks          • Somewhat harder to
• Faster processing            maintain
                             • Bottom-up approach
                               might create some
                               level of duplication
                               in generated classes

       Ringholm bv      Integration Consulting
     Model based code generation
• Full (abstract) model specification is stored in
  a model repository (RoseTree)
   – Abstract model is expressed as a MIF (Model
     Interchange Format) file
   – MIF can be transformed to less expressive XML
     Schema
• Code generation
   – MIF (to alternate model representation, e.g. UML)
     to code (e.g. MDHT)
   – XML Schema to code (e.g. JAXB xjc)



     Ringholm bv        Integration Consulting
Note: Automatic Code Generation
                                     Schema-
                CDA R-MIM             based
                 XML ITS
                 Schema                code
                                    generation


                CDA R-MIM
                   MIF             MIF-based
    HL7v3
     Model                           code
   Repository    Template          generation
                   MIF




                 Template
                XML Schema




  Ringholm bv       Integration Consulting       12
    Code Generation

MIF Based Code Generation




 Ringholm bv   Integration Consulting   13
        MIF Based Code Generator
• Full (abstract) model specification is stored in a
  model repository (RoseTree)
   – Abstract model is expressed as a MIF file – including
     GELLO/OCL expressions and (DCM derived)
     Template definitions
• Code (class) generation
   – MIF - the code generator has to be aware of
     the structure of the MIF
   – UML/EMF (derived from the MIF) - the code generator
     has to know UML/EMF, including the v3 specific
     extensions

       Ringholm bv        Integration Consulting
              MIF v. Derived model

MIF                                Derived (e.g. UML, Schema)
• Normative (full) specification   • Derived (lossy)
  of a v3 model, inclusive of        specification of v3
  documentation                      model
• Full validation support          • Cross-industry tools
• No cross-industry tools for        for code generation
  class generation
• MIF based class generators
  are being created: MRC-HI
  Everest, OHT


        Ringholm bv        Integration Consulting           15
          Programming Components
Target       Target             code




                                                                 XML encoding/decoding
Model        Model
                          Terminology server




                                                 Serialization
 DSL          MIF             API + data
             Vocab           Reusable
              MIF           components
             CMET           Datatypes
              MIF          Custom code

             Wrapper           Code generation
              MIFs             Model transform




         Ringholm bv   Integration Consulting                                            16
          Target Model / code

• Target Model = payload/focal model
• Based on MIF or DSL
  – Use either MIF or DSL, mixing the two
    doesn‟t tend to work too well
• Preserve all information during code
  generation, inclusive of all
  documentation


    Ringholm bv     Integration Consulting   17
      Vocabulary / Term. Server API

• The management of vocabulary
  definitions and terminology services.
   – CTS API, Terminology Server


(persisting vocabulary is the subject of an upcoming module)




       Ringholm bv           Integration Consulting            18
        Reusable Components

• Common model components:
  – E.g. CMETs, message wrappers
• Generate code for [universal] CMETs
  – All other CMET flavors (e.g. [identified],
    [identified-confirmable]) can be processed
    by the generated code.




    Ringholm bv     Integration Consulting       19
       Data Types – custom code

• Custom library with support for v3 data
  types
  – Mostly: ISO data types, patched to support data
    types R1 as well
  – Relationship with Terminology Server (C* data
    types)
  – Needs custom coding: data types MIF is abstract.
• Mohawk (.net) and OHT (Java) contain such
  libraries
  – Or use datatypes.xsd as the basis for development

     Ringholm bv        Integration Consulting          20
  Serialization – XML En/DeCoding

• Serialization engine
  – Serialize RIM structures according to HL7
    rules
• XML En/DeCoding
  – Encoding of a serialized graph
  – Rules as specified by the ITS (e.g. XML
    ITS, RIM ITS)



    Ringholm bv     Integration Consulting      21
      Code Generation

Schema Based Code Generation




  Ringholm bv   Integration Consulting   22
   Schema based code generation

• Advantage: wide availability of tools
• Serious disadvantage: XMl schema
  language isn‟t powerful enough to
  express all model requirements
• Disadvantage when validating
  templates (in-memory, not on serialized
  format): Templates are expressed in
  MIF, there is no Schema version.

    Ringholm bv   Integration Consulting    23
Schema's serve multiple masters
• Schema‟s serve more than one purpose
  –   design
  –   validation
  –   contract
  –   code generation
• those purposes often need different
  Schema‟s
• For code generation:
  + simplicity, readability
  - reuseability, composability
                                  Slide courtesy of: Marc de Graauw
       Ringholm bv       Integration Consulting
                                                                                  XML ITS

                        The HL7v3 Schema‟s
XML ITS Example:
QUPA_IN101102UV01 Get Person Demographics Query

•   MCCI_MT000300UV01
     –   COCT_MT040203UV01
          •   COCT_MT150003UV03
          •   COCT_MT030203UV02
•   MFMI_MT700711
     –   COCT_MT090300UV01
          •   COCT_MT150000UV02
                –   COCT_MT070000UV01
                       •  COCT_MT710000UV01
          •   COCT_MT150003UV03
          •   COCT_MT070000UV01
                –   COCT_MT710000UV01
     –   COCT_MT090100
          •   COCT_MT150000UV02
                –   COCT_MT070000UV01
                       •  COCT_MT710000UV01
          •   COCT_MT150003UV03
          •   COCT_MT070000UV01
                –   COCT_MT710000UV01
     –   COCT_MT090003
          •   COCT_MT150003UV03
     –   MCAI_MT900001
•   QUPA_MT101102_V01
•   QUPA_MT101101_V01                         ..and: voc, datatypes, infrastructureRoot


                                                     Slide courtesy of: Marc de Graauw
              Ringholm bv                     Integration Consulting
                                                            XML ITS

Remove „includes‟ from v3 Schema‟s
• Schema‟s should be readable
  – tools can solve this
  – but they make you dependent on the tool
• Therefore: flatten the Schema‟s
  – remove all includes
  – put included schema‟s where they belong
• For readability: make the Schema resemble
  the instance
• Readable Schema‟s generate readable code!

                            Slide courtesy of: Marc de Graauw
     Ringholm bv       Integration Consulting
                                                                      XML ITS
  Datatype schema transformation
• Constrain data type definitions in XSD (data type
  flavors used by realm or an implementation)
• Transform HL7 datatypes to XSD datatypes
  – e.g. TS: datetime, CS,ST: string
  – With a lot of HL7 datatypes, nothing happens except
    translation to XSD datatypes.
     • Some mappings (e.g. TS to datetime) have issues associated with
       them.
     • Mostly gets rid of nullFlavour support
• Do this in the source, generates much more
  readable code

                                  Slide courtesy of: Marc de Graauw
        Ringholm bv           Integration Consulting
                                                                                          XML ITS
                         Data Type schema
<xs:complexType name="QUPA_IN101102MdG.MCCI_MT000300UV01.Message">
    <xs:sequence>         Transformation
       <xs:element name="id" type="II"/>
 TS    <xs:element name="creationTime" type="xs:date"/>
 ST    <xs:element name="securityText" type="xs:string" minOccurs="0"/>
 CS    <xs:element name="versionCode" type="xs:string" minOccurs="0"/>
       <xs:element name="interactionId" type="II"/>
       <xs:element name="profileId" type="II" minOccurs="0" maxOccurs="unbounded"/>
 CS    <xs:element name="processingCode" type="xs:string"/>
 CS    <xs:element name="processingModeCode" type="xs:string"/>
 CS    <xs:element name="acceptAckCode" type="xs:string"/>
 ED    <xs:element name="attachmentText" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
       <xs:element name="receiver" type="MCCI_MT000300UV01.Receiver" maxOccurs="unbounded"/>
       <xs:element name="sender" type="MCCI_MT000300UV01.Sender"/>
    </xs:sequence>
  </xs:complexType>

 <xs:complexType name="II">
   <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="root" type="oid" use="optional"> </xs:attribute>
        <xs:attribute name="extension" type="xs:string" use="optional"> </xs:attribute>
        <xs:attribute name="assigningAuthorityName" type="xs:string" use="optional"> </xs:attribute>
        <xs:attribute name="displayable" type="xs:boolean" use="optional"> </xs:attribute>
      </xs:extension>
   </xs:simpleContent>
                Ringholm bv
 </xs:complexType>
                                               Integration Consulting September 200828
                                   Creative Commons Attribute-Share
                                   Alike
                                                                                       XML ITS
                                       VB Code
Partial Public Class QUPA_IN101102MdGMCCI_MT000300UV01Message
   Private idField As II
   Private creationTimeField As Date
   Private securityTextField As String       '''
                                                 Public Property id() As II
   Private versionCodeField As String
                                                     Get
   Private interactionIdField As II                    Return Me.idField
   Private profileIdField() As II                    End Get
   Private processingCodeField As String             Set
   Private processingModeCodeField As String           Me.idField = value
   Private acceptAckCodeField As String              End Set
   Private attachmentTextField() As String       End Property
   Private receiverField() As
                                                 '''
           MCCI_MT000300UV01Receiver             <System.Xml.Serialization.
   Private senderField As                                 XmlElementAttribute(DataType:="date")> _
           MCCI_MT000300UV01Sender               Public Property creationTime() As Date
                                                     Get
                                                        Return Me.creationTimeField
VB code generated for the example                    End Get
query interaction decreased in size                  Set
                                                        Me.creationTimeField = value
from 540 kb to 164 kb – with the                     End Set
exact same functionality                           End Property


             Ringholm bv Integration Consulting
[Marc de Graauw, BC CA project].
                                                                          XML ITS


HL7 Medical Application                                             HL7v3
                                                                    Medical
                                                                    Content

HL7 Control Query Processing Application                             HL7v3
                                                                     Acts


HL7 Transmission Wrapper Adapter
                                                                   HL7v3
                                                                   Messages


HL7 web services Messaging Adapter
                                                                  SOAP
                                                                  Messages

HTTP Client / Server

                                      Slide courtesy of: Marc de Graauw
          Ringholm bv              Integration Consulting
                                                          XML ITS
           The HL7v3 Schema‟s
• layer the Schema‟s
• anonimyze with xs:any
  – <xs:any namespace="##any"
    processContents="skip" minOccurs="0"
    maxOccurs="unbounded"/>
• SOAP Headers, soap:Body anon
• HL7 Transmission Wrapper, Act anon
• HL7 Act Wrapper, medical payload
  anon
                          Slide courtesy of: Marc de Graauw
      Ringholm bv    Integration Consulting
                                                   XML ITS

              SOAP
        Transmission
        Wrapper

          Control
          Wrapper

          Payload
          Data




                   Slide courtesy of: Marc de Graauw
Ringholm bv   Integration Consulting
                                                        XML ITS


SOAP
ANY
         Transmission
         Wrapper
            ANY
                               Control
                               Wrapper
                                  ANY

                                                   Payload
                                                   Data




                    Slide courtesy of: Marc de Graauw
  Ringholm bv   Integration Consulting
                                                                     XML ITS

       The XML ITS HL7v3 Schema‟s
• Not very readable
   – without Schema editor not practically feasible
• Generated from database
• Fix them with XSLT or other:
   –   Flatten the Schema‟s
   –   Remove unneeded datatype hierarchies
   –   Layer the Schema‟s
   –   Replace all CMET flavors by a generic CMET flavor
• Makes the Schema‟s much more readable
• Generates simpler code



                             Slide (modified) courtesy of: Marc de Graauw
        Ringholm bv           Integration Consulting
                                                XML ITS

Code re-use: Post code generation
                 ..



Interaction
                                   ..
Schema #1
                 ..
Interaction
Schema #2
     .
     .
                             Virtual frontend
Interaction      ..
Schema #n


   Ringholm bv   Integration Consulting
                                                    RIM ITS

              RIM ITS Schema
• Essentially 1 core schema with 50
  classes
  – Generated classes will process any RIM ITS
    instance
  – Content validation to be done within application,
    not at the XML level
• Additional MIF based code generation
  probably required
  – Processing of RIM-based object trees almost
    always requires knowledge of the structure of
    templates (SIM, LIM)

    Ringholm bv         Integration Consulting          36
In-memory object processing

 Implementation Experiences



   Slide contents published under the Creative Commons / Attribute-Share Alike license
   Source: www.ringholm.de/download/implementation_mechanics.ppt


  Ringholm bv                     Integration Consulting
              Use-case: E-Novation

              RP    RO
                                             Message
Database
                    CO         CS
1. Serialized messages mapped to in-memory
   message objects (JAXB, code generation)
2. Application (business-) objects mapped to
   relational database (Hibernate ORM)
3. Custom code: mapping of message objects to
   application objects

           Ringholm bv   Integration Consulting
       Use-case: E-Novation JAXB

                                Marshaller.marshal(payload)
• There is no direct link            <<POJO>>                        <<DOM>>
  between                          Payload                          Payload
   – Payload
   – ControlAct
                                  Marshaller.marshal(controlAct)
   – Message
                                     <<POJO>>                        <<DOM>>
• From Object(s) to DOM in 3      ControlAct Any                   ControlAct
  separate steps
• From DOM to Object in 3
                               Marshaller.marshal(message)
  steps (in reverse order)
                                     <<POJO>>                       <<DOM>>

                                   Message Any                     Message




      Ringholm bv          Integration Consulting
Use-case: E-Novation JAXB




Ringholm bv   Integration Consulting
E-Novation example: message object




   Ringholm bv   Integration Consulting
                          Use-case: JavaSIG

                      RP                  RO

                                                                CS
 Database




1. RIM based objects at core of application
2. Direct (MIF-based) mapping to/from serialized
   messages
3. Direct mapping to relational database
            See http://aurora.regenstrief.org/javasig for source code



            Ringholm bv                          Integration Consulting
      Use-case: JavaSIG MIF based
• The direct transition from RO to CS (CS uses the
  XML ITS) is the most complex part of the API
  and at every step it is guided by the parsed MIF
  file.
• <Person>..</Person> may have been sent,
  with defaults omitted. Only by looking at the MIF
  does one know this equates to <Person
  classCode=“PSN”>..</Person> and how to
  map it to a RIM class.



       Ringholm bv     Integration Consulting
           Example Usage

• National Cancer Registry HL7 v3 SDK
• DRV Bund (Germany – amongst other
  things a hospital group)
  – Use RIMBAA Java API and JBoss to
    create & parse CDA documents.
• PHI Technology toolset (Austrian HIS
  vendor)
  – Use RIMBAA Java API and JBoss

    Ringholm bv   Integration Consulting
                Use-case: Philips Research
                                                                      application


   HL7v3 Standard                  ABCD HL7v3 Generator



       MIF                                                                          SQL
                    object model                             C#
                                      object model                        C#
                     generator                            generator                 XML


       XSD




• Object model of MIF was generated from the MIF schemas, including
  read and write methods.
• MIF files are read as instances of the MIF model and mapped to object
  models.
• Applications are built using C# classes generated from the object
  models.


              Ringholm bv                 Integration Consulting                    48
         Philips Research: MIF usage
Object models generated from MIF:

                                     Clinical
                                    Statement




                     R_Assigned     R_Assigned
         R_Patient                                R_Medication   R_Specimen
 CMETs                 Entity         Person                                  …..
         Universal                                 Universal      Universal
                      Universal      Identified




                                        RIM
                                       (2.26)



                                    Datatypes
                                      (R1)


                                    Vocabulary




         Ringholm bv              Integration Consulting                       49
               Use-case: phi-Solution
Build a “SOLUTION” to collect patient data (family
name, given name, ...).

                   Choose         Bind
  Design                                                 Design
                  or Create      RMIM to
  Process           RMIM         Process                 FORMs




              Generate         Solution         Bind       Bind
              & Deploy                         FORMs     FORMs to
 RUN            Onto          MODEL is        to RMIM     Process
               PHI RE          READY



            Ringholm bv         Integration Consulting
                phi Designer Architecture
                                     ECLIPSE

                                     PHI DESIGNER
 PHI JET
TEMPLATE                           PHI Eclipse Plug-ins

                                                                  RIM           MIF File
                    JET Template               GMF
                                                                                 (RIM)
                   JET EMITTER           GEF         EMF          OHF


PHI Solution                              XML
  Model
                      From OPEN MODEL to RE
                    DESIGNER            JET ENGINE         XHTML/JSP + CSS


                               XML
                                                            XML in BPEL style


                                                            XML




               Ringholm bv             Integration Consulting
    phi RE Architecture




Ringholm bv   Integration Consulting
      MARC Everest Framework
• Mohawk College (a Canadian
  university) has created a .net API-
  generator based on MIF.
• Available on their website:
  http://everest.marc-hi.ca/




    Ringholm bv    Integration Consulting   53
             MARC Everest –
           From MIF to Instance
                                Data Types

         Generated DLL
         Vocabulary
                                                          Formatters
            RMIM
           Classes                                       XML ITS 1.x
                                  Application
                                    Code
                                                         Data Type R1



                                      Create
 GPMR                                          No ITS?



                                 <PRPA_IN101
                                       2..
MIF v2                             <id root=“”


                         XML ITS1.0 with DT R1



     Ringholm bv             Integration Consulting
      Any Questions ?


 Or: post your question/suggestions via
    •HL7 Wiki: http://bit.ly/d7tSsL
    •E-mail v3impl@ringholm.com

Ringholm bv      Integration Consulting