elixir_hl7 v0.6.2 HL7.Message 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
content_hl7()
View Source
content_hl7() :: raw_hl7() | parsed_hl7()
content_hl7() :: raw_hl7() | parsed_hl7()
fragment_hl7() View Source
parsed_hl7()
View Source
parsed_hl7() :: [segment_hl7()] | t()
parsed_hl7() :: [segment_hl7()] | t()
raw_hl7()
View Source
raw_hl7() :: String.t() | HL7.RawMessage.t()
raw_hl7() :: String.t() | HL7.RawMessage.t()
segment_hl7()
View Source
segment_hl7() :: [fragment_hl7()]
segment_hl7() :: [fragment_hl7()]
t()
View Source
t() :: %HL7.Message{
fragments: term(),
header: nil | HL7.Header.t(),
segments: nil | list(),
tag: term()
}
t() :: %HL7.Message{ fragments: term(), header: nil | HL7.Header.t(), segments: nil | list(), tag: term() }
Link to this section Functions
find(segments, segment_name)
View Source
find(content_hl7(), String.t() | non_neg_integer()) :: segment_hl7() | nil
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.
new(msg)
View Source
new(content_hl7() | HL7.Header.t()) :: t() | HL7.InvalidMessage.t()
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"]
raw(raw_text)
View Source
raw(content_hl7()) :: HL7.RawMessage.t() | HL7.InvalidMessage.t()
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.
to_list(msg)
View Source
to_list(content_hl7()) :: [list()]
to_list(content_hl7()) :: [list()]
Returns a parsed list of segments from an HL7 message or content.