Cardinality defines how many times an element must/may appear in a HL7 message. Represented as minimum and maximum instance counts, e.g., 0-to-n or 1-to-1.
The following table shows the syntax of cardinality in a message, where brackets indicate the segment is optional and not repeatable, and curly braces indicate the segment is required and repeatable. No brackets or curly braces, indicates the segment is required and not repeatable. Segments with brackets and curly braces indicates the segment is optional and repeatable.
In the sample ORM^O01 message specification below, the PID segment is required (no brackets) within an optional group (brackets). The ORC is required (no brackets) in repeatable group (curly braces). And, the OBX is required (no brackets) in an optional/repeatable group [brackets and curly braces) within an optional group (brackets) within a repeatable group (curly braces).
Groups contain a sequence of segments and sub-groups, and often repeat. Below is an example of an ADT^AO1 message specification. Let’s just look at the Insurance group (in the blue box) to determine the group and segment cardinality. The Insurance group is optional and repeatable (brackets and curly braces). Cardinality is 0 to many. Within the group, the IN1 segment is required (1 to 1). The IN2 and IN3 segments are optional (0 to 1).
Also see What is Cardinality in HL7?