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

Link to this type

content_hl7() View Source
content_hl7() :: raw_hl7() | parsed_hl7()

Link to this type

fragment_hl7() View Source
fragment_hl7() :: String.t() | [list() | String.t()]

Link to this type

parsed_hl7() View Source
parsed_hl7() :: [segment_hl7()] | t()

Link to this type

segment_hl7() View Source
segment_hl7() :: [fragment_hl7()]

Link to this type

t() View Source
t() :: %HL7.Message{
  fragments: term(),
  header: nil | HL7.Header.t(),
  segments: nil | list(),
  tag: term()
}

Link to this section Functions

Link to this function

find(segments, segment_name) View Source
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.

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"]

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.

Returns a parsed list of segments from an HL7 message or content.