Search code examples
syntaxhl7hl7-v2hl7-v3

What do brackets and braces mean in HL7 segments?


I'm working on a project that involves HL7 messages. I've been reading the documentation to understand what the different kind of segments mean.

I've come across three different kinds of syntax when looking at the documents, they are below:

enter image description here

What is the difference between a segment without any sort of braces or brackets, a segment with both braces and brackets, and a segment with just brackets?

I assumed a segment with brackets may be some sort of array or list, but I haven't been able to find anything confirming this.


Solution

  • Brackets indicate the segment is optional. [UAC] means the UAC segment may or may not be in the message.

    Braces (or curly brackets) indicate the segment can repeat. [{ SFT }] means the SFT segment may or may not be in the message, and could repeat multiple times if it is.

    A segment without any brackets or braces should be in the message once.

    See this page for example.