Skip to content

@ediocracy/parser/271/routes / functions

function

interpretRoute() ​

Call Signature ​

interpretRoute(entry): DetectedRoute

Defined in: packages/parser/src/profiles/271/routes/engine.ts:220

Picks the route from the response's 2100A payer ID and applies it. The payer ID is NM109 of the first 2100A that has an NM1.

Parameters ​

ParameterTypeDescription
entry{ group: FunctionalGroup; interchange: Interchange; response: Response271; }One item returned by read271s.
entry.groupFunctionalGroupThe functional group the response came from.
entry.interchangeInterchangeThe interchange the response came from.
entry.responseResponse271The response.

Returns ​

DetectedRoute

The route and its result, or route: undefined and the interpret271 result when no profile lists the payer ID.

Example ​

ts
import { readX12 } from '@ediocracy/parser';
import { read271s } from '@ediocracy/parser/271';
import { interpretRoute } from '@ediocracy/parser/271/routes';

for (const entry of read271s(readX12(text))) {
    const detected = interpretRoute(entry);

    if (detected.route === 'hets') {
        console.log(detected.result.members[0]?.partA.length);
    }
}

Call Signature ​

interpretRoute<View, FindingCode>(entry, profile): RouteEligibility<View, FindingCode>

Defined in: packages/parser/src/profiles/271/routes/engine.ts:242

Applies a route's rules to one 271: checks the separators, the information source and the receivers, adds the route's condition to each error, and builds the route's view of each member.

Type Parameters ​

Type Parameter
View
FindingCode extends string

Parameters ​

ParameterTypeDescription
entry{ group: FunctionalGroup; interchange: Interchange; response: Response271; }One item returned by read271s.
entry.groupFunctionalGroupThe functional group the response came from.
entry.interchangeInterchangeThe interchange the response came from.
entry.responseResponse271The response.
profileRouteProfile<View, FindingCode>The route's rules, such as hetsProfile.

Returns ​

RouteEligibility<View, FindingCode>

The interpret271 result, the errors with their conditions, the findings, and one view per member.

Example ​

ts
import { readX12 } from '@ediocracy/parser';
import { read271s } from '@ediocracy/parser/271';
import { hetsProfile, interpretRoute } from '@ediocracy/parser/271/routes';

for (const entry of read271s(readX12(text))) {
    const result = interpretRoute(entry, hetsProfile);
    console.log(result.findings.length, result.members[0]?.partA.length);
}