Skip to main content
Version: v0.0.2

Interface: Build837Spec

The full input to "./build-837.js".build837P / build837I / build837D: the envelope, the submitter (Loop 1000A) + receiver (Loop 1000B), and the nested billing-provider → subscriber → (claims | patient) tree from which the builder COMPUTES the HL spine. A well-formed spec round-trips through get837Claims field-for-field; a structurally impossible tree is REFUSED with a "./build-errors.js".Claim837BuildError.

Example

import { build837P, X12Decimal, type Build837Spec } from "@cosyte/x12";
const spec: Build837Spec = {
envelope: {
senderId: "SUBMITTER", receiverId: "RECEIVER",
interchangeDate: "260601", interchangeTime: "1200",
interchangeControlNumber: "000000001",
groupControlNumber: "1", transactionSetControlNumber: "0001",
},
submitter: { entityIdentifierCode: "41", entityTypeQualifier: "2", name: "SUBMITTER ONE", idQualifier: "46", idCode: "SUB001" },
receiver: { entityIdentifierCode: "40", entityTypeQualifier: "2", name: "RECEIVER ONE", idQualifier: "46", idCode: "REC001" },
billingProviders: [{
provider: { entityIdentifierCode: "85", entityTypeQualifier: "2", name: "BILLING CLINIC INC", idQualifier: "XX", idCode: "1234567890" },
subscribers: [{
info: { payerResponsibilityCode: "P", individualRelationshipCode: "18", claimFilingIndicator: "MB" },
subscriber: { entityIdentifierCode: "IL", entityTypeQualifier: "1", name: "PATIENT", firstName: "TEST", idQualifier: "MI", idCode: "MEMBER001" },
payer: { entityIdentifierCode: "PR", entityTypeQualifier: "2", name: "PAYER ONE", idQualifier: "PI", idCode: "PAYER01" },
claims: [{
claimId: "PT-ACCT-001", totalCharge: X12Decimal.fromString("150.00")!,
diagnoses: [{ qualifier: "ABK", code: "J20.9" }],
serviceLines: [{ variant: "P", procedureQualifier: "HC", procedureCode: "99213", charge: X12Decimal.fromString("150.00")!, unitOfMeasure: "UN", units: X12Decimal.fromString("1")!, diagnosisPointers: ["1"] }],
}],
}],
}],
};
const ix = build837P(spec);

Properties

billingProviders

readonly billingProviders: readonly Build837BillingProviderSpec[]

Loop 2000A billing providers (≥ 1 required).


envelope

readonly envelope: Build837EnvelopeSpec

Interchange / group / transaction identity.


receiver

readonly receiver: Build837EntitySpec

Loop 1000B receiver (NM1*40).


submitter

readonly submitter: Build837EntitySpec

Loop 1000A submitter (NM1*41).