|iNTERFACEWARE Products Manual > Learning Center > Tutorials and Sample Scenarios > Working With Other Message Formats > Generating HL7 Version 3 Messages > Loading the Python Module Into Iguana > Understanding the hl7version3 Python Module|
The hl7version3 Python module is a collection of templates that generate HL7 Version 3 messages. These templates use the data stored in the XML file generated by the first VMD file that you created (which was described in Creating a VMD File To Extract Information in XML).
The main hl7version3() function calls each of these templates in turn:
Here, templates are defined for the following:
The output from the templates is built into a single string variable, v3, which is returned to the Python script that called the hl7version3() function.
The following function is the template that generates the receiving hospital information:
This template calls a helper function, v3Indent(), which handles the details of generating the message output in the expected XML format with the proper indenting. For the sample message used in this tutorial, the output from v3HospitalReceiver() looks like this:
All of the other templates work the same way: they generate one specific section of a HL7 version 3 message, using the supplied parameters to customize this message section.
To view the HL7 V3 Python module, and the supporting module that contains the helper functions that the Python module uses, follow these links: