HL7v2.Type.MOP (HL7v2 v3.10.1)

Copy Markdown View Source

Money or Percentage (MOP) -- HL7v2 composite data type.

Transmits a monetary amount or a percentage.

2 components:

  1. Money or Percentage Indicator (ID) -- AT (amount), PC (percentage)
  2. Money or Percentage Quantity (NM)

Summary

Functions

Encodes a MOP to a list of component strings.

Parses a MOP from a list of components.

Types

t()

@type t() :: %HL7v2.Type.MOP{
  money_or_percentage_indicator: binary() | nil,
  money_or_percentage_quantity: binary() | nil
}

Functions

encode(mop)

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

Encodes a MOP to a list of component strings.

Examples

iex> HL7v2.Type.MOP.encode(%HL7v2.Type.MOP{money_or_percentage_indicator: "AT", money_or_percentage_quantity: "150.00"})
["AT", "150.00"]

iex> HL7v2.Type.MOP.encode(%HL7v2.Type.MOP{money_or_percentage_indicator: "PC"})
["PC"]

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

parse(components)

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

Parses a MOP from a list of components.

Examples

iex> HL7v2.Type.MOP.parse(["AT", "150.00"])
%HL7v2.Type.MOP{money_or_percentage_indicator: "AT", money_or_percentage_quantity: "150.00"}

iex> HL7v2.Type.MOP.parse(["PC", "80"])
%HL7v2.Type.MOP{money_or_percentage_indicator: "PC", money_or_percentage_quantity: "80"}

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