# `HL7v2.Segment.OBXValue`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/segment/obx_value.ex#L1)

Dispatches OBX-5 (observation_value) parsing based on OBX-2 (value_type).

When OBX-2 declares a known data type, the observation value is parsed into
the corresponding typed struct. Unknown types are preserved as raw values.

Per the HL7 v2.5.1 specification (Section 7.4.2), the data type of OBX-5
varies at runtime based on the value of OBX-2.

# `encode`

```elixir
@spec encode(term(), binary() | nil) :: term()
```

Encodes a typed OBX-5 value back to its raw wire representation.

Used before segment encoding so the `:raw` encode path receives
a value the wire encoder can serialize (strings and lists of strings).

# `known_types`

```elixir
@spec known_types() :: [binary()]
```

Returns all known value type codes.

# `parse`

```elixir
@spec parse(term(), binary() | nil) :: term()
```

Parses OBX-5 value(s) based on the declared value type from OBX-2.

Returns the parsed value for single values, or a list for repeating values.
Unknown types are preserved as-is (raw).

# `type_for`

```elixir
@spec type_for(binary()) :: module() | nil
```

Returns the type module for a given OBX-2 value, or nil.

---

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