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

Specimen Source (SPS) -- HL7v2 composite data type.

Deprecated in v2.5.1 (replaced by SPM segment), but retained for backward
compatibility with OBR-15 which uses this type.

7 components:
1. Specimen Source Name or Code (CWE) -- sub-components delimited by `&`
2. Additives (CWE) -- sub-components delimited by `&`
3. Specimen Collection Method (TX)
4. Body Site (CWE) -- sub-components delimited by `&`
5. Site Modifier (CWE) -- sub-components delimited by `&`
6. Collection Method Modifier Code (CWE) -- sub-components delimited by `&`
7. Specimen Role (CWE) -- sub-components delimited by `&`

# `t`

```elixir
@type t() :: %HL7v2.Type.SPS{
  additives: HL7v2.Type.CWE.t() | nil,
  body_site: HL7v2.Type.CWE.t() | nil,
  collection_method_modifier_code: HL7v2.Type.CWE.t() | nil,
  site_modifier: HL7v2.Type.CWE.t() | nil,
  specimen_collection_method: binary() | nil,
  specimen_role: HL7v2.Type.CWE.t() | nil,
  specimen_source_name_or_code: HL7v2.Type.CWE.t() | nil
}
```

# `encode`

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

Encodes an SPS to a list of component strings.

## Examples

    iex> HL7v2.Type.SPS.encode(%HL7v2.Type.SPS{specimen_source_name_or_code: %HL7v2.Type.CWE{identifier: "BLD", text: "Blood"}, specimen_collection_method: "Venipuncture"})
    ["BLD&Blood", "", "Venipuncture"]

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

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

# `parse`

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

Parses an SPS from a list of components.

## Examples

    iex> HL7v2.Type.SPS.parse(["BLD&Blood&HL70070", "", "Venipuncture"])
    %HL7v2.Type.SPS{
      specimen_source_name_or_code: %HL7v2.Type.CWE{identifier: "BLD", text: "Blood", name_of_coding_system: "HL70070"},
      specimen_collection_method: "Venipuncture"
    }

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

---

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