Written in reply to community post for can Python create HL7 Message dynamically.
Pre-requisites and setup
Use an integration enabled namespace.
Note: USER namespace is not enabled for interoperability by default.
If following suggest create a new interoperatibility namespace to explore functionality.
# Switch to
ZN "[Interoperability Namespace Name]"
# Launch interactive Python shell:
Do $SYSTEM.Python.Shell()
Script start
#Load dependencies
import datetime as dt
import uuid
# Cache current time in CCYYMMDDHHMMss format
hl7_datetime_now=dt.datetime.now().strftime('%Y%m%d%H%M%S')
# Create HL7 Message
hl7=iris.cls("EnsLib.HL7.Message")._New()
# Set the doc type
# 2.5.1:ORU_R01 - Unsolicited transmission of an observation message
hl7.PokeDocType("2.5.1:ORU_R01")