/
How should an HL7 grammar define repetition

How should an HL7 grammar define repetition

Chameleon has a data model for defining repetition on segments which was a little redundant:

<message_grammar id="4"> <name>NK1</name> <is_optional>True</is_optional> <is_repeating>True</is_repeating> <ignore_segment_order>True</ignore_segment_order> <max_repeats>0</max_repeats> <type>segment</type> <segment_ref>2</segment_ref> </message_grammar>

Notice how we have True for “is_repeating” yet max_repeats is set to 0.

This a bit of a design problem in that we have a redundant data model - we are describing the same property in a two ways and we end up with a contradiction:

  • The is_repeating property is true - which means that we have repeating segment.

  • But the max_repeats is set to 0 which says that the segment is not repeating.

How can we describe the properties of optionality and repetition in a simplest model that we can with as little ambiguity as possible in our new schema model with only one node type?

  • What about

    • min - if this zero then it means the node is optional

    • max

      • 0 has no meaning

      • -1 means no limit

      • N means N repeats

I wonder about the value of restricting the number of repeats since in practice having limits on the messaging format doesn’t get a lot of value - it’s just annoying if an HL7 parser rejects a message because it exceeds the number of repeats or has one less. What is we did this instead:

  • IsRequired -

    • true - means the field is required

  • IsRepeating

What about

  • IsOptional

    • Just means we can skip over it, but we’re not going to reject a message

  • IsRepeating

Related content

What is the best way to deal with repeating fields in the HL7 grammar?
What is the best way to deal with repeating fields in the HL7 grammar?
More like this
Why would a field change from non repeating to repeating?
Why would a field change from non repeating to repeating?
More like this
Simple recursive configuration with one node object
Simple recursive configuration with one node object
More like this
Handling Optional or Repeating Segments
Handling Optional or Repeating Segments
More like this
Translation of Chameleon HL7 Matching Rules to IguanaX matching rules
Translation of Chameleon HL7 Matching Rules to IguanaX matching rules
More like this
Adding Z-Segments to a VMD
Adding Z-Segments to a VMD
More like this