15
Hans Jonkers Philips Research October 27, 2009 The ABCD HL7v3 Generator

Hans Jonkers Philips Research October 27, 2009 The ABCD HL7v3 Generator

Embed Size (px)

Citation preview

Hans JonkersPhilips ResearchOctober 27, 2009

The ABCD HL7v3 Generator

Philips Research, October 27, 2009 2

The ABCD HL7v3 Generator

Maps the MIF and XSD sources of the HL7v3 standard to C# code that• supports the creation, access, modification, storage and retrieval of

HL7v3 objects • is strongly-typed: each (data, vocabulary, RIM, etc.) class/type is

mapped one-to-one to a type defined in C#• is independent of the way the objects are stored (in-memory, in XML or

in a database)

ABCD HL7v3Generator

C#

C# API

MIF

XSD

HL7v3 Standard

Restrictions:• No support for the HL7v3

methodology• No support for the

messaging part of HL7v3

Philips Research, October 27, 2009 3

Example

Creating an encounter:

var patient = Patient.LoadInstanceFromXml( ... );var practitioner = Practitioner.LoadInstanceFromXml( ... );var encounter = new Encounter();var subject = new Subject( patient, encounter );var performer = new Performer( practitioner, encounter );encounter.moodCode = ... // Fill in the encounter details...encounter.SaveInstanceToXml( ... );

PersonA

PersonB

Patient

Practitioner

Subject

Performer

Encounter

Philips Research, October 27, 2009 4

Example (Visual Studio)

Philips Research, October 27, 2009 5

Development Process In A Nutshell

1. Use model-driven development– Technology used: MOM (Meta Object Model) + Vampire toolset

2. Generate a MOM object model + XML reader from the XML schema definition of MIF.

3. Use model-to-model transformations to map the MOM representations of the MIF artifacts to MOM object models.

4. Generate C# code from the MOM object models:

object modelgenerator object model

C#generator

C#

C# API

MIF

XSD

HL7v3 Standard ABCD HL7v3 Generator

Philips Research, October 27, 2009 6

Generator Network

Philips Research, October 27, 2009 7

VIDE Snapshot of MifModel.mom

Philips Research, October 27, 2009 8

VIDE Snapshot of RIM

Philips Research, October 27, 2009 9

VIDE Snapshot of Clinical Statement

Philips Research, October 27, 2009 10

Current Application of the Generator

• Small XML repository of patient data (to be extended)• Object model hierarchy:

Datatypes(R1)

Vocabulary

RIM(2.26)

R_PatientUniversal

ClinicalStatement

R_AssignedEntity

Universal

R_AssignedPerson

Identified

R_MedicationUniversal

R_SpecimenUniversal

CMETs …..

Philips Research, October 27, 2009 11

Visual Studio Screenshot

Philips Research, October 27, 2009 12

Some Problems Encountered

• Understanding the constructs of the MIF language was often a matter of experimental informatics (due to a lack of documentation)

• Not succeeded in generating a complete set of consistent MIF files (using the official HL7 V3 Generator) from the set of tool input files

• MIF R1 datatype specification too abstract to generate code from → XML schema file of data types was used to generate code from

• Vocabulary contains duplicate codes (within same coding system) and uses multiple concept inheritance at a few places

• Stacking of static models pushes Visual Studio to its limits; need some way of flattening the models

Philips Research, October 27, 2009 13

Some Useful Techniques

• Model-to-model transformations make life a lot easier than transformations at the XML level (using XSLT)

• The ability to define metametamodels (MetaRim, MetaVoc) allows RIM-flavor to be added to object models

• Union types are a very natural way to deal with HL7v3 choice boxes• Partial class mechanism of C# is very useful to keep different aspects

of code generation separated

Philips Research, October 27, 2009 14

Conclusion

• MIF + (light-weight) Model-Driven Development is a good marriage• XML can be kept under the hood• Current generator is still a prototype, but sufficient to build basic RIMBAA

apps based on MIF-definitions of HL7v3 static models

Possible improvements/extensions:• Generation of more ‘convenience functions’• Moving structural attributes to the metatypes• Support for extension/restriction at the modeling level• Support for MIF constructs that are not currently used• Generation of validation code• Support for message handling• Turn MOM into a light-weight HL7v3 MDD formalism (as opposed to

UML) ???