HL7 v2.5.1 abstract message structure definitions.
Each message structure is defined as a tree of segments and groups with cardinality constraints, following the HL7 v2.5.1 abstract message definitions.
Structure AST
Each node is one of:
{:segment, id, optionality}— a single segment occurrence{:segment, id, optionality, :repeating}— a repeating segment{:group, name, optionality, children}— a segment group (single){:group, name, optionality, :repeating, children}— a repeating group
Where:
idis an atom like:MSH,:PID,:PV1nameis a group name atom like:PATIENT,:VISIT,:ORDERoptionalityis:requiredor:optionalchildrenis a list of nested nodes
222 structure definitions covering all 186 official v2.5.1 abstract message
structures plus aliases and response variants. Run mix hl7v2.gen_docs to
regenerate reference documentation from these definitions.
Source: HL7 v2.5.1 abstract message definitions via https://www.hl7.eu/HL7v2x/v251/hl7v251msgstruct.htm and https://hl7-definition.caristix.com/v2/HL7v2.5.1/TriggerEvents
Summary
Functions
Returns the count of defined structures.
Returns the structure definition for a message structure name, or nil.
Returns all defined structure names.
Extracts the flat list of required segment IDs from a structure definition.
Types
@type structure() :: %{ name: binary(), description: binary(), nodes: [structure_node()] }
@type structure_node() :: {:segment, atom(), :required | :optional} | {:segment, atom(), :required | :optional, :repeating} | {:group, atom(), :required | :optional, [structure_node()]} | {:group, atom(), :required | :optional, :repeating, [structure_node()]}
Functions
@spec count() :: non_neg_integer()
Returns the count of defined structures.
Returns the structure definition for a message structure name, or nil.
@spec names() :: [binary()]
Returns all defined structure names.
Extracts the flat list of required segment IDs from a structure definition.
This is the bridge to the current presence-only validation: it walks the structure tree and collects all required segment IDs, ignoring group nesting.