Some HL7 message types allow a segment to be repeated one or more times, or allow a segment to be optionally present.
For example, repeating segments are useful for messages that contain contact information, as they make it possible to provide more than one contact. For instance, multiple NK1 (Next of Kin) segments may be provided if a patient has more than one person that can be contacted in case of emergency.
Optional segments are useful for providing information that is not provided in all messages. For instance, an AL1 (Patient Allergy Information) segment may be included if a patient has allergies.
MSH|^~\&|EPIC|EPICADT|SMS|SMSADT|199912271408|CHARRIS|ADT^A04|1817457|D|2.5|
PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOE^JOHN^^^^|19480203|M||B|254 MYSTREET AVE^^MYTOWN^OH^44123^USA||(216)123-4567|||M|NON|400003403~1129086|999-|
NK1||ROE^MARIE^^^^|SPO||(216)123-4567||EC|||||||||||||||||||||||||||
NK1||DOE^JOHN ^^^^|SPO||(216)123-4567||EC|||||||||||||||||||||||||||
NK1||DOE^ROBERT ^^^^|SPO||(216)123-4568||EC|||||||||||||||||||||||||||
PV1||O|168 ~219~C~PMA^^^^^^^^^||||277^ALLEN MYLASTNAME^BONNIE^^^^|||||||||| ||2688684|||||||||||||||||||||||||199912271408||||||002376853