Skip to main content
Version: v0.0.3

Function: downgradePositiveAck()

downgradePositiveAck(code): AckCode

Downgrade a positive acknowledgment code to its matching error code, AAAE (original mode), CACE (enhanced mode). Every other code passes through unchanged.

This is the single upstream source of truth for the fail-safe downgrade pair: buildAck applies it when the inbound carries no MSH-10 correlation id, and @cosyte/mllp's ack-from-hl7 adapter applies it when the inbound cannot be parsed at all: neither ever fabricates an unverifiable positive acknowledgment, and neither carries its own copy of the mapping.

Parameters

code

AckCode

Returns

AckCode

Example

import { downgradePositiveAck } from "@cosyte/hl7";
downgradePositiveAck("AA"); // "AE"
downgradePositiveAck("CA"); // "CE"
downgradePositiveAck("AR"); // "AR" (unchanged)