API¶
Receivers¶
- class txHL7.receiver.AbstractHL7Receiver¶
Bases: txHL7.receiver.AbstractReceiver
Abstract base class implementation of txHL7.receiver.IHL7Receiver
Return type: txHL7.receiver.HL7MessageContainer - message_cls¶
alias of HL7MessageContainer
- class txHL7.receiver.AbstractReceiver¶
Bases: builtins.object
Abstract base class implementation of txHL7.receiver.IHL7Receiver
- message_cls¶
alias of MessageContainer
- class txHL7.receiver.HL7MessageContainer(raw_message)¶
Bases: txHL7.receiver.MessageContainer
Message implementation that parses using python-hl7
- ack(ack_code='AA')¶
Return HL7 ACK created from the source message.
Return type: unicode
- interface txHL7.receiver.IHL7Receiver¶
Interface that must be implemented by MLLP protocol receiver instances
- parseMessage(raw_message)¶
Clients should parse the message and return an instance of txHL7.receiver.MessageContainer or subclass.
Return type: txHL7.receiver.MessageContainer
- handleMessage(message_container)¶
Clients must implement handleMessage, which takes a message_container argument that is the txHL7.receiver.MessageContainer instance returned from txHL7.receiver.IHL7Receiver.parseMessage(). The implementation, if non-blocking, may directly return the ack/nack message or can return the ack/nack within a twisted.internet.defer.Deferred. If the implementation involves any blocking code, the implementation must return the result as twisted.internet.defer.Deferred (possibly by using twisted.internet.threads.deferToThread()), to prevent the event loop from being blocked.
- getCodec()¶
Clients should return the codec name [1]_ and error handling scheme [2]_, used when decoding into unicode.
Return type: tuple(codec, errors) [1] http://docs.python.org/library/codecs.html#standard-encodings [2] https://docs.python.org/2/library/codecs.html#codec-base-classes
- getTimeout()¶
Clients should return the idle timeout in seconds, or None for no timeout
Return type: int
- class txHL7.receiver.LoggingReceiver¶
Bases: txHL7.receiver.AbstractHL7Receiver
Simple MLLP receiver implementation that logs and ACKs messages.
- class txHL7.receiver.MessageContainer(raw_message)¶
Bases: builtins.object
Base class for messages returned from txHL7.receiver.IHL7Receiver.parseMessage() and passed to txHL7.receiver.IHL7Receiver.handleMessage()
- ack(ack_code='AA')¶
Return unicode acknowledgement message, or None for no ACK.
ack_code options are one of AA (accept), AR (reject), AE (error)
Return type: unicode
- err(failure)¶
Handle a twisted errback twisted.python.failure.Failure failure. Subclasses can override to log errors or handle them in a different way. Default implementation returns a rejection ACK.
Return type: unicode
MLLP¶
- class txHL7.mllp.MinimalLowerLayerProtocol¶
Bases: twisted.internet.protocol.Protocol, twisted.protocols.policies.TimeoutMixin
Minimal Lower-Layer Protocol (MLLP) takes the form:
<VT>[HL7 Message]<FS><CR>References:
[1] http://www.hl7standards.com/blog/2007/05/02/hl7-mlp-minimum-layer-protocol-defined/ [2] http://www.hl7standards.com/blog/2007/02/01/ack-message-original-mode-acknowledgement/
MLLP Plugin¶
- class twisted.plugins.mllp_plugin.MLLPServiceMaker¶
Bases: builtins.object
Service maker for the MLLP server.
- makeService(options)¶
Construct a server using MLLPFactory.
Return type: twisted.application.internet.StreamServerEndpointService
- class twisted.plugins.mllp_plugin.Options¶
Bases: twisted.python.usage.Options
Define the options accepted by the twistd mllp plugin