150 likes | 293 Views
The ABCD HL7v3 Generator. Hans Jonkers. Philips Research. October 27, 2009. The ABCD HL7v3 Generator. Restrictions: No support for the HL7v3 methodology No support for the messaging part of HL7v3. Maps the MIF and XSD sources of the HL7v3 standard to C# code that
E N D
The ABCD HL7v3 Generator Hans Jonkers Philips Research October 27, 2009
The ABCD HL7v3 Generator • Restrictions: • No support for the HL7v3 methodology • No support for the messaging part of HL7v3 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)
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( ... );
Development Process In A Nutshell • Use model-driven development • Technology used: MOM (Meta Object Model) + Vampire toolset • Generate a MOM object model + XML reader from the XML schema definition of MIF. • Use model-to-model transformations to map the MOM representations of the MIF artifacts to MOM object models. • Generate C# code from the MOM object models:
Current Application of the Generator Small XML repository of patient data (to be extended) Object model hierarchy:
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
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
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) ???