ex_hl7 v1.0.0 HL7.Composite behaviour

Generic functions used by HL7 composite field macros

Link to this section Summary

Functions

Given a tuple representing the declaration of a component or subcomponent of a field, return a tuple with the corresponding list of indexes (1-based) for the item in the composite and its type.

Link to this section Types

Link to this type

option()

option() ::
  {:separators, [{key :: atom(), separator :: byte()}]} | {:trim, boolean()}
Link to this type

spec()

spec() :: {name :: atom(), HL7.Type.value_type() | module()}

Link to this section Functions

Given a tuple representing the declaration of a component or subcomponent of a field, return a tuple with the corresponding list of indexes (1-based) for the item in the composite and its type.

The function will raise an exception if any of the passed component or subcomponent key names are invalid.

Examples

alias HL7.Composite.Default.{CE, CP, CX}
alias HL7.Composite

iex> Composite.spec!({CE, :text})
{{2}, :string}
iex> Composite.spec!({CX, :effective_date})
{{7}, :date}
iex> Composite.spec!({CP, :price, :quantity})
{{1, 1}, :float}
iex> Composite.spec!({CP, :price, :denomination})
{{1, 2}, :string}

Link to this section Callbacks

Link to this callback

spec(atom)

spec(atom()) :: {index :: pos_integer(), HL7.Type.value_type() | module()}