# `HL7v2.Standard.Coverage`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/standard/coverage.ex#L1)

Computes library coverage against the HL7 v2.5.1 standard.

Reports which segments, types, and structures are typed, raw, or unsupported,
and identifies specific fields that fall back to `:raw` within typed segments.

Fields listed in `@runtime_dispatched` are intentionally declared as `:raw`
because their concrete type is resolved at runtime (e.g. OBX-5 whose type
depends on OBX-2 Value Type). These are reported separately from true raw
gaps so coverage reports reflect genuine implementation work remaining.

# `coverage_summary`

```elixir
@spec coverage_summary() :: map()
```

Returns a summary map of coverage statistics.

## Examples

    iex> summary = HL7v2.Standard.Coverage.coverage_summary()
    iex> is_integer(summary.typed_segment_count)
    true

# `fully_typed_segments`

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

Returns segments where all fields are typed (no `:raw` holes).

# `partially_typed_segments`

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

Returns segments with at least one `:raw` hole.

# `raw_holes`

```elixir
@spec raw_holes() :: [{binary(), atom(), pos_integer()}]
```

Returns specific segment fields that are typed as `:raw` within
otherwise typed segments — true raw gaps that need implementation.

Fields listed in `@runtime_dispatched` (e.g. OBX-5) are excluded because
their `:raw` typing is intentional. Use `runtime_dispatched/0` to inspect those.

# `runtime_dispatched`

```elixir
@spec runtime_dispatched() :: [{binary(), atom(), pos_integer()}]
```

Returns fields that are intentionally declared as `:raw` because their
concrete type is resolved at runtime (e.g. OBX-5 whose type depends on
OBX-2 Value Type).

Only fields present in both `@runtime_dispatched` and the actual segment
definitions are returned (i.e. the allowlist is intersected with reality).

# `segment_completeness`

```elixir
@spec segment_completeness() :: [
  {binary(), non_neg_integer(), non_neg_integer(), float()}
]
```

Returns per-segment field completeness: `{segment_id, typed_count, total_count, pct}`.

Segments with all fields typed show 100.0%. Segments with `:raw` holes show lower.

# `typed_segments`

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

Returns all typed segment IDs.

## Examples

    iex> "PID" in HL7v2.Standard.Coverage.typed_segments()
    true

# `typed_types`

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

Returns data types with full parse/encode modules.

# `unsupported_segments`

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

Returns segments that exist in the standard but are not typed.
These segments are preserved as raw tuples during typed parsing.

# `unsupported_types`

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

Returns data types that exist in the standard but are not implemented.

---

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