# `HL7v2.Profiles.IHE.PDQ`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/profiles/ihe/pdq.ex#L1)

IHE Patient Demographics Query (PDQ) conformance profiles.

Ships factory functions for the two PDQ transactions in the IHE
ITI Technical Framework Vol 2:

- **ITI-21 Patient Demographics Query** — demographics-only query,
  `QBP^Q22` request → `RSP^K22` response. Source: IHE ITI TF-2
  §3.21.
- **ITI-22 Patient Demographics and Visit Query** — demographics
  plus visit information, `QBP^ZV1` request → `RSP^ZV2` response.
  The response carries a `PV1` segment per matched patient.
  Source: IHE ITI TF-2 §3.22.

Both transactions are defined on HL7 v2.5. QPD-1 (Message Query
Name) is pinned to `"IHE PDQ Query"` for both transactions — the
distinction is the trigger event in MSH-9.

## Usage

    profile = HL7v2.Profiles.IHE.PDQ.iti_21_query()
    HL7v2.validate(msg, profile: profile)

# `all`

```elixir
@spec all() :: %{required(String.t()) =&gt; HL7v2.Profile.t()}
```

Returns the complete PDQ profile catalog.

# `iti_21_query`

```elixir
@spec iti_21_query() :: HL7v2.Profile.t()
```

ITI-21 QBP^Q22 — Patient Demographics Query (request).

Requires MSH, QPD, RCP. QPD-1 pinned to `"IHE PDQ Query"`, RCP-1
pinned to `"I"` (Immediate). QPD-3 carries the search criteria
and must be populated with at least one @PID field reference.

Source: IHE ITI TF-2 §3.21.4.

# `iti_21_response`

```elixir
@spec iti_21_response() :: HL7v2.Profile.t()
```

ITI-21 RSP^K22 — Patient Demographics Query Response.

Requires MSH, MSA, QAK, QPD. PID, PD1 and QRI segments are part
of the optional per-patient group and are validated as present
when MSA-1 = AA and QAK-2 = OK.

MSA-1 ∈ {AA, AE, AR}. QAK-2 ∈ {OK, NF, AE}.

Source: IHE ITI TF-2 §3.21.4.2.

# `iti_22_query`

```elixir
@spec iti_22_query() :: HL7v2.Profile.t()
```

ITI-22 QBP^ZV1 — Patient Demographics and Visit Query (request).

Identical shape to ITI-21 Query except for the trigger event
(`ZV1` vs `Q22`). Supports additional visit-oriented search
fields in QPD-3 (PV1.2, PV1.3, PV1.7, etc.).

QPD-1 is still `"IHE PDQ Query"` (the message name does not
change between ITI-21 and ITI-22 — the trigger event does).

Source: IHE ITI TF-2 §3.22.4.

# `iti_22_response`

```elixir
@spec iti_22_response() :: HL7v2.Profile.t()
```

ITI-22 RSP^ZV2 — Patient Demographics and Visit Query Response.

Like ITI-21 response but each matched patient also carries a PV1
segment with PV1-2 (Patient Class) populated.

Source: IHE ITI TF-2 §3.22.4.2.

---

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