HL7v2.Type.VR (HL7v2 v3.10.1)

Copy Markdown View Source

Value Range (VR) -- HL7v2 composite data type.

Specifies a range of values for a field. Used as a query parameter.

2 components:

  1. First Data Code Value (ST)
  2. Last Data Code Value (ST)

Summary

Functions

Encodes a VR to a list of component strings.

Parses a VR from a list of components.

Types

t()

@type t() :: %HL7v2.Type.VR{
  first_data_code_value: binary() | nil,
  last_data_code_value: binary() | nil
}

Functions

encode(vr)

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

Encodes a VR to a list of component strings.

Examples

iex> HL7v2.Type.VR.encode(%HL7v2.Type.VR{first_data_code_value: "A", last_data_code_value: "Z"})
["A", "Z"]

iex> HL7v2.Type.VR.encode(%HL7v2.Type.VR{first_data_code_value: "100"})
["100"]

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

parse(components)

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

Parses a VR from a list of components.

Examples

iex> HL7v2.Type.VR.parse(["A", "Z"])
%HL7v2.Type.VR{first_data_code_value: "A", last_data_code_value: "Z"}

iex> HL7v2.Type.VR.parse(["100"])
%HL7v2.Type.VR{first_data_code_value: "100"}

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