HL7v2.Type.VH (HL7v2 v3.10.1)

Copy Markdown View Source

Visiting Hours (VH) -- HL7v2 composite data type.

Specifies visiting hours for a location.

4 components:

  1. Start Day Range (ID) -- Table 0267: SAT, SUN, MON, TUE, WED, THU, FRI
  2. End Day Range (ID) -- Table 0267
  3. Start Hour Range (TM) -- HHMM
  4. End Hour Range (TM) -- HHMM

Summary

Functions

Encodes a VH to a list of component strings.

Parses a VH from a list of components.

Types

t()

@type t() :: %HL7v2.Type.VH{
  end_day_range: binary() | nil,
  end_hour_range: binary() | nil,
  start_day_range: binary() | nil,
  start_hour_range: binary() | nil
}

Functions

encode(vh)

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

Encodes a VH to a list of component strings.

Examples

iex> HL7v2.Type.VH.encode(%HL7v2.Type.VH{start_day_range: "MON", end_day_range: "FRI", start_hour_range: "0800", end_hour_range: "1700"})
["MON", "FRI", "0800", "1700"]

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

parse(components)

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

Parses a VH from a list of components.

Examples

iex> HL7v2.Type.VH.parse(["MON", "FRI", "0800", "1700"])
%HL7v2.Type.VH{start_day_range: "MON", end_day_range: "FRI", start_hour_range: "0800", end_hour_range: "1700"}

iex> HL7v2.Type.VH.parse(["SAT", "SUN"])
%HL7v2.Type.VH{start_day_range: "SAT", end_day_range: "SUN"}

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