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

Compile-time validated HL7v2 path sigil.

The `~h` sigil validates path syntax, segment/field existence, repetition legality,
and component bounds at compile time, catching errors before the code runs.
Returns a `%HL7v2.Path{}` struct that can be passed to `HL7v2.get/2` and
`HL7v2.fetch/2`.

## Usage

    import HL7v2.Sigil

    path = ~h"PID-5"        # validated at compile time
    name = HL7v2.get(msg, path)

    ~h"PID-55"              # ** (CompileError) PID has 39 fields, got 55
    ~h"XXX-1"               # warning: unknown segment XXX (not compile error — may be valid)

## Path Syntax

    ~h"PID"          — segment
    ~h"PID-5"        — field 5
    ~h"PID-5.1"      — component 1 of field 5
    ~h"PID-3[2]"     — repetition 2 of field 3
    ~h"OBX[*]-5"     — field 5 from ALL OBX segments
    ~h"OBX[2]-5"     — field 5 from the 2nd OBX segment
    ~h"PID-3[*]"     — ALL repetitions of PID-3

# `sigil_h`
*macro* 

Sigil for compile-time validated HL7v2 paths.

Returns a `%HL7v2.Path{}` struct. Path syntax is validated at compile time,
and known segments are checked for field bounds.

---

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