Skip to main content
Version: v0.0.2

Function: get278Request()

get278Request(delimiters, tx): X12ServicesReview | undefined

Extract a typed X12ServicesReview from a 278 request (005010X217). Pure function - no I/O. Returns undefined only when the transaction's ST-01 is not "278" (mis-routed call); every other deviation is recoverable and surfaces on result.warnings.

Parameters

delimiters

Delimiters

tx

X12TransactionSet

Returns

X12ServicesReview | undefined

Example

import { parseX12, get278Request } from "@cosyte/x12";
const ix = parseX12(raw);
const tx = ix.groups[0]?.transactions.find((t) => t.st.elements[1] === "278");
if (tx !== undefined) {
const req = get278Request(ix.delimiters, tx);
req?.reviews[0]?.requestCategoryCode; // "HS"
req?.reviews[0]?.diagnoses[0]?.code; // "E1165"
}