@cosyte/x12 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +234 -145
- package/README.md +19 -14
- package/TRADEMARKS.md +31 -0
- package/dist/index.cjs +132 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1291 -1291
- package/dist/index.d.ts +1291 -1291
- package/dist/index.mjs +132 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ function detectDelimiters(raw) {
|
|
|
53
53
|
if (raw.length < 3 || raw.slice(0, 3) !== "ISA") {
|
|
54
54
|
throw new X12ParseError(
|
|
55
55
|
FATAL_CODES.X12_NO_ISA_HEADER,
|
|
56
|
-
"Input does not begin with an ISA segment
|
|
56
|
+
"Input does not begin with an ISA segment - X12 interchanges must start with ISA.",
|
|
57
57
|
fatalPosition,
|
|
58
58
|
snip
|
|
59
59
|
);
|
|
@@ -61,7 +61,7 @@ function detectDelimiters(raw) {
|
|
|
61
61
|
if (raw.length < ISA_MIN_LENGTH) {
|
|
62
62
|
throw new X12ParseError(
|
|
63
63
|
FATAL_CODES.X12_ISA_TOO_SHORT,
|
|
64
|
-
`ISA segment is truncated
|
|
64
|
+
`ISA segment is truncated - need ${String(ISA_MIN_LENGTH)} bytes including the segment terminator, got ${String(raw.length)}.`,
|
|
65
65
|
fatalPosition,
|
|
66
66
|
snip
|
|
67
67
|
);
|
|
@@ -105,7 +105,7 @@ function detectDelimiters(raw) {
|
|
|
105
105
|
if (raw.charAt(pos) !== element) {
|
|
106
106
|
throw new X12ParseError(
|
|
107
107
|
FATAL_CODES.X12_INVALID_DELIMITERS,
|
|
108
|
-
`Element separator "${element}" was detected at ISA byte 4 but is missing at fixed ISA byte ${String(pos + 1)}
|
|
108
|
+
`Element separator "${element}" was detected at ISA byte 4 but is missing at fixed ISA byte ${String(pos + 1)} - ISA element layout is not 005010-conformant.`,
|
|
109
109
|
fatalPosition,
|
|
110
110
|
snip
|
|
111
111
|
);
|
|
@@ -177,35 +177,35 @@ function segmentCountMismatch(position, declared, actual) {
|
|
|
177
177
|
function trailingGarbage(position, byteCount) {
|
|
178
178
|
return {
|
|
179
179
|
code: WARNING_CODES.X12_TRAILING_GARBAGE,
|
|
180
|
-
message: `${String(byteCount)} byte(s) followed the IEA terminator
|
|
180
|
+
message: `${String(byteCount)} byte(s) followed the IEA terminator - preserved verbatim on \`trailingBytes\`.`,
|
|
181
181
|
position
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
function missingIea(position) {
|
|
185
185
|
return {
|
|
186
186
|
code: WARNING_CODES.X12_MISSING_IEA,
|
|
187
|
-
message: "Interchange has no IEA trailer
|
|
187
|
+
message: "Interchange has no IEA trailer - input is truncated.",
|
|
188
188
|
position
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
function missingGe(position) {
|
|
192
192
|
return {
|
|
193
193
|
code: WARNING_CODES.X12_MISSING_GE,
|
|
194
|
-
message: "Functional group has no GE trailer
|
|
194
|
+
message: "Functional group has no GE trailer - group is truncated.",
|
|
195
195
|
position
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
function missingSe(position) {
|
|
199
199
|
return {
|
|
200
200
|
code: WARNING_CODES.X12_MISSING_SE,
|
|
201
|
-
message: "Transaction set has no SE trailer
|
|
201
|
+
message: "Transaction set has no SE trailer - transaction is truncated.",
|
|
202
202
|
position
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
function danglingReleaseChar(position) {
|
|
206
206
|
return {
|
|
207
207
|
code: WARNING_CODES.X12_DANGLING_RELEASE_CHAR,
|
|
208
|
-
message: "Release character (`?`) appears at end of element/segment with no following byte to escape
|
|
208
|
+
message: "Release character (`?`) appears at end of element/segment with no following byte to escape - preserved verbatim.",
|
|
209
209
|
position
|
|
210
210
|
};
|
|
211
211
|
}
|
|
@@ -214,7 +214,7 @@ function unexpectedSegment(position, segmentId, context) {
|
|
|
214
214
|
const safeId = SEGMENT_ID_SHAPE_RE.test(segmentId) ? segmentId : "(non-spec)";
|
|
215
215
|
return {
|
|
216
216
|
code: WARNING_CODES.X12_UNEXPECTED_SEGMENT,
|
|
217
|
-
message: `Unexpected "${safeId}" segment
|
|
217
|
+
message: `Unexpected "${safeId}" segment - ${context}; segment is preserved on the prior open container if any.`,
|
|
218
218
|
position
|
|
219
219
|
};
|
|
220
220
|
}
|
|
@@ -230,7 +230,7 @@ function unknownCarc(position, code) {
|
|
|
230
230
|
const safe = CODE_LIST_VALUE_SHAPE_RE.test(code) ? code : "(non-spec)";
|
|
231
231
|
return {
|
|
232
232
|
code: WARNING_CODES.X12_UNKNOWN_CARC,
|
|
233
|
-
message: `Unknown CARC "${safe}"
|
|
233
|
+
message: `Unknown CARC "${safe}" - code is outside the bundled snapshot; verbatim value preserved, description unavailable.`,
|
|
234
234
|
position
|
|
235
235
|
};
|
|
236
236
|
}
|
|
@@ -238,7 +238,7 @@ function unknownRarc(position, code) {
|
|
|
238
238
|
const safe = CODE_LIST_VALUE_SHAPE_RE.test(code) ? code : "(non-spec)";
|
|
239
239
|
return {
|
|
240
240
|
code: WARNING_CODES.X12_UNKNOWN_RARC,
|
|
241
|
-
message: `Unknown RARC "${safe}"
|
|
241
|
+
message: `Unknown RARC "${safe}" - code is outside the bundled snapshot; verbatim value preserved, description unavailable.`,
|
|
242
242
|
position
|
|
243
243
|
};
|
|
244
244
|
}
|
|
@@ -250,7 +250,7 @@ function hlParentMismatch(position, hlId, declaredParentId) {
|
|
|
250
250
|
const safeParent = HL_ID_SHAPE_RE.test(declaredParentId) ? declaredParentId : "(non-spec)";
|
|
251
251
|
return {
|
|
252
252
|
code: WARNING_CODES.X12_HL_PARENT_MISMATCH,
|
|
253
|
-
message: `HL "${safeHl}" declares parent "${safeParent}" but no earlier HL with that id was emitted
|
|
253
|
+
message: `HL "${safeHl}" declares parent "${safeParent}" but no earlier HL with that id was emitted - parser preserves the declared pointer verbatim and NEVER silently re-numbers.`,
|
|
254
254
|
position
|
|
255
255
|
};
|
|
256
256
|
}
|
|
@@ -270,7 +270,7 @@ function unknownHiQualifier(position, qualifier) {
|
|
|
270
270
|
const safe = HI_QUALIFIER_SHAPE_RE.test(qualifier) ? qualifier : "(non-spec)";
|
|
271
271
|
return {
|
|
272
272
|
code: WARNING_CODES.X12_UNKNOWN_HI_QUALIFIER,
|
|
273
|
-
message: `Unknown HI qualifier "${safe}"
|
|
273
|
+
message: `Unknown HI qualifier "${safe}" - qualifier is outside the bundled HI_QUALIFIERS snapshot; verbatim qualifier + code preserved, codeSystem resolves to "unknown".`,
|
|
274
274
|
position
|
|
275
275
|
};
|
|
276
276
|
}
|
|
@@ -288,7 +288,7 @@ function unknown837Variant(position, implementationConventionReference) {
|
|
|
288
288
|
const safe = implementationConventionReference !== void 0 && ICR_SHAPE_RE.test(implementationConventionReference) ? implementationConventionReference : "(non-spec)";
|
|
289
289
|
return {
|
|
290
290
|
code: WARNING_CODES.X12_837_UNKNOWN_VARIANT,
|
|
291
|
-
message: `837 variant could not be resolved
|
|
291
|
+
message: `837 variant could not be resolved - ST-03 implementation convention reference "${safe}" is not one of "005010X222A2" / "X223A3" / "X224A2"; no SVx service-line segment was seen to fall back on.`,
|
|
292
292
|
position
|
|
293
293
|
};
|
|
294
294
|
}
|
|
@@ -297,7 +297,7 @@ function unknownClaimStatusCategory(position, code) {
|
|
|
297
297
|
const safe = CLAIM_STATUS_CATEGORY_SHAPE_RE.test(code) ? code : "(non-spec)";
|
|
298
298
|
return {
|
|
299
299
|
code: WARNING_CODES.X12_UNKNOWN_CLAIM_STATUS_CATEGORY,
|
|
300
|
-
message: `Unknown claim status category (CSCC) "${safe}"
|
|
300
|
+
message: `Unknown claim status category (CSCC) "${safe}" - code is outside the bundled snapshot; verbatim value preserved, description unavailable.`,
|
|
301
301
|
position
|
|
302
302
|
};
|
|
303
303
|
}
|
|
@@ -305,7 +305,7 @@ function unknownClaimStatus(position, code) {
|
|
|
305
305
|
const safe = CODE_LIST_VALUE_SHAPE_RE.test(code) ? code : "(non-spec)";
|
|
306
306
|
return {
|
|
307
307
|
code: WARNING_CODES.X12_UNKNOWN_CLAIM_STATUS,
|
|
308
|
-
message: `Unknown claim status code (CSC) "${safe}"
|
|
308
|
+
message: `Unknown claim status code (CSC) "${safe}" - code is outside the bundled snapshot; verbatim value preserved, description unavailable.`,
|
|
309
309
|
position
|
|
310
310
|
};
|
|
311
311
|
}
|
|
@@ -314,7 +314,7 @@ function unknownMaintenanceType(position, code) {
|
|
|
314
314
|
const safe = MAINTENANCE_TYPE_SHAPE_RE.test(code) ? code : "(non-spec)";
|
|
315
315
|
return {
|
|
316
316
|
code: WARNING_CODES.X12_834_UNKNOWN_MAINTENANCE_TYPE,
|
|
317
|
-
message: `Unknown 834 maintenance type "${safe}"
|
|
317
|
+
message: `Unknown 834 maintenance type "${safe}" - INS-03/HD-01 code is outside the bundled snapshot; verbatim value preserved, action NOT inferred.`,
|
|
318
318
|
position
|
|
319
319
|
};
|
|
320
320
|
}
|
|
@@ -393,7 +393,7 @@ var X12_DECIMAL_RE = /^([+-])?(\d*)(?:\.(\d*))?$/u;
|
|
|
393
393
|
var STATE = /* @__PURE__ */ new WeakMap();
|
|
394
394
|
var X12Decimal = class _X12Decimal {
|
|
395
395
|
/**
|
|
396
|
-
* Construct a new `X12Decimal` directly from state. Internal
|
|
396
|
+
* Construct a new `X12Decimal` directly from state. Internal - call
|
|
397
397
|
* `fromString` / `fromBigInt` / `ZERO` instead from outside the module.
|
|
398
398
|
* @internal
|
|
399
399
|
*/
|
|
@@ -405,7 +405,7 @@ var X12Decimal = class _X12Decimal {
|
|
|
405
405
|
* Decode an X12 R-type decimal element into an `X12Decimal`, or
|
|
406
406
|
* `undefined` when the input is empty or does not match the shape
|
|
407
407
|
* `[+-]?digits(.digits?)?`. **Empty string returns `undefined`, never
|
|
408
|
-
* zero**
|
|
408
|
+
* zero** - "not supplied" and "zero" are spec-distinct.
|
|
409
409
|
*
|
|
410
410
|
* @example
|
|
411
411
|
* ```ts
|
|
@@ -456,7 +456,7 @@ var X12Decimal = class _X12Decimal {
|
|
|
456
456
|
return new _X12Decimal({ raw, scaled: magnitude, scale, signum });
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
459
|
-
* Canonical zero with `scale: 0`
|
|
459
|
+
* Canonical zero with `scale: 0` - `"0"`. Used as the additive identity
|
|
460
460
|
* for balance reductions. Use `X12Decimal.fromBigInt(0n, n)` for a zero
|
|
461
461
|
* at a specific scale.
|
|
462
462
|
*
|
|
@@ -494,7 +494,7 @@ var X12Decimal = class _X12Decimal {
|
|
|
494
494
|
* Helpers return `X12Decimal`, not `number`; use this only for display
|
|
495
495
|
* or when the loss is acceptable. Magnitudes large enough to lose
|
|
496
496
|
* precision (> `Number.MAX_SAFE_INTEGER` after scaling) still convert
|
|
497
|
-
* without throwing
|
|
497
|
+
* without throwing - silently lossy.
|
|
498
498
|
*
|
|
499
499
|
* @example
|
|
500
500
|
* ```ts
|
|
@@ -574,7 +574,7 @@ var X12Decimal = class _X12Decimal {
|
|
|
574
574
|
* import { X12Decimal } from "@cosyte/x12";
|
|
575
575
|
* const a = X12Decimal.fromString("0.1")!;
|
|
576
576
|
* const b = X12Decimal.fromString("0.2")!;
|
|
577
|
-
* a.add(b).toString(); // "0.3"
|
|
577
|
+
* a.add(b).toString(); // "0.3" - exact, never 0.30000000000000004
|
|
578
578
|
* ```
|
|
579
579
|
*/
|
|
580
580
|
add(other) {
|
|
@@ -641,7 +641,7 @@ var X12Decimal = class _X12Decimal {
|
|
|
641
641
|
function state(d) {
|
|
642
642
|
const s = STATE.get(d);
|
|
643
643
|
if (s === void 0) {
|
|
644
|
-
throw new TypeError("X12Decimal instance has no internal state
|
|
644
|
+
throw new TypeError("X12Decimal instance has no internal state - was it tampered with?");
|
|
645
645
|
}
|
|
646
646
|
return s;
|
|
647
647
|
}
|
|
@@ -999,7 +999,7 @@ function decodeEnvelope(raw, delimiters) {
|
|
|
999
999
|
groupIndex: groups.length
|
|
1000
1000
|
},
|
|
1001
1001
|
"TA1",
|
|
1002
|
-
"TA1 segment is envelope-level
|
|
1002
|
+
"TA1 segment is envelope-level - appeared inside an open functional group"
|
|
1003
1003
|
)
|
|
1004
1004
|
);
|
|
1005
1005
|
break;
|
|
@@ -1336,7 +1336,7 @@ var CARC = Object.freeze({
|
|
|
1336
1336
|
meta: Object.freeze({
|
|
1337
1337
|
id: "CARC",
|
|
1338
1338
|
description: "Claim Adjustment Reason Codes",
|
|
1339
|
-
source: "WPC (Washington Publishing Company)
|
|
1339
|
+
source: "WPC (Washington Publishing Company) - x12.org/codes/claim-adjustment-reason-codes",
|
|
1340
1340
|
publishedDate: "2026-03-01",
|
|
1341
1341
|
snapshotDate: "2026-06-27",
|
|
1342
1342
|
note: "Pre-launch initial subset (~30 most commonly observed codes). Phase 10 ships a full-regen script."
|
|
@@ -1469,7 +1469,7 @@ var CLP_STATUS = Object.freeze({
|
|
|
1469
1469
|
source: "X12 005010X221A1 TR3 \xA7CLP Claim Payment Information, Element CLP-02 (Code Source 65)",
|
|
1470
1470
|
publishedDate: "2010-04-01",
|
|
1471
1471
|
snapshotDate: "2026-06-27",
|
|
1472
|
-
note: "Initial subset; X12-internal list (not WPC)
|
|
1472
|
+
note: "Initial subset; X12-internal list (not WPC) - codes are stable."
|
|
1473
1473
|
}),
|
|
1474
1474
|
codes: Object.freeze({
|
|
1475
1475
|
"1": "Processed as Primary",
|
|
@@ -1494,7 +1494,7 @@ var MAINTENANCE_TYPE_CODES = Object.freeze({
|
|
|
1494
1494
|
source: "WPC TR3 005010X220A1 \xA7INS Member Level Detail, Element INS-03 (Code Source 875)",
|
|
1495
1495
|
publishedDate: "2010-04-01",
|
|
1496
1496
|
snapshotDate: "2026-06-28",
|
|
1497
|
-
note: "HIPAA-relevant subset; X12-internal list
|
|
1497
|
+
note: "HIPAA-relevant subset; X12-internal list - codes are stable."
|
|
1498
1498
|
}),
|
|
1499
1499
|
codes: Object.freeze({
|
|
1500
1500
|
"001": "Change",
|
|
@@ -1518,7 +1518,7 @@ var SERVICE_TYPE_CODES = Object.freeze({
|
|
|
1518
1518
|
source: "ASC X12 005010X279A1 TR3 \xA7EB Eligibility or Benefit Information, Element EB-03 (Code Source 1365)",
|
|
1519
1519
|
publishedDate: "2008-08-01",
|
|
1520
1520
|
snapshotDate: "2026-06-27",
|
|
1521
|
-
note: "Initial common subset; X12-maintained list (~600 codes)
|
|
1521
|
+
note: "Initial common subset; X12-maintained list (~600 codes) - refreshed on the Phase 10 release cadence, never at runtime."
|
|
1522
1522
|
}),
|
|
1523
1523
|
codes: Object.freeze({
|
|
1524
1524
|
"1": "Medical Care",
|
|
@@ -1581,7 +1581,7 @@ var RARC = Object.freeze({
|
|
|
1581
1581
|
meta: Object.freeze({
|
|
1582
1582
|
id: "RARC",
|
|
1583
1583
|
description: "Remittance Advice Remark Codes",
|
|
1584
|
-
source: "WPC (Washington Publishing Company)
|
|
1584
|
+
source: "WPC (Washington Publishing Company) - x12.org/codes/remittance-advice-remark-codes",
|
|
1585
1585
|
publishedDate: "2026-03-01",
|
|
1586
1586
|
snapshotDate: "2026-06-27",
|
|
1587
1587
|
note: "Pre-launch initial subset (~15 most commonly observed codes). Phase 10 ships a full-regen script."
|
|
@@ -1683,7 +1683,7 @@ var HI_QUALIFIERS = {
|
|
|
1683
1683
|
DR: {
|
|
1684
1684
|
system: "DRG",
|
|
1685
1685
|
category: "drg",
|
|
1686
|
-
description: "Diagnosis Related Group (DRG)
|
|
1686
|
+
description: "Diagnosis Related Group (DRG) - payment-grouping code."
|
|
1687
1687
|
},
|
|
1688
1688
|
// ---------------- NUBC institutional code sets (837I) ----------------
|
|
1689
1689
|
BG: {
|
|
@@ -1694,17 +1694,17 @@ var HI_QUALIFIERS = {
|
|
|
1694
1694
|
BH: {
|
|
1695
1695
|
system: "NUBC-OCCURRENCE",
|
|
1696
1696
|
category: "occurrence",
|
|
1697
|
-
description: "Occurrence code (NUBC FL 31-34)
|
|
1697
|
+
description: "Occurrence code (NUBC FL 31-34) - date paired in HI-NN-4."
|
|
1698
1698
|
},
|
|
1699
1699
|
BI: {
|
|
1700
1700
|
system: "NUBC-OCCURRENCE-SPAN",
|
|
1701
1701
|
category: "occurrence-span",
|
|
1702
|
-
description: "Occurrence span code (NUBC FL 35-36)
|
|
1702
|
+
description: "Occurrence span code (NUBC FL 35-36) - date range in HI-NN-5/6."
|
|
1703
1703
|
},
|
|
1704
1704
|
BE: {
|
|
1705
1705
|
system: "NUBC-VALUE",
|
|
1706
1706
|
category: "value",
|
|
1707
|
-
description: "Value code (NUBC FL 39-41)
|
|
1707
|
+
description: "Value code (NUBC FL 39-41) - paired amount in HI-NN-5 as decimal."
|
|
1708
1708
|
},
|
|
1709
1709
|
PR: {
|
|
1710
1710
|
system: "NUBC-PATIENT-REASON",
|
|
@@ -2424,9 +2424,9 @@ function build835(spec) {
|
|
|
2424
2424
|
pad(envelope.receiverId, 15),
|
|
2425
2425
|
// ISA-08
|
|
2426
2426
|
pad(envelope.interchangeDate, 6),
|
|
2427
|
-
// ISA-09
|
|
2427
|
+
// ISA-09 - YYMMDD
|
|
2428
2428
|
pad(envelope.interchangeTime, 4),
|
|
2429
|
-
// ISA-10
|
|
2429
|
+
// ISA-10 - HHMM
|
|
2430
2430
|
repetitionSeparator,
|
|
2431
2431
|
// ISA-11
|
|
2432
2432
|
"00501",
|
|
@@ -2447,15 +2447,15 @@ function build835(spec) {
|
|
|
2447
2447
|
const gs = seg([
|
|
2448
2448
|
"GS",
|
|
2449
2449
|
X12_835_FUNCTIONAL_ID,
|
|
2450
|
-
// GS-01
|
|
2450
|
+
// GS-01 - "HP"
|
|
2451
2451
|
esc(applicationSenderCode),
|
|
2452
2452
|
// GS-02
|
|
2453
2453
|
esc(applicationReceiverCode),
|
|
2454
2454
|
// GS-03
|
|
2455
2455
|
groupDate,
|
|
2456
|
-
// GS-04
|
|
2456
|
+
// GS-04 - CCYYMMDD
|
|
2457
2457
|
groupTime,
|
|
2458
|
-
// GS-05
|
|
2458
|
+
// GS-05 - HHMM
|
|
2459
2459
|
esc(envelope.groupControlNumber),
|
|
2460
2460
|
// GS-06
|
|
2461
2461
|
X12_AGENCY_CODE,
|
|
@@ -2738,7 +2738,7 @@ function emitServiceLine(line, body, seg, esc, comp) {
|
|
|
2738
2738
|
esc(line.chargeAmount.toString()),
|
|
2739
2739
|
esc(line.paymentAmount.toString()),
|
|
2740
2740
|
"",
|
|
2741
|
-
// SVC-04
|
|
2741
|
+
// SVC-04 - revenue code is SVC-05 in X221A1; SVC-04 unused
|
|
2742
2742
|
esc(line.revenueCode ?? ""),
|
|
2743
2743
|
svc06,
|
|
2744
2744
|
line.paidUnitsOfService === void 0 ? "" : esc(line.paidUnitsOfService.toString())
|
|
@@ -2868,7 +2868,7 @@ function expandYY(yymmdd) {
|
|
|
2868
2868
|
// src/transactions/remit/loop-spec.ts
|
|
2869
2869
|
var REMIT_835_LOOP_2110 = defineLoopSpec({
|
|
2870
2870
|
id: "2110",
|
|
2871
|
-
description: "835 Loop 2110
|
|
2871
|
+
description: "835 Loop 2110 - Service Payment Information",
|
|
2872
2872
|
trigger: "SVC",
|
|
2873
2873
|
segments: [
|
|
2874
2874
|
{ id: "SVC", usage: "required", max: 1 },
|
|
@@ -2882,7 +2882,7 @@ var REMIT_835_LOOP_2110 = defineLoopSpec({
|
|
|
2882
2882
|
});
|
|
2883
2883
|
var REMIT_835_LOOP_2100 = defineLoopSpec({
|
|
2884
2884
|
id: "2100",
|
|
2885
|
-
description: "835 Loop 2100
|
|
2885
|
+
description: "835 Loop 2100 - Claim Payment Information",
|
|
2886
2886
|
trigger: "CLP",
|
|
2887
2887
|
segments: [
|
|
2888
2888
|
{ id: "CLP", usage: "required", max: 1 },
|
|
@@ -2901,7 +2901,7 @@ var REMIT_835_LOOP_2100 = defineLoopSpec({
|
|
|
2901
2901
|
});
|
|
2902
2902
|
var REMIT_835_LOOP_2000 = defineLoopSpec({
|
|
2903
2903
|
id: "2000",
|
|
2904
|
-
description: "835 Loop 2000
|
|
2904
|
+
description: "835 Loop 2000 - Header Number",
|
|
2905
2905
|
trigger: "LX",
|
|
2906
2906
|
segments: [
|
|
2907
2907
|
{ id: "LX", usage: "required", max: 1 },
|
|
@@ -2912,7 +2912,7 @@ var REMIT_835_LOOP_2000 = defineLoopSpec({
|
|
|
2912
2912
|
});
|
|
2913
2913
|
var REMIT_835_LOOP_1000A = defineLoopSpec({
|
|
2914
2914
|
id: "1000A",
|
|
2915
|
-
description: "835 Loop 1000A
|
|
2915
|
+
description: "835 Loop 1000A - Payer Identification",
|
|
2916
2916
|
trigger: "N1",
|
|
2917
2917
|
segments: [
|
|
2918
2918
|
{ id: "N1", usage: "required", max: 1 },
|
|
@@ -2924,7 +2924,7 @@ var REMIT_835_LOOP_1000A = defineLoopSpec({
|
|
|
2924
2924
|
});
|
|
2925
2925
|
var REMIT_835_LOOP_1000B = defineLoopSpec({
|
|
2926
2926
|
id: "1000B",
|
|
2927
|
-
description: "835 Loop 1000B
|
|
2927
|
+
description: "835 Loop 1000B - Payee Identification",
|
|
2928
2928
|
trigger: "N1",
|
|
2929
2929
|
segments: [
|
|
2930
2930
|
{ id: "N1", usage: "required", max: 1 },
|
|
@@ -3054,7 +3054,7 @@ function get837Claims(delimiters, tx, opts) {
|
|
|
3054
3054
|
payToPlan = next;
|
|
3055
3055
|
},
|
|
3056
3056
|
// Setters for `subscriber` / `patient` route through `withCurrent`,
|
|
3057
|
-
// which short-circuits when the current value is undefined
|
|
3057
|
+
// which short-circuits when the current value is undefined - so the
|
|
3058
3058
|
// cast inside the spread is sound. Setters for `otherSubscriber` /
|
|
3059
3059
|
// `otherPayer` are only reached after an SBR in Loop 2320 opened
|
|
3060
3060
|
// `currentOtherSubscriber`, and the `activeEntity.kind` discriminator
|
|
@@ -4587,7 +4587,7 @@ function expandYY2(yymmdd) {
|
|
|
4587
4587
|
// src/transactions/claim/loop-spec.ts
|
|
4588
4588
|
var CLAIM_837_LOOP_2010AA = defineLoopSpec({
|
|
4589
4589
|
id: "2010AA",
|
|
4590
|
-
description: "837 Loop 2010AA
|
|
4590
|
+
description: "837 Loop 2010AA - Billing Provider Name",
|
|
4591
4591
|
trigger: "NM1",
|
|
4592
4592
|
segments: [
|
|
4593
4593
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -4599,7 +4599,7 @@ var CLAIM_837_LOOP_2010AA = defineLoopSpec({
|
|
|
4599
4599
|
});
|
|
4600
4600
|
var CLAIM_837_LOOP_2010BA = defineLoopSpec({
|
|
4601
4601
|
id: "2010BA",
|
|
4602
|
-
description: "837 Loop 2010BA
|
|
4602
|
+
description: "837 Loop 2010BA - Subscriber Name",
|
|
4603
4603
|
trigger: "NM1",
|
|
4604
4604
|
segments: [
|
|
4605
4605
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -4612,7 +4612,7 @@ var CLAIM_837_LOOP_2010BA = defineLoopSpec({
|
|
|
4612
4612
|
});
|
|
4613
4613
|
var CLAIM_837_LOOP_2010BB = defineLoopSpec({
|
|
4614
4614
|
id: "2010BB",
|
|
4615
|
-
description: "837 Loop 2010BB
|
|
4615
|
+
description: "837 Loop 2010BB - Payer Name",
|
|
4616
4616
|
trigger: "NM1",
|
|
4617
4617
|
segments: [
|
|
4618
4618
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -4624,7 +4624,7 @@ var CLAIM_837_LOOP_2010BB = defineLoopSpec({
|
|
|
4624
4624
|
});
|
|
4625
4625
|
var CLAIM_837_LOOP_2010CA = defineLoopSpec({
|
|
4626
4626
|
id: "2010CA",
|
|
4627
|
-
description: "837 Loop 2010CA
|
|
4627
|
+
description: "837 Loop 2010CA - Patient Name",
|
|
4628
4628
|
trigger: "NM1",
|
|
4629
4629
|
segments: [
|
|
4630
4630
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -4636,7 +4636,7 @@ var CLAIM_837_LOOP_2010CA = defineLoopSpec({
|
|
|
4636
4636
|
});
|
|
4637
4637
|
var CLAIM_837P_LOOP_2410 = defineLoopSpec({
|
|
4638
4638
|
id: "2410",
|
|
4639
|
-
description: "837P Loop 2410
|
|
4639
|
+
description: "837P Loop 2410 - Drug Identification",
|
|
4640
4640
|
trigger: "LIN",
|
|
4641
4641
|
segments: [
|
|
4642
4642
|
{ id: "LIN", usage: "required", max: 1 },
|
|
@@ -4646,7 +4646,7 @@ var CLAIM_837P_LOOP_2410 = defineLoopSpec({
|
|
|
4646
4646
|
});
|
|
4647
4647
|
var CLAIM_837_LOOP_2430 = defineLoopSpec({
|
|
4648
4648
|
id: "2430",
|
|
4649
|
-
description: "837 Loop 2430
|
|
4649
|
+
description: "837 Loop 2430 - Line Adjudication Information",
|
|
4650
4650
|
trigger: "SVD",
|
|
4651
4651
|
segments: [
|
|
4652
4652
|
{ id: "SVD", usage: "required", max: 1 },
|
|
@@ -4657,7 +4657,7 @@ var CLAIM_837_LOOP_2430 = defineLoopSpec({
|
|
|
4657
4657
|
});
|
|
4658
4658
|
var CLAIM_837P_LOOP_2400 = defineLoopSpec({
|
|
4659
4659
|
id: "2400",
|
|
4660
|
-
description: "837P Loop 2400
|
|
4660
|
+
description: "837P Loop 2400 - Service Line (professional)",
|
|
4661
4661
|
trigger: "LX",
|
|
4662
4662
|
segments: [
|
|
4663
4663
|
{ id: "LX", usage: "required", max: 1 },
|
|
@@ -4672,7 +4672,7 @@ var CLAIM_837P_LOOP_2400 = defineLoopSpec({
|
|
|
4672
4672
|
});
|
|
4673
4673
|
var CLAIM_837I_LOOP_2400 = defineLoopSpec({
|
|
4674
4674
|
id: "2400",
|
|
4675
|
-
description: "837I Loop 2400
|
|
4675
|
+
description: "837I Loop 2400 - Service Line (institutional)",
|
|
4676
4676
|
trigger: "LX",
|
|
4677
4677
|
segments: [
|
|
4678
4678
|
{ id: "LX", usage: "required", max: 1 },
|
|
@@ -4686,7 +4686,7 @@ var CLAIM_837I_LOOP_2400 = defineLoopSpec({
|
|
|
4686
4686
|
});
|
|
4687
4687
|
var CLAIM_837D_LOOP_2400 = defineLoopSpec({
|
|
4688
4688
|
id: "2400",
|
|
4689
|
-
description: "837D Loop 2400
|
|
4689
|
+
description: "837D Loop 2400 - Service Line (dental)",
|
|
4690
4690
|
trigger: "LX",
|
|
4691
4691
|
segments: [
|
|
4692
4692
|
{ id: "LX", usage: "required", max: 1 },
|
|
@@ -4702,7 +4702,7 @@ var CLAIM_837D_LOOP_2400 = defineLoopSpec({
|
|
|
4702
4702
|
function makeLoop2300(loop2400, variantLabel) {
|
|
4703
4703
|
return defineLoopSpec({
|
|
4704
4704
|
id: "2300",
|
|
4705
|
-
description: `837${variantLabel} Loop 2300
|
|
4705
|
+
description: `837${variantLabel} Loop 2300 - Claim Information`,
|
|
4706
4706
|
trigger: "CLM",
|
|
4707
4707
|
segments: [
|
|
4708
4708
|
{ id: "CLM", usage: "required", max: 1 },
|
|
@@ -4724,7 +4724,7 @@ var CLAIM_837D_LOOP_2300 = makeLoop2300(CLAIM_837D_LOOP_2400, "D");
|
|
|
4724
4724
|
function makeLoop2000C(loop2300, variantLabel) {
|
|
4725
4725
|
return defineLoopSpec({
|
|
4726
4726
|
id: "2000C",
|
|
4727
|
-
description: `837${variantLabel} Loop 2000C
|
|
4727
|
+
description: `837${variantLabel} Loop 2000C - Patient Hierarchical Level`,
|
|
4728
4728
|
trigger: "HL",
|
|
4729
4729
|
segments: [
|
|
4730
4730
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -4736,7 +4736,7 @@ function makeLoop2000C(loop2300, variantLabel) {
|
|
|
4736
4736
|
function makeLoop2000B(loop2300, loop2000C, variantLabel) {
|
|
4737
4737
|
return defineLoopSpec({
|
|
4738
4738
|
id: "2000B",
|
|
4739
|
-
description: `837${variantLabel} Loop 2000B
|
|
4739
|
+
description: `837${variantLabel} Loop 2000B - Subscriber Hierarchical Level`,
|
|
4740
4740
|
trigger: "HL",
|
|
4741
4741
|
segments: [
|
|
4742
4742
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -4749,7 +4749,7 @@ function makeLoop2000B(loop2300, loop2000C, variantLabel) {
|
|
|
4749
4749
|
function makeLoop2000A(loop2000B, variantLabel) {
|
|
4750
4750
|
return defineLoopSpec({
|
|
4751
4751
|
id: "2000A",
|
|
4752
|
-
description: `837${variantLabel} Loop 2000A
|
|
4752
|
+
description: `837${variantLabel} Loop 2000A - Billing Provider Hierarchical Level`,
|
|
4753
4753
|
trigger: "HL",
|
|
4754
4754
|
segments: [
|
|
4755
4755
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -4770,7 +4770,7 @@ var CLAIM_837I_LOOP_2000A = makeLoop2000A(INSTITUTIONAL_2000B, "I");
|
|
|
4770
4770
|
var CLAIM_837D_LOOP_2000A = makeLoop2000A(DENTAL_2000B, "D");
|
|
4771
4771
|
var CLAIM_837_LOOP_1000A = defineLoopSpec({
|
|
4772
4772
|
id: "1000A",
|
|
4773
|
-
description: "837 Loop 1000A
|
|
4773
|
+
description: "837 Loop 1000A - Submitter Name",
|
|
4774
4774
|
trigger: "NM1",
|
|
4775
4775
|
segments: [
|
|
4776
4776
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -4779,7 +4779,7 @@ var CLAIM_837_LOOP_1000A = defineLoopSpec({
|
|
|
4779
4779
|
});
|
|
4780
4780
|
var CLAIM_837_LOOP_1000B = defineLoopSpec({
|
|
4781
4781
|
id: "1000B",
|
|
4782
|
-
description: "837 Loop 1000B
|
|
4782
|
+
description: "837 Loop 1000B - Receiver Name",
|
|
4783
4783
|
trigger: "NM1",
|
|
4784
4784
|
segments: [{ id: "NM1", usage: "required", max: 1 }]
|
|
4785
4785
|
});
|
|
@@ -5461,7 +5461,7 @@ function expandYY3(yymmdd) {
|
|
|
5461
5461
|
// src/transactions/eligibility/loop-spec.ts
|
|
5462
5462
|
var ELIGIBILITY_271_LOOP_2110 = defineLoopSpec({
|
|
5463
5463
|
id: "2110",
|
|
5464
|
-
description: "271 Loop 2110C/D
|
|
5464
|
+
description: "271 Loop 2110C/D - Eligibility or Benefit Information",
|
|
5465
5465
|
trigger: "EB",
|
|
5466
5466
|
segments: [
|
|
5467
5467
|
{ id: "EB", usage: "required", max: 1 },
|
|
@@ -5475,7 +5475,7 @@ var ELIGIBILITY_271_LOOP_2110 = defineLoopSpec({
|
|
|
5475
5475
|
});
|
|
5476
5476
|
var ELIGIBILITY_271_LOOP_2100C = defineLoopSpec({
|
|
5477
5477
|
id: "2100C",
|
|
5478
|
-
description: "271 Loop 2100C
|
|
5478
|
+
description: "271 Loop 2100C - Subscriber Name",
|
|
5479
5479
|
trigger: "NM1",
|
|
5480
5480
|
segments: [
|
|
5481
5481
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -5489,7 +5489,7 @@ var ELIGIBILITY_271_LOOP_2100C = defineLoopSpec({
|
|
|
5489
5489
|
});
|
|
5490
5490
|
var ELIGIBILITY_271_LOOP_2100D = defineLoopSpec({
|
|
5491
5491
|
id: "2100D",
|
|
5492
|
-
description: "271 Loop 2100D
|
|
5492
|
+
description: "271 Loop 2100D - Dependent Name",
|
|
5493
5493
|
trigger: "NM1",
|
|
5494
5494
|
segments: [
|
|
5495
5495
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -5503,7 +5503,7 @@ var ELIGIBILITY_271_LOOP_2100D = defineLoopSpec({
|
|
|
5503
5503
|
});
|
|
5504
5504
|
var ELIGIBILITY_271_LOOP_2000A = defineLoopSpec({
|
|
5505
5505
|
id: "2000A",
|
|
5506
|
-
description: "271 Loop 2000A
|
|
5506
|
+
description: "271 Loop 2000A - Information Source HL",
|
|
5507
5507
|
trigger: "HL",
|
|
5508
5508
|
segments: [
|
|
5509
5509
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -5514,7 +5514,7 @@ var ELIGIBILITY_271_LOOP_2000A = defineLoopSpec({
|
|
|
5514
5514
|
});
|
|
5515
5515
|
var ELIGIBILITY_271_LOOP_2000B = defineLoopSpec({
|
|
5516
5516
|
id: "2000B",
|
|
5517
|
-
description: "271 Loop 2000B
|
|
5517
|
+
description: "271 Loop 2000B - Information Receiver HL",
|
|
5518
5518
|
trigger: "HL",
|
|
5519
5519
|
segments: [
|
|
5520
5520
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -5528,7 +5528,7 @@ var ELIGIBILITY_271_LOOP_2000B = defineLoopSpec({
|
|
|
5528
5528
|
});
|
|
5529
5529
|
var ELIGIBILITY_271_LOOP_2000C = defineLoopSpec({
|
|
5530
5530
|
id: "2000C",
|
|
5531
|
-
description: "271 Loop 2000C
|
|
5531
|
+
description: "271 Loop 2000C - Subscriber HL",
|
|
5532
5532
|
trigger: "HL",
|
|
5533
5533
|
segments: [
|
|
5534
5534
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -5538,7 +5538,7 @@ var ELIGIBILITY_271_LOOP_2000C = defineLoopSpec({
|
|
|
5538
5538
|
});
|
|
5539
5539
|
var ELIGIBILITY_271_LOOP_2000D = defineLoopSpec({
|
|
5540
5540
|
id: "2000D",
|
|
5541
|
-
description: "271 Loop 2000D
|
|
5541
|
+
description: "271 Loop 2000D - Dependent HL",
|
|
5542
5542
|
trigger: "HL",
|
|
5543
5543
|
segments: [
|
|
5544
5544
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6235,7 +6235,7 @@ function expandYY4(yymmdd) {
|
|
|
6235
6235
|
// src/transactions/status/loop-spec.ts
|
|
6236
6236
|
var STATUS_277_LOOP_2220 = defineLoopSpec({
|
|
6237
6237
|
id: "2220",
|
|
6238
|
-
description: "277 Loop 2220
|
|
6238
|
+
description: "277 Loop 2220 - Service Line Status Information",
|
|
6239
6239
|
trigger: "SVC",
|
|
6240
6240
|
segments: [
|
|
6241
6241
|
{ id: "SVC", usage: "required", max: 1 },
|
|
@@ -6246,7 +6246,7 @@ var STATUS_277_LOOP_2220 = defineLoopSpec({
|
|
|
6246
6246
|
});
|
|
6247
6247
|
var STATUS_277_LOOP_2200 = defineLoopSpec({
|
|
6248
6248
|
id: "2200",
|
|
6249
|
-
description: "277 Loop 2200
|
|
6249
|
+
description: "277 Loop 2200 - Claim Status Tracking",
|
|
6250
6250
|
trigger: "TRN",
|
|
6251
6251
|
segments: [
|
|
6252
6252
|
{ id: "TRN", usage: "situational", max: 1 },
|
|
@@ -6258,7 +6258,7 @@ var STATUS_277_LOOP_2200 = defineLoopSpec({
|
|
|
6258
6258
|
});
|
|
6259
6259
|
var STATUS_277_LOOP_2000A = defineLoopSpec({
|
|
6260
6260
|
id: "2000A",
|
|
6261
|
-
description: "277 Loop 2000A
|
|
6261
|
+
description: "277 Loop 2000A - Information Source HL",
|
|
6262
6262
|
trigger: "HL",
|
|
6263
6263
|
segments: [
|
|
6264
6264
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6268,7 +6268,7 @@ var STATUS_277_LOOP_2000A = defineLoopSpec({
|
|
|
6268
6268
|
});
|
|
6269
6269
|
var STATUS_277_LOOP_2000B = defineLoopSpec({
|
|
6270
6270
|
id: "2000B",
|
|
6271
|
-
description: "277 Loop 2000B
|
|
6271
|
+
description: "277 Loop 2000B - Information Receiver HL",
|
|
6272
6272
|
trigger: "HL",
|
|
6273
6273
|
segments: [
|
|
6274
6274
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6277,7 +6277,7 @@ var STATUS_277_LOOP_2000B = defineLoopSpec({
|
|
|
6277
6277
|
});
|
|
6278
6278
|
var STATUS_277_LOOP_2000C = defineLoopSpec({
|
|
6279
6279
|
id: "2000C",
|
|
6280
|
-
description: "277 Loop 2000C
|
|
6280
|
+
description: "277 Loop 2000C - Service Provider HL",
|
|
6281
6281
|
trigger: "HL",
|
|
6282
6282
|
segments: [
|
|
6283
6283
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6287,7 +6287,7 @@ var STATUS_277_LOOP_2000C = defineLoopSpec({
|
|
|
6287
6287
|
});
|
|
6288
6288
|
var STATUS_277_LOOP_2000D = defineLoopSpec({
|
|
6289
6289
|
id: "2000D",
|
|
6290
|
-
description: "277 Loop 2000D
|
|
6290
|
+
description: "277 Loop 2000D - Subscriber HL",
|
|
6291
6291
|
trigger: "HL",
|
|
6292
6292
|
segments: [
|
|
6293
6293
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6297,7 +6297,7 @@ var STATUS_277_LOOP_2000D = defineLoopSpec({
|
|
|
6297
6297
|
});
|
|
6298
6298
|
var STATUS_277_LOOP_2000E = defineLoopSpec({
|
|
6299
6299
|
id: "2000E",
|
|
6300
|
-
description: "277 Loop 2000E
|
|
6300
|
+
description: "277 Loop 2000E - Dependent HL",
|
|
6301
6301
|
trigger: "HL",
|
|
6302
6302
|
segments: [
|
|
6303
6303
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -6639,9 +6639,9 @@ function build820(spec) {
|
|
|
6639
6639
|
pad5(envelope.receiverId, 15),
|
|
6640
6640
|
// ISA-08
|
|
6641
6641
|
pad5(envelope.interchangeDate, 6),
|
|
6642
|
-
// ISA-09
|
|
6642
|
+
// ISA-09 - YYMMDD
|
|
6643
6643
|
pad5(envelope.interchangeTime, 4),
|
|
6644
|
-
// ISA-10
|
|
6644
|
+
// ISA-10 - HHMM
|
|
6645
6645
|
repetitionSeparator,
|
|
6646
6646
|
// ISA-11
|
|
6647
6647
|
"00501",
|
|
@@ -6662,15 +6662,15 @@ function build820(spec) {
|
|
|
6662
6662
|
const gs = seg([
|
|
6663
6663
|
"GS",
|
|
6664
6664
|
X12_820_FUNCTIONAL_ID,
|
|
6665
|
-
// GS-01
|
|
6665
|
+
// GS-01 - "RA"
|
|
6666
6666
|
esc(applicationSenderCode),
|
|
6667
6667
|
// GS-02
|
|
6668
6668
|
esc(applicationReceiverCode),
|
|
6669
6669
|
// GS-03
|
|
6670
6670
|
groupDate,
|
|
6671
|
-
// GS-04
|
|
6671
|
+
// GS-04 - CCYYMMDD
|
|
6672
6672
|
groupTime,
|
|
6673
|
-
// GS-05
|
|
6673
|
+
// GS-05 - HHMM
|
|
6674
6674
|
esc(envelope.groupControlNumber),
|
|
6675
6675
|
// GS-06
|
|
6676
6676
|
X12_AGENCY_CODE5,
|
|
@@ -6844,7 +6844,7 @@ function emitPerson2(person, seg, esc) {
|
|
|
6844
6844
|
"NM1",
|
|
6845
6845
|
esc(person.entityIdentifierCode),
|
|
6846
6846
|
"1",
|
|
6847
|
-
// NM1-02 entity type qualifier
|
|
6847
|
+
// NM1-02 entity type qualifier - not read by get820Payments
|
|
6848
6848
|
esc(person.lastName ?? ""),
|
|
6849
6849
|
esc(person.firstName ?? ""),
|
|
6850
6850
|
esc(person.middleName ?? ""),
|
|
@@ -6892,13 +6892,13 @@ function expandYY5(yymmdd) {
|
|
|
6892
6892
|
// src/transactions/premium/loop-spec.ts
|
|
6893
6893
|
var PREMIUM_820_LOOP_2310A = defineLoopSpec({
|
|
6894
6894
|
id: "2310A",
|
|
6895
|
-
description: "820 Loop 2310A
|
|
6895
|
+
description: "820 Loop 2310A - Organization Summary Remittance Adjustment",
|
|
6896
6896
|
trigger: "ADX",
|
|
6897
6897
|
segments: [{ id: "ADX", usage: "situational", max: ">1" }]
|
|
6898
6898
|
});
|
|
6899
6899
|
var PREMIUM_820_LOOP_2300A = defineLoopSpec({
|
|
6900
6900
|
id: "2300A",
|
|
6901
|
-
description: "820 Loop 2300A
|
|
6901
|
+
description: "820 Loop 2300A - Organization Summary Remittance Detail",
|
|
6902
6902
|
trigger: "RMR",
|
|
6903
6903
|
segments: [
|
|
6904
6904
|
{ id: "RMR", usage: "situational", max: 1 },
|
|
@@ -6909,7 +6909,7 @@ var PREMIUM_820_LOOP_2300A = defineLoopSpec({
|
|
|
6909
6909
|
});
|
|
6910
6910
|
var PREMIUM_820_LOOP_2100A = defineLoopSpec({
|
|
6911
6911
|
id: "2100A",
|
|
6912
|
-
description: "820 Loop 2100A
|
|
6912
|
+
description: "820 Loop 2100A - Party Name",
|
|
6913
6913
|
trigger: "NM1",
|
|
6914
6914
|
segments: [
|
|
6915
6915
|
{ id: "NM1", usage: "situational", max: 1 },
|
|
@@ -6919,14 +6919,14 @@ var PREMIUM_820_LOOP_2100A = defineLoopSpec({
|
|
|
6919
6919
|
});
|
|
6920
6920
|
var PREMIUM_820_LOOP_2000A = defineLoopSpec({
|
|
6921
6921
|
id: "2000A",
|
|
6922
|
-
description: "820 Loop 2000A
|
|
6922
|
+
description: "820 Loop 2000A - Organization Summary Remittance",
|
|
6923
6923
|
trigger: "ENT",
|
|
6924
6924
|
segments: [{ id: "ENT", usage: "situational", max: 1 }],
|
|
6925
6925
|
children: [PREMIUM_820_LOOP_2100A, PREMIUM_820_LOOP_2300A]
|
|
6926
6926
|
});
|
|
6927
6927
|
var PREMIUM_820_LOOP_1000A = defineLoopSpec({
|
|
6928
6928
|
id: "1000A",
|
|
6929
|
-
description: "820 Loop 1000A
|
|
6929
|
+
description: "820 Loop 1000A - Premium Receiver's Name",
|
|
6930
6930
|
trigger: "N1",
|
|
6931
6931
|
segments: [
|
|
6932
6932
|
{ id: "N1", usage: "required", max: 1 },
|
|
@@ -6939,7 +6939,7 @@ var PREMIUM_820_LOOP_1000A = defineLoopSpec({
|
|
|
6939
6939
|
});
|
|
6940
6940
|
var PREMIUM_820_LOOP_1000B = defineLoopSpec({
|
|
6941
6941
|
id: "1000B",
|
|
6942
|
-
description: "820 Loop 1000B
|
|
6942
|
+
description: "820 Loop 1000B - Premium Payer's Name",
|
|
6943
6943
|
trigger: "N1",
|
|
6944
6944
|
segments: [
|
|
6945
6945
|
{ id: "N1", usage: "required", max: 1 },
|
|
@@ -7323,9 +7323,9 @@ function build834(spec) {
|
|
|
7323
7323
|
pad6(envelope.receiverId, 15),
|
|
7324
7324
|
// ISA-08
|
|
7325
7325
|
pad6(envelope.interchangeDate, 6),
|
|
7326
|
-
// ISA-09
|
|
7326
|
+
// ISA-09 - YYMMDD
|
|
7327
7327
|
pad6(envelope.interchangeTime, 4),
|
|
7328
|
-
// ISA-10
|
|
7328
|
+
// ISA-10 - HHMM
|
|
7329
7329
|
repetitionSeparator,
|
|
7330
7330
|
// ISA-11
|
|
7331
7331
|
"00501",
|
|
@@ -7346,15 +7346,15 @@ function build834(spec) {
|
|
|
7346
7346
|
const gs = seg([
|
|
7347
7347
|
"GS",
|
|
7348
7348
|
X12_834_FUNCTIONAL_ID,
|
|
7349
|
-
// GS-01
|
|
7349
|
+
// GS-01 - "BE"
|
|
7350
7350
|
esc(applicationSenderCode),
|
|
7351
7351
|
// GS-02
|
|
7352
7352
|
esc(applicationReceiverCode),
|
|
7353
7353
|
// GS-03
|
|
7354
7354
|
groupDate,
|
|
7355
|
-
// GS-04
|
|
7355
|
+
// GS-04 - CCYYMMDD
|
|
7356
7356
|
groupTime,
|
|
7357
|
-
// GS-05
|
|
7357
|
+
// GS-05 - HHMM
|
|
7358
7358
|
esc(envelope.groupControlNumber),
|
|
7359
7359
|
// GS-06
|
|
7360
7360
|
X12_AGENCY_CODE6,
|
|
@@ -7448,7 +7448,7 @@ function emitMember3(member, body, seg, esc) {
|
|
|
7448
7448
|
esc(member.subscriberIndicator ?? ""),
|
|
7449
7449
|
esc(member.relationshipCode ?? ""),
|
|
7450
7450
|
esc(member.maintenanceTypeCode),
|
|
7451
|
-
// INS-03
|
|
7451
|
+
// INS-03 - emitted verbatim
|
|
7452
7452
|
esc(member.maintenanceReasonCode ?? ""),
|
|
7453
7453
|
esc(member.benefitStatusCode ?? ""),
|
|
7454
7454
|
"",
|
|
@@ -7480,7 +7480,7 @@ function emitMemberName(name, body, seg, esc) {
|
|
|
7480
7480
|
"NM1",
|
|
7481
7481
|
esc(name.entityIdentifierCode ?? MEMBER_DEFAULT_ENTITY_ID),
|
|
7482
7482
|
"1",
|
|
7483
|
-
// NM1-02 entity type qualifier
|
|
7483
|
+
// NM1-02 entity type qualifier - person
|
|
7484
7484
|
esc(name.lastName ?? ""),
|
|
7485
7485
|
esc(name.firstName ?? ""),
|
|
7486
7486
|
esc(name.middleName ?? ""),
|
|
@@ -7518,7 +7518,7 @@ function emitCoverage(coverage, body, seg, esc) {
|
|
|
7518
7518
|
seg([
|
|
7519
7519
|
"HD",
|
|
7520
7520
|
esc(coverage.maintenanceTypeCode ?? ""),
|
|
7521
|
-
// HD-01
|
|
7521
|
+
// HD-01 - emitted verbatim
|
|
7522
7522
|
"",
|
|
7523
7523
|
// HD-02 maintenance reason code
|
|
7524
7524
|
esc(coverage.insuranceLineCode ?? ""),
|
|
@@ -7566,13 +7566,13 @@ function expandYY6(yymmdd) {
|
|
|
7566
7566
|
// src/transactions/enrollment/loop-spec.ts
|
|
7567
7567
|
var ENROLLMENT_834_LOOP_2320 = defineLoopSpec({
|
|
7568
7568
|
id: "2320",
|
|
7569
|
-
description: "834 Loop 2320
|
|
7569
|
+
description: "834 Loop 2320 - Coordination of Benefits",
|
|
7570
7570
|
trigger: "COB",
|
|
7571
7571
|
segments: [{ id: "COB", usage: "situational", max: 1 }]
|
|
7572
7572
|
});
|
|
7573
7573
|
var ENROLLMENT_834_LOOP_2300 = defineLoopSpec({
|
|
7574
7574
|
id: "2300",
|
|
7575
|
-
description: "834 Loop 2300
|
|
7575
|
+
description: "834 Loop 2300 - Health Coverage",
|
|
7576
7576
|
trigger: "HD",
|
|
7577
7577
|
segments: [
|
|
7578
7578
|
{ id: "HD", usage: "situational", max: 1 },
|
|
@@ -7583,7 +7583,7 @@ var ENROLLMENT_834_LOOP_2300 = defineLoopSpec({
|
|
|
7583
7583
|
});
|
|
7584
7584
|
var ENROLLMENT_834_LOOP_2100A = defineLoopSpec({
|
|
7585
7585
|
id: "2100A",
|
|
7586
|
-
description: "834 Loop 2100A
|
|
7586
|
+
description: "834 Loop 2100A - Member Name",
|
|
7587
7587
|
trigger: "NM1",
|
|
7588
7588
|
segments: [
|
|
7589
7589
|
{ id: "NM1", usage: "required", max: 1 },
|
|
@@ -7594,7 +7594,7 @@ var ENROLLMENT_834_LOOP_2100A = defineLoopSpec({
|
|
|
7594
7594
|
});
|
|
7595
7595
|
var ENROLLMENT_834_LOOP_2000 = defineLoopSpec({
|
|
7596
7596
|
id: "2000",
|
|
7597
|
-
description: "834 Loop 2000
|
|
7597
|
+
description: "834 Loop 2000 - Member Level Detail",
|
|
7598
7598
|
trigger: "INS",
|
|
7599
7599
|
segments: [
|
|
7600
7600
|
{ id: "INS", usage: "required", max: 1 },
|
|
@@ -7605,13 +7605,13 @@ var ENROLLMENT_834_LOOP_2000 = defineLoopSpec({
|
|
|
7605
7605
|
});
|
|
7606
7606
|
var ENROLLMENT_834_LOOP_1000A = defineLoopSpec({
|
|
7607
7607
|
id: "1000A",
|
|
7608
|
-
description: "834 Loop 1000A
|
|
7608
|
+
description: "834 Loop 1000A - Sponsor Name",
|
|
7609
7609
|
trigger: "N1",
|
|
7610
7610
|
segments: [{ id: "N1", usage: "required", max: 1 }]
|
|
7611
7611
|
});
|
|
7612
7612
|
var ENROLLMENT_834_LOOP_1000B = defineLoopSpec({
|
|
7613
7613
|
id: "1000B",
|
|
7614
|
-
description: "834 Loop 1000B
|
|
7614
|
+
description: "834 Loop 1000B - Payer",
|
|
7615
7615
|
trigger: "N1",
|
|
7616
7616
|
segments: [{ id: "N1", usage: "required", max: 1 }]
|
|
7617
7617
|
});
|
|
@@ -8222,7 +8222,7 @@ function expandYY7(yymmdd) {
|
|
|
8222
8222
|
// src/transactions/auth/loop-spec.ts
|
|
8223
8223
|
var AUTH_278_LOOP_2000F = defineLoopSpec({
|
|
8224
8224
|
id: "2000F",
|
|
8225
|
-
description: "278 Loop 2000F
|
|
8225
|
+
description: "278 Loop 2000F - Service HL",
|
|
8226
8226
|
trigger: "HL",
|
|
8227
8227
|
segments: [
|
|
8228
8228
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8238,7 +8238,7 @@ var AUTH_278_LOOP_2000F = defineLoopSpec({
|
|
|
8238
8238
|
});
|
|
8239
8239
|
var AUTH_278_LOOP_2000E = defineLoopSpec({
|
|
8240
8240
|
id: "2000E",
|
|
8241
|
-
description: "278 Loop 2000E
|
|
8241
|
+
description: "278 Loop 2000E - Patient Event HL",
|
|
8242
8242
|
trigger: "HL",
|
|
8243
8243
|
segments: [
|
|
8244
8244
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8255,7 +8255,7 @@ var AUTH_278_LOOP_2000E = defineLoopSpec({
|
|
|
8255
8255
|
});
|
|
8256
8256
|
var AUTH_278_LOOP_2000D = defineLoopSpec({
|
|
8257
8257
|
id: "2000D",
|
|
8258
|
-
description: "278 Loop 2000D
|
|
8258
|
+
description: "278 Loop 2000D - Dependent HL",
|
|
8259
8259
|
trigger: "HL",
|
|
8260
8260
|
segments: [
|
|
8261
8261
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8266,7 +8266,7 @@ var AUTH_278_LOOP_2000D = defineLoopSpec({
|
|
|
8266
8266
|
});
|
|
8267
8267
|
var AUTH_278_LOOP_2000C = defineLoopSpec({
|
|
8268
8268
|
id: "2000C",
|
|
8269
|
-
description: "278 Loop 2000C
|
|
8269
|
+
description: "278 Loop 2000C - Subscriber HL",
|
|
8270
8270
|
trigger: "HL",
|
|
8271
8271
|
segments: [
|
|
8272
8272
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8277,7 +8277,7 @@ var AUTH_278_LOOP_2000C = defineLoopSpec({
|
|
|
8277
8277
|
});
|
|
8278
8278
|
var AUTH_278_LOOP_2000B = defineLoopSpec({
|
|
8279
8279
|
id: "2000B",
|
|
8280
|
-
description: "278 Loop 2000B
|
|
8280
|
+
description: "278 Loop 2000B - Requester HL",
|
|
8281
8281
|
trigger: "HL",
|
|
8282
8282
|
segments: [
|
|
8283
8283
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8290,7 +8290,7 @@ var AUTH_278_LOOP_2000B = defineLoopSpec({
|
|
|
8290
8290
|
});
|
|
8291
8291
|
var AUTH_278_LOOP_2000A = defineLoopSpec({
|
|
8292
8292
|
id: "2000A",
|
|
8293
|
-
description: "278 Loop 2000A
|
|
8293
|
+
description: "278 Loop 2000A - Utilization Management Organization HL",
|
|
8294
8294
|
trigger: "HL",
|
|
8295
8295
|
segments: [
|
|
8296
8296
|
{ id: "HL", usage: "required", max: 1 },
|
|
@@ -8705,13 +8705,13 @@ function build999(spec) {
|
|
|
8705
8705
|
const isa = [
|
|
8706
8706
|
"ISA",
|
|
8707
8707
|
"00",
|
|
8708
|
-
// ISA-01
|
|
8708
|
+
// ISA-01 - Authorization Info Qualifier
|
|
8709
8709
|
pad8(" ", 10),
|
|
8710
|
-
// ISA-02
|
|
8710
|
+
// ISA-02 - Authorization Info (blank when ISA-01 == "00")
|
|
8711
8711
|
"00",
|
|
8712
|
-
// ISA-03
|
|
8712
|
+
// ISA-03 - Security Info Qualifier
|
|
8713
8713
|
pad8(" ", 10),
|
|
8714
|
-
// ISA-04
|
|
8714
|
+
// ISA-04 - Security Info (blank when ISA-03 == "00")
|
|
8715
8715
|
pad8(senderQualifier, 2),
|
|
8716
8716
|
// ISA-05
|
|
8717
8717
|
pad8(envelope.senderId, 15),
|
|
@@ -8721,21 +8721,21 @@ function build999(spec) {
|
|
|
8721
8721
|
pad8(envelope.receiverId, 15),
|
|
8722
8722
|
// ISA-08
|
|
8723
8723
|
pad8(envelope.interchangeDate, 6),
|
|
8724
|
-
// ISA-09
|
|
8724
|
+
// ISA-09 - YYMMDD
|
|
8725
8725
|
pad8(envelope.interchangeTime, 4),
|
|
8726
|
-
// ISA-10
|
|
8726
|
+
// ISA-10 - HHMM
|
|
8727
8727
|
repetitionSeparator,
|
|
8728
|
-
// ISA-11
|
|
8728
|
+
// ISA-11 - repetition separator
|
|
8729
8729
|
"00501",
|
|
8730
|
-
// ISA-12
|
|
8730
|
+
// ISA-12 - interchange version
|
|
8731
8731
|
interchangeControlNumber,
|
|
8732
8732
|
// ISA-13
|
|
8733
8733
|
"0",
|
|
8734
|
-
// ISA-14
|
|
8734
|
+
// ISA-14 - ack requested (0 = no inbound TA1)
|
|
8735
8735
|
usageIndicator,
|
|
8736
8736
|
// ISA-15
|
|
8737
8737
|
componentSeparator
|
|
8738
|
-
// ISA-16
|
|
8738
|
+
// ISA-16 - component separator
|
|
8739
8739
|
].join(elementSeparator) + segmentTerminator;
|
|
8740
8740
|
const groupDate = envelope.groupDate ?? expandYY8(envelope.interchangeDate);
|
|
8741
8741
|
const groupTime = envelope.groupTime ?? envelope.interchangeTime;
|
|
@@ -8744,21 +8744,21 @@ function build999(spec) {
|
|
|
8744
8744
|
[
|
|
8745
8745
|
"GS",
|
|
8746
8746
|
"FA",
|
|
8747
|
-
// GS-01
|
|
8747
|
+
// GS-01 - functional ID code "FA" for ack
|
|
8748
8748
|
esc(envelope.senderId),
|
|
8749
8749
|
// GS-02
|
|
8750
8750
|
esc(envelope.receiverId),
|
|
8751
8751
|
// GS-03
|
|
8752
8752
|
groupDate,
|
|
8753
|
-
// GS-04
|
|
8753
|
+
// GS-04 - CCYYMMDD
|
|
8754
8754
|
groupTime,
|
|
8755
|
-
// GS-05
|
|
8755
|
+
// GS-05 - HHMM
|
|
8756
8756
|
envelope.groupControlNumber,
|
|
8757
8757
|
// GS-06
|
|
8758
8758
|
groupResponsibleAgency,
|
|
8759
8759
|
// GS-07
|
|
8760
8760
|
X231A1_VERSION_RELEASE
|
|
8761
|
-
// GS-08
|
|
8761
|
+
// GS-08 - the 999 TR3
|
|
8762
8762
|
],
|
|
8763
8763
|
elementSeparator,
|
|
8764
8764
|
segmentTerminator
|
|
@@ -9199,9 +9199,9 @@ function buildInterchange(spec) {
|
|
|
9199
9199
|
pad9(spec.receiverId, 15),
|
|
9200
9200
|
// ISA-08
|
|
9201
9201
|
pad9(spec.interchangeDate, 6),
|
|
9202
|
-
// ISA-09
|
|
9202
|
+
// ISA-09 - YYMMDD
|
|
9203
9203
|
pad9(spec.interchangeTime, 4),
|
|
9204
|
-
// ISA-10
|
|
9204
|
+
// ISA-10 - HHMM
|
|
9205
9205
|
repetitionSeparator,
|
|
9206
9206
|
// ISA-11
|
|
9207
9207
|
pad9(version, 5),
|
|
@@ -9209,7 +9209,7 @@ function buildInterchange(spec) {
|
|
|
9209
9209
|
interchangeControlNumber,
|
|
9210
9210
|
// ISA-13
|
|
9211
9211
|
"0",
|
|
9212
|
-
// ISA-14
|
|
9212
|
+
// ISA-14 - ack requested (0 = no inbound TA1)
|
|
9213
9213
|
usageIndicator,
|
|
9214
9214
|
// ISA-15
|
|
9215
9215
|
componentSeparator
|
|
@@ -9402,7 +9402,7 @@ function validateQuirks(quirks, profileName) {
|
|
|
9402
9402
|
seenIds.add(q.id);
|
|
9403
9403
|
if (typeof q.effect !== "string" || !KNOWN_EFFECTS.includes(q.effect)) {
|
|
9404
9404
|
throw new X12ProfileError(
|
|
9405
|
-
`Profile '${profileName}' quirk '${q.id}' has invalid effect ${JSON.stringify(q.effect)}
|
|
9405
|
+
`Profile '${profileName}' quirk '${q.id}' has invalid effect ${JSON.stringify(q.effect)} - must be one of ${KNOWN_EFFECTS.join(" / ")}.`,
|
|
9406
9406
|
profileName
|
|
9407
9407
|
);
|
|
9408
9408
|
}
|
|
@@ -9414,7 +9414,7 @@ function validateQuirks(quirks, profileName) {
|
|
|
9414
9414
|
}
|
|
9415
9415
|
if (typeof q.fixture !== "string" || !FIXTURE_PATH_RE.test(q.fixture)) {
|
|
9416
9416
|
throw new X12ProfileError(
|
|
9417
|
-
`Profile '${profileName}' quirk '${q.id}' must cite a 'fixture'
|
|
9417
|
+
`Profile '${profileName}' quirk '${q.id}' must cite a 'fixture' - a relative path under test/fixtures/ (e.g. "remit/835-availity-quirk.edi") demonstrating the deviation. No invented quirks. Received: ${JSON.stringify(q.fixture)}.`,
|
|
9418
9418
|
profileName
|
|
9419
9419
|
);
|
|
9420
9420
|
}
|
|
@@ -9428,7 +9428,7 @@ function validateQuirks(quirks, profileName) {
|
|
|
9428
9428
|
for (const code of q.expectedWarnings) {
|
|
9429
9429
|
if (!WARNING_CODE_SET.has(code)) {
|
|
9430
9430
|
throw new X12ProfileError(
|
|
9431
|
-
`Profile '${profileName}' quirk '${q.id}' lists unknown expected warning ${JSON.stringify(code)}
|
|
9431
|
+
`Profile '${profileName}' quirk '${q.id}' lists unknown expected warning ${JSON.stringify(code)} - must be a member of WARNING_CODES.`,
|
|
9432
9432
|
profileName
|
|
9433
9433
|
);
|
|
9434
9434
|
}
|
|
@@ -9549,21 +9549,21 @@ function partitionWarnings(warnings, profile) {
|
|
|
9549
9549
|
// src/profiles/availity.ts
|
|
9550
9550
|
var availity = defineProfile({
|
|
9551
9551
|
name: "availity",
|
|
9552
|
-
description: "Availity clearinghouse 835 ERA conventions
|
|
9552
|
+
description: "Availity clearinghouse 835 ERA conventions - payer-routed REF segment additions",
|
|
9553
9553
|
quirks: [
|
|
9554
9554
|
{
|
|
9555
9555
|
id: "payer-loop-ref-2u",
|
|
9556
9556
|
effect: "adds",
|
|
9557
9557
|
summary: "Payer Loop 1000A carries an additional REF*2U payer-identification segment alongside the N1*PR.",
|
|
9558
9558
|
fixture: "remit/835-availity-quirk.edi",
|
|
9559
|
-
sourceCategory: "Availity 835 ERA companion guide
|
|
9559
|
+
sourceCategory: "Availity 835 ERA companion guide - payer-loop REF*2U routing identifier"
|
|
9560
9560
|
},
|
|
9561
9561
|
{
|
|
9562
9562
|
id: "service-line-ref-f8",
|
|
9563
9563
|
effect: "adds",
|
|
9564
9564
|
summary: "Service line (Loop 2110) carries a REF*F8 original-reference identifier for clearinghouse trace-back.",
|
|
9565
9565
|
fixture: "remit/835-availity-quirk.edi",
|
|
9566
|
-
sourceCategory: "Availity 835 ERA companion guide
|
|
9566
|
+
sourceCategory: "Availity 835 ERA companion guide - service-line REF*F8 original reference"
|
|
9567
9567
|
}
|
|
9568
9568
|
]
|
|
9569
9569
|
});
|
|
@@ -9571,14 +9571,14 @@ var availity = defineProfile({
|
|
|
9571
9571
|
// src/profiles/bcbsCommon.ts
|
|
9572
9572
|
var bcbsCommon = defineProfile({
|
|
9573
9573
|
name: "bcbsCommon",
|
|
9574
|
-
description: "Lowest-common-denominator BCBS envelope quirks
|
|
9574
|
+
description: "Lowest-common-denominator BCBS envelope quirks - a documented starting point, not a complete plan-specific edit set",
|
|
9575
9575
|
quirks: [
|
|
9576
9576
|
{
|
|
9577
9577
|
id: "backslash-component-separator",
|
|
9578
9578
|
effect: "relaxes",
|
|
9579
9579
|
summary: "ISA-16 component (sub-element) separator is a backslash `\\`, not the commonly-assumed `:`.",
|
|
9580
9580
|
fixture: "envelope/bcbs-subelement.edi",
|
|
9581
|
-
sourceCategory: "BCBS plan companion guides
|
|
9581
|
+
sourceCategory: "BCBS plan companion guides - non-colon ISA-16 sub-element separator"
|
|
9582
9582
|
}
|
|
9583
9583
|
]
|
|
9584
9584
|
});
|
|
@@ -9590,7 +9590,7 @@ var profiles = Object.freeze({
|
|
|
9590
9590
|
});
|
|
9591
9591
|
|
|
9592
9592
|
// src/index.ts
|
|
9593
|
-
var VERSION = "0.0.
|
|
9593
|
+
var VERSION = "0.0.2";
|
|
9594
9594
|
|
|
9595
9595
|
exports.ACK_BUILD_ERROR_CODES = ACK_BUILD_ERROR_CODES;
|
|
9596
9596
|
exports.AUTH_278_BUILD_ERROR_CODES = AUTH_278_BUILD_ERROR_CODES;
|