HL7v2.Type.HD (HL7v2 v3.10.1)

Copy Markdown View Source

Hierarchic Designator (HD) -- HL7v2 composite data type.

Used to identify sending/receiving applications, facilities, and assigning authorities. Appears as a top-level component and as a sub-component inside CX, EI, PL, and XON.

3 components:

  1. Namespace ID (IS)
  2. Universal ID (ST)
  3. Universal ID Type (ID) -- DNS, GUID, ISO, UUID, etc.

When HD appears inside another composite (e.g., CX.4), its internal parts are encoded as sub-components using &.

Summary

Functions

Encodes an HD to a list of component/sub-component strings.

Parses an HD from a list of components (or sub-components).

Types

t()

@type t() :: %HL7v2.Type.HD{
  namespace_id: binary() | nil,
  universal_id: binary() | nil,
  universal_id_type: binary() | nil
}

Functions

encode(hd_type)

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

Encodes an HD to a list of component/sub-component strings.

Examples

iex> HL7v2.Type.HD.encode(%HL7v2.Type.HD{namespace_id: "HOSP", universal_id: "2.16.840.1.113883.19.4.6", universal_id_type: "ISO"})
["HOSP", "2.16.840.1.113883.19.4.6", "ISO"]

iex> HL7v2.Type.HD.encode(%HL7v2.Type.HD{namespace_id: "MRN"})
["MRN"]

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

parse(components)

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

Parses an HD from a list of components (or sub-components).

Examples

iex> HL7v2.Type.HD.parse(["HOSP", "2.16.840.1.113883.19.4.6", "ISO"])
%HL7v2.Type.HD{namespace_id: "HOSP", universal_id: "2.16.840.1.113883.19.4.6", universal_id_type: "ISO"}

iex> HL7v2.Type.HD.parse(["MRN"])
%HL7v2.Type.HD{namespace_id: "MRN"}

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