# `HL7v2.Type.CNN`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/type/cnn.ex#L1)

Composite Number and Name without Authority (CNN) -- HL7v2 composite data type.

A simplified person identifier used as the name component of NDL (Name with
Date and Location). Unlike XCN, CNN does not carry assigning authority or
identifier type information.

11 components per HL7 v2.5.1:
1. ID Number (ST)
2. Family Name (ST) -- simple string, not FN composite
3. Given Name (ST)
4. Second and Further Given Names or Initials (ST)
5. Suffix (ST)
6. Prefix (ST)
7. Degree (IS)
8. Source Table (IS)
9. Assigning Authority - Namespace ID (IS)
10. Assigning Authority - Universal ID (ST)
11. Assigning Authority - Universal ID Type (ID)

Note: components 9-11 are flattened parts of an HD, not a nested HD composite.

# `t`

```elixir
@type t() :: %HL7v2.Type.CNN{
  assigning_authority_namespace_id: binary() | nil,
  assigning_authority_universal_id: binary() | nil,
  assigning_authority_universal_id_type: binary() | nil,
  degree: binary() | nil,
  family_name: binary() | nil,
  given_name: binary() | nil,
  id_number: binary() | nil,
  prefix: binary() | nil,
  second_name: binary() | nil,
  source_table: binary() | nil,
  suffix: binary() | nil
}
```

# `encode`

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

Encodes a CNN to a list of component strings.

## Examples

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

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

    iex> HL7v2.Type.CNN.encode(%HL7v2.Type.CNN{})
    []

# `parse`

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

Parses a CNN from a list of components (or sub-components).

## Examples

    iex> HL7v2.Type.CNN.parse(["12345", "Smith", "John"])
    %HL7v2.Type.CNN{id_number: "12345", family_name: "Smith", given_name: "John"}

    iex> HL7v2.Type.CNN.parse(["12345", "Smith", "John", "Q", "JR", "DR", "MD", "PHYS", "NPI", "2.16.840.1.113883.4.6", "ISO"])
    %HL7v2.Type.CNN{
      id_number: "12345",
      family_name: "Smith",
      given_name: "John",
      second_name: "Q",
      suffix: "JR",
      prefix: "DR",
      degree: "MD",
      source_table: "PHYS",
      assigning_authority_namespace_id: "NPI",
      assigning_authority_universal_id: "2.16.840.1.113883.4.6",
      assigning_authority_universal_id_type: "ISO"
    }

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
