X12 837P HI Segment Guide: Fields, Format, and Testing Gotchas
HI looks like a single segment but it's really a container for a whole list of diagnosis codes, each one wrapped in its own composite with a qualifier that says what role that diagnosis plays. Build a test file where the composites are out of order, or where the qualifier doesn't match the position, and the claim still parses fine — it just tells the payer the wrong condition was the reason for the visit.
HI (Health Care Diagnosis Code) is the segment in an 837P claim that carries the ICD-10-CM diagnosis codes tied to the claim. Each diagnosis sits in its own composite element within HI, made up of a qualifier that states the diagnosis type (principal, other, admitting, and so on) paired with the actual code value.
How the composite elements are structured
Example
ABK:E119 marks type 2 diabetes without complications as the principal diagnosis; ABF:I10 adds essential hypertension as a secondary diagnosis. Synthetic claim data.
Where this trips people up
Because every composite in HI shares the same qualifier:code shape, a test generator that just cycles through a code list without tracking which qualifier belongs in which position can produce a claim where a secondary condition ends up tagged as the principal diagnosis, or where two composites both claim to be principal. Nothing about the syntax flags this — the segment still validates — but downstream medical necessity and risk-adjustment logic reads the wrong diagnosis as the reason for the visit, and that's a much harder bug to trace back to its source.