Skip to main content

Crate hl7_net

Crate hl7_net 

Source
Expand description

A lightweight HL7 v2 parser/writer.

This is an idiomatic Rust port of the Efferent HL7-V2 .NET library. The element tree (SubComponent, Component, Field, Segment, Message) is pure data; encoding/decoding is driven by an HL7Encoding threaded through the parse/serialize/value methods.

§Example

use hl7_net::Message;

let text = "MSH|^~\\&|App|Fac|App2|Fac2|20200101000000||ADT^A01^ADT_A01|MSGID|P|2.5\r\
            PID|1||PATID1234^5^M11||EVERYMAN^ADAM^A^III||19610615|M\r";

let mut message = Message::with_message(text);
assert!(message.parse(false).unwrap());

assert_eq!(message.get_value("MSH.9.1").unwrap(), "ADT");
assert_eq!(message.get_value("PID.5.1").unwrap(), "EVERYMAN");

Modules§

helper
Utility functions for splitting, framing and date handling of HL7 messages.

Structs§

Component
A component of an HL7 field, containing one or more SubComponents separated by the subcomponent delimiter.
Field
A field of an HL7 segment. A field is either componentized (a list of Components separated by the component delimiter) or has repetitions (a list of sub-fields separated by the repetition delimiter).
HL7Encoding
HL7 encoding/decoding rules: the field, component, repetition, escape and subcomponent delimiters plus the routines that escape and unescape values.
Hl7Error
Error type for HL7 message processing (parsing, validation, serialization).
Message
A parsed HL7 v2 message: a collection of Segments keyed by name, plus the message-level metadata extracted from the MSH segment.
Segment
An HL7 segment: a name (e.g. MSH, PID) followed by a list of Fields.
SubComponent
The smallest data unit in an HL7 message: a subcomponent within a component.