Skip to main content
Version: v0.0.4

Variable: FINDING_CODES

const FINDING_CODES: object

The frozen registry of finding codes. Stable, additive string codes: a consumer compares finding.code === FINDING_CODES.PROFILE_REQUIRED_ABSENT. Segment-level vs field-level is disambiguated by whether the finding's FindingLocus.field is present, not by separate codes.

Type Declaration

PROFILE_CARDINALITY

readonly PROFILE_CARDINALITY: "PROFILE_CARDINALITY" = "PROFILE_CARDINALITY"

A segment-occurrence or field-repetition count is outside its cardinality.

PROFILE_LENGTH

readonly PROFILE_LENGTH: "PROFILE_LENGTH" = "PROFILE_LENGTH"

A checked component value exceeds the declared maximum length.

PROFILE_MALFORMED

readonly PROFILE_MALFORMED: "PROFILE_MALFORMED" = "PROFILE_MALFORMED"

The profile ITSELF is structurally malformed (a diagnostic, not a message finding).

PROFILE_NOT_PERMITTED

readonly PROFILE_NOT_PERMITTED: "PROFILE_NOT_PERMITTED" = "PROFILE_NOT_PERMITTED"

A Not-permitted (X) segment or field is present.

PROFILE_REQUIRED_ABSENT

readonly PROFILE_REQUIRED_ABSENT: "PROFILE_REQUIRED_ABSENT" = "PROFILE_REQUIRED_ABSENT"

A Required (R) segment or field is absent (or present-but-empty).

PROFILE_VALUE_NOT_IN_SET

readonly PROFILE_VALUE_NOT_IN_SET: "PROFILE_VALUE_NOT_IN_SET" = "PROFILE_VALUE_NOT_IN_SET"

A checked component value is not a member of the consumer-supplied value set.

Example

import { validateAgainstProfile, FINDING_CODES } from "@cosyte/hl7";
const { findings } = validateAgainstProfile(msg, profile);
const missing = findings.filter((f) => f.code === FINDING_CODES.PROFILE_REQUIRED_ABSENT);