Extended Composite ID with Check Digit (CX) -- HL7v2 composite data type.
Used for MRN, patient IDs, visit numbers, and other identifiers.
10 components:
- ID Number (ST)
- Check Digit (ST)
- Check Digit Scheme (ID) -- Table 0061
- Assigning Authority (HD) -- sub-components delimited by
& - Identifier Type Code (ID) -- Table 0203: MR, PI, VN, AN, SS, etc.
- Assigning Facility (HD) -- sub-components delimited by
& - Effective Date (DT)
- Expiration Date (DT)
- Assigning Jurisdiction (CWE) -- sub-components delimited by
& - Assigning Agency or Department (CWE) -- sub-components delimited by
&
Summary
Types
@type t() :: %HL7v2.Type.CX{ assigning_agency: HL7v2.Type.CWE.t() | nil, assigning_authority: HL7v2.Type.HD.t() | nil, assigning_facility: HL7v2.Type.HD.t() | nil, assigning_jurisdiction: HL7v2.Type.CWE.t() | nil, check_digit: binary() | nil, check_digit_scheme: binary() | nil, effective_date: Date.t() | HL7v2.Type.DT.t() | nil, expiration_date: Date.t() | HL7v2.Type.DT.t() | nil, id: binary() | nil, identifier_type_code: binary() | nil }
Functions
Encodes a CX to a list of component strings.
Examples
iex> HL7v2.Type.CX.encode(%HL7v2.Type.CX{id: "12345", assigning_authority: %HL7v2.Type.HD{namespace_id: "MRN"}, identifier_type_code: "MR"})
["12345", "", "", "MRN", "MR"]
iex> HL7v2.Type.CX.encode(nil)
[]
Parses a CX from a list of components.
Components containing sub-components (HD, CWE) are split by & and
parsed into their respective structs.
Examples
iex> HL7v2.Type.CX.parse(["12345", "", "", "MRN", "MR"])
%HL7v2.Type.CX{id: "12345", assigning_authority: %HL7v2.Type.HD{namespace_id: "MRN"}, identifier_type_code: "MR"}
iex> HL7v2.Type.CX.parse(["12345", "", "", "MRN&1.2.3&ISO", "MR"])
%HL7v2.Type.CX{
id: "12345",
assigning_authority: %HL7v2.Type.HD{namespace_id: "MRN", universal_id: "1.2.3", universal_id_type: "ISO"},
identifier_type_code: "MR"
}
iex> HL7v2.Type.CX.parse([])
%HL7v2.Type.CX{}