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.
Summary
Functions
Returns a summary map of coverage statistics.
Returns segments where all fields are typed (no :raw holes).
Returns segments with at least one :raw hole.
Returns specific segment fields that are typed as :raw within
otherwise typed segments — true raw gaps that need implementation.
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).
Returns per-segment field completeness: {segment_id, typed_count, total_count, pct}.
Returns all typed segment IDs.
Returns data types with full parse/encode modules.
Returns segments that exist in the standard but are not typed. These segments are preserved as raw tuples during typed parsing.
Returns data types that exist in the standard but are not implemented.
Functions
@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
@spec fully_typed_segments() :: [binary()]
Returns segments where all fields are typed (no :raw holes).
@spec partially_typed_segments() :: [binary()]
Returns segments with at least one :raw hole.
@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.
@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).
@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.
@spec typed_segments() :: [binary()]
Returns all typed segment IDs.
Examples
iex> "PID" in HL7v2.Standard.Coverage.typed_segments()
true
@spec typed_types() :: [binary()]
Returns data types with full parse/encode modules.
@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.
@spec unsupported_types() :: [binary()]
Returns data types that exist in the standard but are not implemented.