Skip to main content
Version: v0.0.4

Interface: IdentityParty

One party (one patient identity) in an identity event, labelled by role with its source segment recorded as provenance. Absent fields are OMITTED (exactOptionalPropertyTypes). All arrays and the object itself are frozen.

Field sources by sourceSegment:

  • "PID": identifiers = PID-3 repetitions, legacyPatientId = PID-2 (pre-v2.7 only), accountNumber = PID-18, visitNumber = PV1-19 (from the group's PV1, when present), name = PID-5 (first repetition).
  • "MRG": identifiers = MRG-1 repetitions, legacyPatientId = MRG-4 (pre-v2.7 only), accountNumber = MRG-3, visitNumber = MRG-5, name = MRG-7 (first repetition).

Example

import { parseHL7 } from "@cosyte/hl7";
const ev = parseHL7(raw).identityEvents()[0];
if (ev?.prior) {
console.log(ev.prior.role); // "prior"
console.log(ev.prior.sourceSegment); // "MRG"
for (const cx of ev.prior.identifiers) console.log(cx.idNumber);
}

Properties

accountNumber?

readonly optional accountNumber?: CX

Patient account number (PID-18 / MRG-3).


identifiers

readonly identifiers: readonly CX[]

Identifier list (PID-3 / MRG-1), every non-empty CX repetition.


legacyPatientId?

readonly optional legacyPatientId?: CX

Legacy single patient ID (PID-2 / MRG-4). Backward-compat only; withdrawn as of HL7 v2.7: OMITTED (not read) when MSH-12 declares v2.7 or later.


name?

readonly optional name?: XPN

Patient name (PID-5 / MRG-7, first repetition).


role

readonly role: IdentityRole

Role of this party in the event: the safety-critical label.


sourceSegment

readonly sourceSegment: "PID" | "MRG"

Segment this party was sourced from: provenance for the role label.


visitNumber?

readonly optional visitNumber?: CX

Visit number (PV1-19 for a PID party / MRG-5 for a prior party).