Conformance fixture corpus statistics.
The canonical structure list and fixture filenames are frozen at compile time by walking the fixture directory and extracting MSH-9 from each wire file. This means:
coverage/0,list_fixtures/0, andunique_canonical_structures/0return compile-time-frozen results with no runtime disk access. The fixture files ship inside the Hex package, and CI verifies the tarball fixture count matches the frozen list.- Changing any fixture file triggers recompilation via
@external_resource. - Canonical resolution uses the same fallback logic as
HL7v2.Validation— if the trigger-specific structure is unregistered, the bare message_code is tried before giving up. This correctly reportsACKforACK^A01^ACK_A01, not the unregisteredACK_A01.
This module is the single source of truth for fixture corpus counts
reported in docs, CHANGELOG, and mix hl7v2.coverage.
Summary
Functions
Compares the compile-time-frozen fixture list against the current on-disk state of the fixture directory.
Returns a map summarizing the conformance fixture corpus.
Returns the sorted list of message family prefixes covered by the corpus
(e.g. "ADT", "ORU", "MFN"). Derived from canonical structure names.
Returns the sorted list of fixture filenames included in the corpus.
Returns the sorted deduplicated list of canonical message structures
covered by the corpus. Uses the same alias fallback as validation, so
ACK^A01^ACK_A01 resolves to the registered ACK structure rather than
the unregistered ACK_A01.
Types
@type coverage() :: %{ files: non_neg_integer(), canonical: non_neg_integer(), total_official: non_neg_integer(), pct: float() }
Functions
Compares the compile-time-frozen fixture list against the current on-disk state of the fixture directory.
Returns:
:ok— frozen list matches on-disk state{:stale, on_disk_only: [...], frozen_only: [...]}— drift detected{:error, :fixture_dir_unavailable}— the fixture directory does not exist or is unreadable (e.g. the corpus was not shipped in a Hex artifact). As of v3.3.3 the corpus ships in the Hex package, so a missing directory is itself a release-surface regression and is reported loudly by default.
Options for dependency injection in tests and opt-out for edge cases:
:dir— override the directory to compare against (default: compile-time@fixture_dir):frozen— override the frozen list (default: compile-time@fixtures):allow_missing— whentrue, return:okinstead of{:error, :fixture_dir_unavailable}when the directory is not readable. Default:false.
@spec coverage() :: coverage()
Returns a map summarizing the conformance fixture corpus.
:files— number of.hl7fixture files:canonical— number of unique canonical message structures covered:total_official— 186 (HL7 v2.5.1 official structures):pct— canonical / total_official as a percentage, rounded to 1 decimal
@spec families() :: [binary()]
Returns the sorted list of message family prefixes covered by the corpus
(e.g. "ADT", "ORU", "MFN"). Derived from canonical structure names.
@spec list_fixtures() :: [binary()]
Returns the sorted list of fixture filenames included in the corpus.
Returns the sorted deduplicated list of canonical message structures
covered by the corpus. Uses the same alias fallback as validation, so
ACK^A01^ACK_A01 resolves to the registered ACK structure rather than
the unregistered ACK_A01.
The files argument is ignored and kept for backwards compatibility —
the result is frozen at compile time regardless of input.