HL7.Message (elixir_hl7 v0.6.4) View Source
Creates, parses and modifies HL7 messages with a focus on performance. Contains a list of parsed segments and header metadata.
Use Hl7.Message.new/1
to create an Hl7.Message
struct that contains a fully parsed HL7 message alongside header metadata.
The parsed data is represented as minimally as possible as lists of string and lists.
Link to this section Summary
Functions
Returns the first parsed segment matching segment_name
from an HL7 message or content.
Creates an HL7.Message
struct containing parsed segment list data. It will
also expose basic header information (e.g. encoding characters, message type) for routing.
Creates an HL7.Message
struct containing the raw HL7 text for further processing. It will
also expose basic header information (e.g. encoding characters, message type) for routing.
Returns a parsed list of segments from an HL7 message or content.
Link to this section Types
Specs
content_hl7() :: raw_hl7() | parsed_hl7()
Specs
Specs
parsed_hl7() :: [segment_hl7()] | t()
Specs
raw_hl7() :: String.t() | HL7.RawMessage.t()
Specs
segment_hl7() :: [fragment_hl7()]
Specs
t() :: %HL7.Message{ fragments: term(), header: nil | HL7.Header.t(), segments: nil | list(), tag: term() }
Link to this section Functions
Specs
find(content_hl7(), String.t() | non_neg_integer()) :: segment_hl7() | nil
Returns the first parsed segment matching segment_name
from an HL7 message or content.
Specs
new(content_hl7() | HL7.Header.t()) :: t() | HL7.InvalidMessage.t()
Creates an HL7.Message
struct containing parsed segment list data. It will
also expose basic header information (e.g. encoding characters, message type) for routing.
Invalid MSH formats will return an HL7.InvalidMessage
.
Examples
iex> HL7.Examples.wikipedia_sample_hl7()
...> |> HL7.Message.new()
...> |> HL7.Query.get_segment_names()
["MSH", "EVN", "PID", "PV1", "OBX", "OBX", "AL1", "DG1"]
iex> HL7.Message.new(
...> "MSH|^~\\&|MegaReg|XYZHospC|SuperOE|XYZImgCtr|" <>
...> "20060529090131-0500||ADT^A01^ADT_A01|01052901|P|2.5")
...> |> HL7.Query.get_segment_names()
["MSH"]
iex> HL7.Message.new(
...> [["MSH", "|", "^~\\&", "App", "Facility", "", "",
...> "20060529090131-0500", "", [["ADT", "A01", "ADT_A01"]],
...> "01052901", "P", "2.5"]])
...> |> HL7.Query.get_segment_names()
["MSH"]
Specs
raw(content_hl7()) :: HL7.RawMessage.t() | HL7.InvalidMessage.t()
Creates an HL7.Message
struct containing the raw HL7 text for further processing. It will
also expose basic header information (e.g. encoding characters, message type) for routing.
Invalid MSH formats will return an HL7.InvalidMessage
struct.
Specs
to_list(content_hl7()) :: [list()]
Returns a parsed list of segments from an HL7 message or content.