Reference·PR1 Segment·PR1-1
HL7 v2 Reference

Testing HL7 v2 PR1-1: What Set ID Actually Needs to Handle

Jul 27, 2026 · 4 min read
PR1-3 →

A single encounter can produce several PR1 segments — one per procedure performed during the visit — and PR1-1 is the only field that tells a receiving system which order they belong in. Renumber it incorrectly and a downstream system can misattribute a secondary procedure as the primary one.

Quick answer

PR1-1 is the first field of the HL7 v2 PR1 segment — a simple integer that numbers each repeating PR1 within the message, starting at 1, so systems can distinguish multiple procedures recorded for the same encounter.

What this field contains

1
First procedure — the first PR1 segment in the message
2, 3...
Subsequent procedures — each additional PR1 increments by one, in segment order
gaps/resets
Malformed sequence — a skipped or duplicated number usually points to an upstream generation bug

Example

Synthetic example Generated by Synthibase
PR1|1||47562^LAPAROSCOPIC CHOLECYSTECTOMY^CPT|LAPAROSCOPIC REMOVAL OF GALLBLADDER VIA FOUR SMALL ABDOMINAL INCISIONS|20260726103000|P||8842^REYES^MONICA^L^^^MD

PR1-1 is set to 1, marking this as the first (and here, only) procedure recorded for the encounter. Synthetic record — not a real patient.

Where this trips people up

Set ID rarely makes anyone's test checklist until a multi-procedure encounter shows up. If an interface engine splits a message with three PR1 segments into separate downstream feeds and forgets to renumber PR1-1 for each split, systems that key a lookup table off Set ID start overwriting one procedure's data with another's. Build at least one test case around a visit with multiple procedures, not just single-procedure encounters, and confirm the numbering survives any message transformation intact.

HL7 v2 PR1 Segment Guide: Fields, Format, and Testing Gotchas
HL7 ADT Messages: A01 through A08 Explained
Regression Testing for EHR Upgrades: A Complete Guide
Generate multi-procedure HL7 messages automatically
Synthibase generates synthetic HL7 messages with correctly sequenced, repeating PR1 segments — no manual message-building required.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.