HL7v2.Type.RI (HL7v2 v3.10.1)

Copy Markdown View Source

Repeat Interval (RI) -- HL7v2 composite data type.

Specifies the interval between repeated services. Used in TQ-2 (Timing/Quantity interval component).

2 components:

  1. Repeat Pattern (IS) -- coded pattern, e.g., "Q6H", "BID", "TID"
  2. Explicit Time Interval (ST) -- explicit interval, e.g., "Q2H", "300S"

Summary

Functions

Encodes an RI to a list of component strings.

Parses an RI from a list of components.

Types

t()

@type t() :: %HL7v2.Type.RI{
  explicit_time_interval: binary() | nil,
  repeat_pattern: binary() | nil
}

Functions

encode(ri)

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

Encodes an RI to a list of component strings.

Examples

iex> HL7v2.Type.RI.encode(%HL7v2.Type.RI{repeat_pattern: "Q6H", explicit_time_interval: "6 hours"})
["Q6H", "6 hours"]

iex> HL7v2.Type.RI.encode(%HL7v2.Type.RI{repeat_pattern: "BID"})
["BID"]

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

parse(components)

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

Parses an RI from a list of components.

Examples

iex> HL7v2.Type.RI.parse(["Q6H", "6 hours"])
%HL7v2.Type.RI{repeat_pattern: "Q6H", explicit_time_interval: "6 hours"}

iex> HL7v2.Type.RI.parse(["BID"])
%HL7v2.Type.RI{repeat_pattern: "BID"}

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