Skip to main content
Version: v0.0.4

Interface: FieldRule

A rule for one field position within a segment. Every constraint is optional; a rule with only a field index is a no-op.

Remarks

field is the 1-indexed HL7 position (MSH offset handled internally, exactly like Segment.field(n): { field: 9 } on MSH targets MSH-9). Length and value-set checks read the value at component (default 1), so a coded field's code (CWE.1 / CE.1) is checked by default; set component to check a different component. Both are applied per present repetition.

Properties

cardinality?

readonly optional cardinality?: Cardinality

Repetition-count constraint for this field.


component?

readonly optional component?: number

1-indexed component whose value the length / valueSet checks read. Defaults to 1 (the first component: a coded element's code).


field

readonly field: number

1-indexed HL7 field position (e.g. 3 for PID-3, 9 for MSH-9).


length?

readonly optional length?: number

Maximum character length of the checked component value (inclusive).


name?

readonly optional name?: string

Optional human label for the field (e.g. "Patient Identifier List"). Structural documentation for the profile author only: findings identify a field by its PHI-free structural locus (segment + index), never by this label, so the label is never echoed into a finding message.


severity?

readonly optional severity?: FindingSeverity

Severity for findings this rule produces. Defaults to "error". A profile author can downgrade a data-quality rule (e.g. a length or value-set check) to "warning" or "info" without changing the check itself.


usage?

readonly optional usage?: UsageCode

Usage constraint (see UsageCode). Omitted ⇒ Optional.


valueSet?

readonly optional valueSet?: readonly string[]

Consumer-supplied permitted-value list. The checked component value must be a member (case-sensitive exact match). hl7 ships no code set: this is BYO terminology; membership is a literal string check, never a LOINC / SNOMED / ICD / RxNorm lookup and never a network call.