Skip to main content
Version: v0.0.2

Interface: X12HierarchicalLevel

One HL segment captured during the walk. The 837 HL hierarchy is the safety primitive: HL-01 is this level's id (sequential within the transaction); HL-02 is the parent's id (empty when this is a top-level HL); HL-03 is the level code (20 Information Source = billing provider, 22 Subscriber, 23 Dependent/patient); HL-04 is 1 when any HL below it claims this as its parent, 0 otherwise.

Parent-pointer integrity is the #1 safety property. The walker validates HL-02 references an earlier-emitted HL-01 in the same transaction AND that the parent's HL-03 level is consistent with this level (20 → 22; 22 → 23). Violations emit X12_HL_PARENT_MISMATCH and X12_HL_PARENT_LEVEL_INVALID - the parser NEVER silently re-numbers.

Example

import type { X12HierarchicalLevel } from "@cosyte/x12";
declare const hl: X12HierarchicalLevel;
hl.hlId; // "1" (sequential within the transaction)
hl.parentHlId; // undefined for billing-provider top level
hl.levelCode; // "20"
hl.hasChild; // "1"

Properties

hasChild

readonly hasChild: string


hlId

readonly hlId: string


levelCode

readonly levelCode: string


parentHlId

readonly parentHlId: string | undefined