HL7v2.Type.XCN (HL7v2 v3.10.1)

Copy Markdown View Source

Extended Composite ID Number and Name for Persons (XCN) -- HL7v2 composite data type.

Used for attending doctors, ordering providers, entered-by persons, and other person identifiers that carry both an ID and a name.

23 components per HL7 v2.5.1:

  1. ID Number (ST)
  2. Family Name (FN) -- sub-components delimited by &
  3. Given Name (ST)
  4. Second and Further Given Names (ST)
  5. Suffix (ST)
  6. Prefix (ST)
  7. Degree (IS) -- deprecated
  8. Source Table (IS)
  9. Assigning Authority (HD) -- sub-components delimited by &
  10. Name Type Code (ID)
  11. Identifier Check Digit (ST)
  12. Check Digit Scheme (ID)
  13. Identifier Type Code (ID)
  14. Assigning Facility (HD) -- sub-components delimited by &
  15. Name Representation Code (ID)
  16. Name Context (CE) -- sub-components delimited by &
  17. Name Validity Range (DR) -- deprecated, sub-components delimited by &
  18. Name Assembly Order (ID)
  19. Effective Date (TS) -- sub-components delimited by &
  20. Expiration Date (TS) -- sub-components delimited by &
  21. Professional Suffix (ST)
  22. Assigning Jurisdiction (CWE) -- sub-components delimited by &
  23. Assigning Agency or Department (CWE) -- sub-components delimited by &

Summary

Functions

Encodes an XCN to a list of component strings.

Parses an XCN from a list of components.

Types

t()

@type t() :: %HL7v2.Type.XCN{
  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_scheme: binary() | nil,
  degree: binary() | nil,
  effective_date: HL7v2.Type.TS.t() | nil,
  expiration_date: HL7v2.Type.TS.t() | nil,
  family_name: HL7v2.Type.FN.t() | nil,
  given_name: binary() | nil,
  id_number: binary() | nil,
  identifier_check_digit: binary() | nil,
  identifier_type_code: binary() | nil,
  name_assembly_order: binary() | nil,
  name_context: HL7v2.Type.CE.t() | nil,
  name_representation_code: binary() | nil,
  name_type_code: binary() | nil,
  name_validity_range: HL7v2.Type.DR.t() | nil,
  prefix: binary() | nil,
  professional_suffix: binary() | nil,
  second_name: binary() | nil,
  source_table: binary() | nil,
  suffix: binary() | nil
}

Functions

encode(xcn)

@spec encode(t() | nil) :: list()

Encodes an XCN to a list of component strings.

Examples

iex> HL7v2.Type.XCN.encode(%HL7v2.Type.XCN{id_number: "12345", family_name: %HL7v2.Type.FN{surname: "Smith"}, given_name: "John"})
["12345", "Smith", "John"]

iex> HL7v2.Type.XCN.encode(nil)
[]

parse(components)

@spec parse(list()) :: t()

Parses an XCN from a list of components.

Component 2 (Family Name) contains sub-components delimited by &. Components 9, 14 (HD), 16 (CE), 17 (DR), 19-20 (TS), 22-23 (CWE) also contain sub-components delimited by &.

Examples

iex> HL7v2.Type.XCN.parse(["12345", "Smith", "John", "Q", "JR", "DR"])
%HL7v2.Type.XCN{
  id_number: "12345",
  family_name: %HL7v2.Type.FN{surname: "Smith"},
  given_name: "John",
  second_name: "Q",
  suffix: "JR",
  prefix: "DR"
}

iex> HL7v2.Type.XCN.parse(["12345", "Smith", "John", "", "", "", "", "", "MRN&1.2.3&ISO", "", "", "", "NPI"])
%HL7v2.Type.XCN{
  id_number: "12345",
  family_name: %HL7v2.Type.FN{surname: "Smith"},
  given_name: "John",
  assigning_authority: %HL7v2.Type.HD{namespace_id: "MRN", universal_id: "1.2.3", universal_id_type: "ISO"},
  identifier_type_code: "NPI"
}

iex> HL7v2.Type.XCN.parse([])
%HL7v2.Type.XCN{}