HlSegment¶
HlSegment models the X12 HL hierarchical level segment, used throughout 837 claim transactions to establish parent/child loop relationships (e.g. billing provider → subscriber → patient). Its child-level indicator can be supplied either as an explicit code or derived from a boolean flag, and Fill() recomputes that flag strictly from whether the code equals "1" (BR-052).
Purpose¶
- Represents the HL segment identity via
SegmentIdreturning the literal"HL"(BR-020). - Carries
IdNumberandParentIdNumberestablishing this level's position in the hierarchy, plusLevelCodeclassifying the level's loop type. - Reports whether the level has children via element 4: an explicit
ChildCodewhen supplied, otherwise"1"/"0"derived fromChildExists(BR-052). - On
Fill(), setsChildExiststo true only when the parsedChildCodeequals"1"(BR-052).
Context¶
- Namespace:
SAIF.Common.Files.Edi.Segments - Assembly/package:
SAIF.Framework.Common.Files
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SegmentId | string SegmentId { get; } |
Returns the literal X12 segment identifier "HL". |
| IdNumber | int IdNumber { get; set; } |
This hierarchical level's own identifier (HL01), element 1. |
| ParentIdNumber | int? ParentIdNumber { get; set; } |
The identifier of this level's parent in the hierarchy (HL02), element 2. |
| LevelCode | string LevelCode { get; set; } |
The code classifying this level's loop type (HL03), element 3. |
| ChildCode | string ChildCode { get; set; } |
An explicit child-level indicator string (HL04); when set, takes precedence over ChildExists on Build() (BR-052). |
| ChildExists | bool? ChildExists { get; set; } |
Whether this level has child levels; used to derive "1"/"0" for element 4 when ChildCode is null, and recomputed on Fill() as ChildCode == "1" (BR-052). |
| Build | IEdiSegment Build() |
Creates a SegmentBuilder("HL"), adds IdNumber, ParentIdNumber, and LevelCode at elements 1-3, then adds element 4 as ChildCode if set, else as "1"/"0" from ChildExists if set, else omits it, returning the built segment (BR-052). |
| Fill | void Fill(IEdiSegment segment) |
Parses elements 1-2 as int via int.TryParse, reads LevelCode and ChildCode at elements 3-4, and sets ChildExists to (ChildCode == "1") (BR-052). |
| Parse | static HlSegment Parse(IEdiSegment segment) |
Instantiates a new HlSegment, calls Fill(segment) on it, and returns it. |
Behavioral notes¶
Fill()setsChildExiststo false (not null) wheneverChildCodeis anything other than"1", including when the segment carries no element 4 at all, sinceGetChildValuereturns an empty string rather than null in that case*.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- Common\SAIF.Common.Files\Edi\Segments\HlSegment.cs