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

Performing Person Time Stamp (PPN) -- HL7v2 composite data type.

Identifies a performing person with a timestamp of the action. Similar to XCN
but includes a date/time field for when the action was performed.

24 components per HL7 v2.5.1:
1. ID Number (ST)
2. Family Name (FN) -- sub-components
3. Given Name (ST)
4. Second and Further Given Names (ST)
5. Suffix (ST)
6. Prefix (ST)
7. Degree (IS)
8. Source Table (IS)
9. Assigning Authority (HD) -- sub-components
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
15. Date/Time Action Performed (TS) -- sub-components
16. Name Representation Code (ID)
17-24: Additional components (raw)

# `t`

```elixir
@type t() :: %HL7v2.Type.PPN{
  assigning_authority: HL7v2.Type.HD.t() | nil,
  assigning_facility: HL7v2.Type.HD.t() | nil,
  check_digit_scheme: binary() | nil,
  date_time_action_performed: HL7v2.Type.TS.t() | nil,
  degree: binary() | 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_representation_code: binary() | nil,
  name_type_code: binary() | nil,
  prefix: binary() | nil,
  raw_17_24: [binary()] | nil,
  second_name: binary() | nil,
  source_table: binary() | nil,
  suffix: binary() | nil
}
```

# `encode`

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

Encodes a PPN to a list of component strings.

## Examples

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

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

# `parse`

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

Parses a PPN from a list of components.

The first 16 components are parsed into typed fields. Components 17-24
are preserved as raw strings.

## Examples

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

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

---

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