Skip to content
Back to skills

Hl7v2

ASecurity

HL7 v2.x segment/field reference and common parsing gotchas. Use when reading, debugging, or explaining an HL7 v2 message, or diagnosing why a message is rejected by a receiving system.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 6, 2026
ai-agentsgodebugging

Security analysis

A100/100

Scanned October 6, 2026

npx -y skills add sinteco/healthit-copilot --skill hl7v2 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hl7v2?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Hl7v2
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sinteco-hl7v2/badge)](https://www.skillsdirectory.com/skills/sinteco-hl7v2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: hl7v2
description: HL7 v2.x segment/field reference and common parsing gotchas. Use when reading, debugging, or explaining an HL7 v2 message, or diagnosing why a message is rejected by a receiving system.
---

# HL7 v2.x reference

Always `parse_hl7v2` first — it honors MSH-2 encoding chars so you don't
miscount components.

## Delimiters (from MSH)

MSH-1 = field separator. MSH-2 = encoding chars, normally caret/tilde/backslash/
ampersand: component, repetition, escape, subcomponent. Never assume — read them
from the message.

## Common rejection / interface causes

- **Wrong MSH structure** — MSH-1 is the separator itself; field numbering is
  offset. MSH-9 = message type (ORU^R01), MSH-12 = version.
- **Segment order / required segments** — ORU needs MSH, PID, OBR, OBX. A
  missing PID or OBR breaks most engines.
- **Line endings** — HL7 uses CR. LF or CRLF pasted from editors is the #1
  "why won't it parse" cause. The parser normalizes, but real interfaces may not.
- **Z-segments** — custom segments (Zxx); no standard mapping, flag them.

## Key segments

- **PID**: 3=identifier list, 5=name(family^given^middle), 7=DOB, 8=sex.
- **OBR**: 4=universal service ID (test code), 7=observation datetime, 25=result status.
- **OBX**: 2=value type, 3=observation ID (LOINC ideally), 5=value, 6=units,
  7=reference range, 8=abnormal flags, 11=result status.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…