Skip to content

Main content

HL7 Segment Field Number Offset Tool

Map HL7 field numbering to a segment.split(separator) token index; MSH-1 is the separator itself and uses index sentinel -1.

Loading tool…

Description

Return fieldNumber for ordinary split arrays; for MSH return fieldNumber-1 except separator MSH-1, represented by splitIndex -1 and separatorField true.

Clinical exchange formats use exact delimiters, character grammars, and scoped identifiers. A local token check addresses one syntax condition and can succeed without validating a complete message or its clinical meaning.

Return fieldNumber for ordinary split arrays; for MSH return fieldNumber-1 except separator MSH-1, represented by splitIndex -1 and separatorField true.

When to use this tool

Use HL7 Segment Field Number Offset when you need one bounded spelling, delimiter, or identifier component.

How to use the tool and how it works

  1. Enter segment, fieldNumber. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read splitIndex, separatorField. Inspect separatorField before interpreting the associated values.

Require a three-character uppercase ASCII letter/digit segment and positive fieldNumber. Return fieldNumber for ordinary split arrays; for MSH return fieldNumber-1 except separator MSH-1, represented by splitIndex -1 and separatorField true.1

Input fieldMeaning and unitsAccepted input
segmentSegmentRequired. Text; maximum UTF-16 length 8192.
fieldNumberField NumberRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
splitIndexIndex into an array including segment ID at position zero; -1 sentinel for the MSH-1 separator.Required. Safe integer.
separatorFieldWhether the requested field is MSH-1, which has no ordinary split-array element.Required. Boolean.
json
{
  "input": {
    "segment": "MSH",
    "fieldNumber": 2
  },
  "output": {
    "splitIndex": 1,
    "separatorField": false
  }
}

Limitations and assumptions

  • The split array includes segment ID at index zero and the MSH separator is outside that indexing; no full HL7 message, delimiter configuration, field semantics, or profile is validated.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use the relevant full standard, implementation profile, and validated parser when interoperable or clinical record validity matters.

References

  1. Calculation and input contract: health-informatics/hl7-segment-field-number-offset — tool.io

Similar or alternative tools