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?
readonlyoptionalaccountNumber?:CX
Patient account number (PID-18 / MRG-3).
identifiers
readonlyidentifiers: readonlyCX[]
Identifier list (PID-3 / MRG-1), every non-empty CX repetition.
legacyPatientId?
readonlyoptionallegacyPatientId?: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?
readonlyoptionalname?:XPN
Patient name (PID-5 / MRG-7, first repetition).
role
readonlyrole:IdentityRole
Role of this party in the event: the safety-critical label.
sourceSegment
readonlysourceSegment:"PID"|"MRG"
Segment this party was sourced from: provenance for the role label.
visitNumber?
readonlyoptionalvisitNumber?:CX
Visit number (PV1-19 for a PID party / MRG-5 for a prior party).