Top Banner
V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden [email protected]
30

V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden [email protected].

Dec 16, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

V3 Lite – Simplifying the Exchange of HL7 V3 Messages

Robert Worden

[email protected]

Page 2: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Summary

• Large message size and complexity is holding back takeup of HL7 V3

• A V3 message definition can be restricted and reshaped to make it smaller and simpler, without blurring semantics

• The RMIM Reshaping Tool does this, keeping mappings between full and reshaped messages

• XSLT transforms between full and reshaped messages can made automatically and accurately

• This gives a simpler way to read and write V3 messages from applications

• It can be used in several different scenarios• It may be used to support a new ITS for V3

Page 3: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Complexity of HL7 V3

Page 4: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Why is HL7 V3 Complex and Difficult to Use?

• HL7 technical committees are trying to address many use cases, and to address them very thoroughly

• There are many intermediate ‘glue’ classes which add little to the semantics

• CMETs are designed for many use cases; using them adds complexity not needed for one use case

• Often a whole extra class has to be added, just to add one attribute

• HL7 ways of building models (meta-model, methodology) are complex and unlike vanilla UML

• RIM language is hard to understand, even for insiders• Documentation is extensive and distributed• HL7 tooling causes problems

Page 5: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

XPath Counts – a Measure of Message Complexity

• The number of distinct types of information that can be carried in a message is roughly the number of distinct XPaths in the message structure

• You need to cut off recursion (self-nesting) to keep this number finite

• For some V3 message definitions, the XPath count is very large indeed:

• e.g. for a laboratory request message: – 60,000 XPaths down to data type nodes– More than 4 million XPaths down to leaf nodes

• A typical message instance may use only a few dozen of these XPaths; finding them is hard

• V2 node counts are much smaller (and V2 is widely used…)

Tree depth and branching does it.Try BD when D = 20

Page 6: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

How to Implement V3 MessagesFrom the HL7 WIKI - V3 Implementation FAQ:

If you are working with XSLT you need to define an intermediate XML format for your data.

This can be in "close to HL7" form or in "close to native" form.

It's normally sensible to quickly export your data in a near-native format, and then encapsulate just the HL7 specifics in the XSLT.

Application 1

Application 2

App 1NativeAPI

App 2NativeAPI

Intermediate

Intermediate

V3

XSLTXSLT

Page 7: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Problems With This Approach

• You have really just split the problem up into pieces - not reduced it

• Transformations are needed in both directions• 8 different transformations are needed for a

round trip: [App 1 => App 2 => App 1]

• XSLT is not easy to write and test on this scale• Will all 8 transformations be accurate?

Page 8: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

HL7 V3 is like the National Grid; there is an Impedance Mismatch with Everyday

Devices

V3 = 132,000 Volts240 Volts

1,000 Volts?

110 Volts

ImplementerDomain 1

ImplementerDomain 2

How can we build accurate transformerswithout prohibitive costs?

Page 9: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Restricted Message Profiles

• HL7 encourages realms (e.g. UK) and implementors to constrain standard message definitions into more restricted Profiles before implementation

• Constrain means: reduce optionality and cardinality ranges; constrain data types; …

• A message instance of the constrained definition is an instance of the full definition

• The message skeleton remains more or less the same size (e.g. depth); there is less flesh on it

Page 10: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Restricting and Reshaping Message Definitions

• Restricting an RMIM means: restricting the cardinalities of attributes and associations (above and within data types) removing unused attributes and associations, fixing values of attributes

• Reshaping an RMIM means: collapsing associations which are 0..1 or 1..1; renaming classes, associations and attributes, removing fixed attributes.

• In this way, the reshaped object model (and its XML serialisation) can be made much simpler and more like a DAM (domain analysis model)

• These operations preserve semantic equivalence between the original and the reshaped model

• An instance of one can be transformed automatically to be an instance of the other

Page 11: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Overview of RMIM Re-shaping

RMIM

RMIM’

RMIM’’

Reshaped RMIMTarget DAM

MIF

MIF(reshaped)

XSD

XSD

RMIM Mappings

XML Instances

XML Translation XMI

Page 12: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

RMIM Reshaper Tool: Screenshot/demo

Page 13: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Outputs of the Reshaping Tool (and associated tools)

• Tables of mappings between RMIM and reshaped class model

• MIF for reshaped class model• XMI for reshaped class model• XML Schema for reshaped XML messages• Example message instances - for both full V3

XML ITS and reshaped XML• XSLT transformations between full V3 XML and

