Skip to main content
Version: v0.0.2

Variable: CLAIM_837_BUILD_ERROR_CODES

const CLAIM_837_BUILD_ERROR_CODES: object

Stable string codes for every Claim837BuildError. Locked here so consumers can narrow exhaustively on err.code; additions-only thereafter (renaming any code is a breaking change).

  • X12_837_BUILD_INVALID_HIERARCHY - the billing-provider → subscriber → (claims | patient) tree cannot form a valid HL spine: no billing providers, a billing provider with no subscribers, a subscriber with neither direct claims nor dependent patients, or a dependent patient with no claims.
  • X12_837_BUILD_INVALID_SPEC - a non-hierarchy structural precondition failed: an empty claimId, a claim with no service lines, a service line whose variant does not match the builder, an empty procedure / revenue code, or an over-length control number.

Type Declaration

X12_837_BUILD_INVALID_HIERARCHY

readonly X12_837_BUILD_INVALID_HIERARCHY: "X12_837_BUILD_INVALID_HIERARCHY" = "X12_837_BUILD_INVALID_HIERARCHY"

X12_837_BUILD_INVALID_SPEC

readonly X12_837_BUILD_INVALID_SPEC: "X12_837_BUILD_INVALID_SPEC" = "X12_837_BUILD_INVALID_SPEC"

Example

import { CLAIM_837_BUILD_ERROR_CODES, Claim837BuildError, build837P } from "@cosyte/x12";
try {
build837P(spec);
} catch (err) {
if (
err instanceof Claim837BuildError &&
err.code === CLAIM_837_BUILD_ERROR_CODES.X12_837_BUILD_INVALID_HIERARCHY
) {
// the HL spine is impossible - fix the tree, do not emit
}
}