ex_hl7 v0.3.0 HL7.Composite.Def
Macros and functions used to define HL7 composite fields
Summary
Functions
Checks that a component definition is correct
Checks that the default value assigned to a component inside a composite field is valid
Checks that the type of a component inside a composite field is valid
Macros
Macro that generates the code for each individual component within an
HL7 composite field. Each component
definition looks like the following
one
Macro that generates the code that allows a module to be used as a composite
field in HL7 segments. A composite
field definition looks like the
following block
Types
option ::
{:separators, [{key :: atom, separator :: byte}]} |
{:trim, boolean}
Functions
Specs
check_component!(name :: atom, type :: atom, default :: any, module :: atom, components :: [{name :: atom, type :: atom}]) ::
nil |
no_return
Checks that a component definition is correct
Checks that the default value assigned to a component inside a composite field is valid
Macros
Macro that generates the code for each individual component within an
HL7 composite field. Each component
definition looks like the following
one:
component :price, type: :float
A component
has a name that has to be an atom, a type
and a default
value. The default type
is :string
and the default value
is ""
for
scalar types and an empty struct for composite types. The supported types are:
:string
:integer
:float
:date
: a field containing a date as a{year, month, day}
that is serialized using the YYYYMMDD format.:datetime
: a field containing a date/time tuple (i.e.{{year, month, day}, {hour, min, sec}}
) that is serialized using the YYYYMMDD[hhmm[ss]] format.- an atom corresponding to a composite field’s module name. The module must
have been built using the macros from the
HL7.Composite.Def
module or following the behaviour of anHL7.Composite
. There are some sample composite field modules already defined in theHL7.Composite
module.
Macro that generates the code that allows a module to be used as a composite
field in HL7 segments. A composite
field definition looks like the
following block:
composite do
component :number, type: :string
component :date, type: :date
component :source, type: :string
end
Note: when defining a composite, the fields have to be in the order they are in the message.