reshaped XML (both directions)

Page 14: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Simpler Reshaped Class Modelcd ClinicalStatement

ClinicalStatement

PARTICIPANT+ author: AuthorStatement+ performer: PerformerStatement+ subject: SubjectRole

ACT+ availabilityTime: TS+ classCode: string+ code: CV CNE+ effectiveTime: TS+ ID: II+ moodCode: string+ statusCode: CS

ACTRELATIONSHIP+ contextdConductionInd: BL = true+ inversionInd: BL = false+ negationInd: BL+ separateableInd: BL = true+ sequenceNumber: INT+ templateId: string+ typeCode: string

RELATEDACT+ sourceOf: ActLink+ supportingInfo: SupportingInformation

Consent

Observ ation

ACT+ referenceRange: ReferenceValue+ value: Any

PARTICIPANT+ specimen: Specimen

Organizer

ACT- specimen: Specimen

Procedure

ACT+ activityTime: TS+ product: SpecimenRole

StatementRelationship

ACT+ from: ActLink+ to: ActLink

SubstanceAdministration

ACT+ consumable: ManufacturedProduct+ doseQuantity: IVL <PQ>+ rateQuantity: IVL<PQ>

Supply

- product: ManufacturedProduct- quantity: PQ- repeatNumber: IVL<INT>

ClinicalStatementChoice

CHOICE+ consent: Consent+ observation: Observation+ organizer: Organizer+ procedure: Procedure+ statementRelationship: StatementRelationship+ substanceAdministration: SubstanceAdministration+ supply: Supply

1..* 0..*

This example is cribbed from a paper by Ken Lunn,(it is not output from the reshaping tool) and is purely illustrative. The main point is that the number of classes and attributes is much fewer than in an RMIM, and they have direct domain meanings.

Page 15: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Exemplar Message - Reshaped

<newPerson TelNumber="020 7711 435678" gender="1" dateOfBirth="28/11/1944" maritalStat="single"><asEmployee>

<EmployerContactName familyName="Bellamy" givenName="James" namePrefix="Mr"/></asEmployee><guardian familyName="Summers" givenName="Adele" namePrefix="Mrs">

<addr countyName="Cambs" cityName="Cambridge" streetAddress="10 Garden Walk"/></guardian><birthPlace countyName="Lancs" cityName="Lytham" streetAddress="5 Ansdell Road"/><language code="EN" langName="English"/><name familyName="Prufrock" givenName="Alfred" namePrefix="Mr"/><address countyName="Cambs" cityName="Ely" streetAddress="5 Cathedral Walk"/>

</newPerson>

• This is a Patient Admin ‘New Patient’ message, restricted and reshaped

• The exemplar was output from the reshaping tool• Maximum depth of nesting is about 3• Message size is 667 bytes

Page 16: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Exemplar Message – Full V3<IdentifiedPerson classCode="IDENT"> <identifiedPerson classCode="PSN" determinerCode="INSTANCE"> <asEmployee classCode="EMP">

<employerOrganization classCode="ORG" determinerCode="INSTANCE"> <contactParty classCode="CON"> <contactPerson classCode="PSN" determinerCode="INSTANCE">

<name> <family representation="TXT" mediaType="text/plain" partType="FAM">Bellamy</family> <given representation="TXT" mediaType="text/plain" partType="GIV">James</given>

<prefix representation="TXT" mediaType="text/plain" partType="PFX">Mr</prefix> </name>

</contactPerson> </contactParty></employerOrganization>

</asEmployee> <guardian classCode="GUARD">

<guardianPerson classCode="PSN" determinerCode="INSTANCE"> <name>

<family representation="TXT" mediaType="text/plain" partType="FAM">Summers</family><given representation="TXT" mediaType="text/plain" partType="GIV">Adele</given><prefix representation="TXT" mediaType="text/plain" partType="PFX">Mrs</prefix>

</name> </guardianPerson> ……

• Output from the reshaping tool, using the same instance data as before

• Maximum depth of nesting is about 8

• This is only part of the message

• Full message size is 2431 bytes (4 times bigger than reshaped)

Page 17: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

XSLT Translation and Round-Trips

• XSLT to translate from reshaped to V3, and back again, is generated automatically from the mappings

• Generated XSLT files are large and boring• The XSLT is not optimised yet, but is not stupid either• It does round trips (reshaped – V3 – reshaped) with

100% accuracy• Fixed attribute values are put into the V3 (or not if you

choose)• XSLT is suitable, because there are no vocabulary

