HL7v2.Type.ERL (HL7v2 v3.10.1)

Copy Markdown View Source

Error Location (ERL) -- HL7v2 composite data type.

Identifies the exact location of an error in a received message.

6 components:

  1. Segment ID (ST)
  2. Segment Sequence (NM)
  3. Field Position (NM)
  4. Component Number (NM)
  5. Sub-Component Number (NM)
  6. Source Table (ID)

Summary

Functions

Encodes an ERL to a list of component strings.

Parses an ERL from a list of components.

Types

t()

@type t() :: %HL7v2.Type.ERL{
  component_number: HL7v2.Type.NM.t() | nil,
  field_position: HL7v2.Type.NM.t() | nil,
  segment_id: binary() | nil,
  segment_sequence: HL7v2.Type.NM.t() | nil,
  source_table: binary() | nil,
  sub_component_number: HL7v2.Type.NM.t() | nil
}

Functions

encode(erl)

@spec encode(t() | nil) :: list()

Encodes an ERL to a list of component strings.

Examples

iex> HL7v2.Type.ERL.encode(%HL7v2.Type.ERL{segment_id: "PID", segment_sequence: "1", field_position: "5"})
["PID", "1", "5"]

iex> HL7v2.Type.ERL.encode(%HL7v2.Type.ERL{segment_id: "PID", segment_sequence: "1", field_position: "5", component_number: "2"})
["PID", "1", "5", "2"]

iex> HL7v2.Type.ERL.encode(nil)
[]

parse(components)

@spec parse(list()) :: t()

Parses an ERL from a list of components.

Examples

iex> HL7v2.Type.ERL.parse(["PID", "1", "5", "2", "1", "HL70001"])
%HL7v2.Type.ERL{segment_id: "PID", segment_sequence: %HL7v2.Type.NM{value: "1", original: "1"}, field_position: %HL7v2.Type.NM{value: "5", original: "5"}, component_number: %HL7v2.Type.NM{value: "2", original: "2"}, sub_component_number: %HL7v2.Type.NM{value: "1", original: "1"}, source_table: "HL70001"}

iex> HL7v2.Type.ERL.parse(["PID", "1", "5"])
%HL7v2.Type.ERL{segment_id: "PID", segment_sequence: %HL7v2.Type.NM{value: "1", original: "1"}, field_position: %HL7v2.Type.NM{value: "5", original: "5"}}

iex> HL7v2.Type.ERL.parse([])
%HL7v2.Type.ERL{}