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

Channel Definition (CD) -- HL7v2 composite data type.

Defines a waveform channel's identifier, source, sensitivity, calibration,
and sampling parameters. Used in OBX for waveform observations.

10 components:
1. Channel Identifier (WVI) -- sub-components
2. Waveform Source (WVS) -- sub-components
3. Channel Sensitivity and Units (CSU) -- sub-components
4. Channel Calibration Parameters (CCP) -- sub-components
5. Channel Sampling Frequency (NM)
6. Minimum Data Value (NR) -- sub-components
7. Maximum Data Value (NR) -- sub-components
8-10: reserved/raw

# `t`

```elixir
@type t() :: %HL7v2.Type.CD{
  channel_calibration_parameters: HL7v2.Type.CCP.t() | nil,
  channel_identifier: HL7v2.Type.WVI.t() | nil,
  channel_sampling_frequency: binary() | nil,
  channel_sensitivity_and_units: HL7v2.Type.CSU.t() | nil,
  maximum_data_value: HL7v2.Type.NR.t() | nil,
  minimum_data_value: HL7v2.Type.NR.t() | nil,
  waveform_source: HL7v2.Type.WVS.t() | nil
}
```

# `encode`

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

Encodes a CD to a list of component strings.

## Examples

    iex> HL7v2.Type.CD.encode(%HL7v2.Type.CD{channel_identifier: %HL7v2.Type.WVI{channel_number: "1", channel_name: "Lead I"}})
    ["1&Lead I"]

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

# `parse`

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

Parses a CD from a list of components.

## Examples

    iex> HL7v2.Type.CD.parse(["1&Lead I", "RA&LA"])
    %HL7v2.Type.CD{
      channel_identifier: %HL7v2.Type.WVI{channel_number: "1", channel_name: "Lead I"},
      waveform_source: %HL7v2.Type.WVS{source_one_name: "RA", source_two_name: "LA"}
    }

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

---

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