lookups (values are the same for V3 and reshaped instances)

• Performance will be an issue for some high-volume applications; we will start optimising then.

Page 18: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Comparative Query Tool

• Can query a V3 message instance and a reshaped message instance, side by side in terms of the reshaped class model

• Highlights differences in semantic content, in colour

• A good way to check V3 messages for the content that matters

• A good test of the accuracy of translations• In the example that follows, I have introduced a

deliberate mistake (reshaped and V3 messages are not quite equivalent)

Page 19: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Comparative Query – Screenshot/Demo

Page 20: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Java API Using Reshaped Class Model

• Can build Java applications in terms of the reshaped (simpler, domain-like) class model

• The tools can generate skeleton Java classes for the reshaped class model

• Can read V3 messages into these applications, translating them automatically into the reshaped class model via the mappings

• Applications are insulated from changes in V3• This is like JavaSIG but uses the simpler class

model

Page 21: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

What This Means for Implementors

• You need a MIF definition of the RMIM to start with• You can then restrict and reshape it quite quickly with

the reshaping tool• Illegal reshaping moves are forbidden by the tool• XMI, XSD and XSLT are generated automatically• The reshaped model becomes your intermediate XML• You can then map your applications onto the (much

simpler) reshaped model, and read or write fully conformant V3 into those apps.

• This saves a lot of effort• It will increase the accuracy of your implementations• It is fully V3-conformant, now

Page 22: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Usage Scenario – Fully V3 Conformant

Application 1

Application 2

App 1NativeAPI

App 2NativeAPI

Intermediate

Intermediate

V3

XSLT 1XSLT 2

• Using reshaping, XSLT1 and XSLT 2 are generated automatically and accurately

• Supplier 1 and supplier 2 can choose independently how to implement (e.g. whether to use reshaping, how to reshape)

Page 23: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Usage Scenario – Smaller Messages over the Wire

Application 1

Application 2

App 1NativeAPI

App 2NativeAPI

Intermediate

Intermediate

V3

XSLT 1 XSLT 2

• Reshaped message instances are typically 3-4 times smaller• Supplier 1 and supplier 2 can still choose independently how to

implement (e.g. whether to use reshaping, how to reshape)• Is that V3-conformant?

Page 24: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Usage Scenario – HL7.org defines reshaped messages (New ITS)

Application 1

Application 2

App 1NativeAPI

App 2NativeAPI

V3 (New ITS) New ITS

V3 (old ITS)

XSLT 1 XSLT 2

• HL7 defines reshaped RMIM as new ITS• HL7 publishes XSLT to transform between them• Suppliers can use either new or old ITS over the wire; both are

conformant V3• Each supplier can choose independently whether to implement the

new ITS or the old ITS

Page 25: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Usage Scenario – CfH defines reshaped messages

Application 1

Application 2

App 1NativeAPI

App 2NativeAPI

New ITS New ITS

V3

XSLT 1 XSLT 2

• CfH publishes full and reshaped RMIMs in the MIM• CfH publishes XSLT to transform between them• Suppliers can use either new or old ITS over the wire; both are

conformant V3• Each supplier can choose independently whether to implement new

or old ITS

Page 26: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

V2-V3 Mapping Tool

• Pre-dates the reshaping tool, and has a similar user interface

• Read in a V2 definition and a V3 definition; then define mappings between them

• Translations can be generated automatically from the mappings

• If an application already has a V2 interface, you could use V2 XML as an intermediate XML on the way to V3

• Some HL7 TCs and suppliers have made and are making V2-V3 mappings

• Mappings are exchangeable in the tool format

Page 27: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Current Status

• NPfIT are now evaluating approaches to message simplification and the new XML-UML ITS, including use of the RMIM reshaping tool

• Example messages being tested: GP summary, ETP, PDS, ….

• Results will be presented at the HL7 WGM in San Diego in January

• The RMIM reshaper will soon be available from the HL7 Homebase (tooling site)

Page 28: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

What will be Open Source

• RMIM Reshaping tool

• V2-V3 Mapping tool

• Java API for messages

• Java class generator

• Comparative Query Tool

Page 29: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

What will be Licensed

• XSLT Generator

• Run-time translation engine

• Translation compiler

Page 30: V3 Lite – Simplifying the Exchange of HL7 V3 Messages Robert Worden robert.worden@charteris.com.

Questions

For full slides with notes, see the conference site.

For further information, email [email protected]