E-prescribing network
Surescripts
The network pharmacists and prescribers use to exchange NCPDP-defined transactions such as NewRx, RxChange, RxRenewal and CancelRx. A library formats and reads the messages; a network delivers them.
NCPDP
@cosyte/ncpdp handles both NCPDP standards in one package: Telecom pharmacy claims and SCRIPT ePrescribing messages. Vendor quirks become positioned warnings, and money and quantities are handled as strings, so a float never touches a paid amount.
npm install @cosyte/ncpdpNeed it integrated? Talk to us.
The standard
@cosyte/ncpdp
The implementation guides for both standards are purchased products, so the usual route is a hand-rolled reader: an XML walk for SCRIPT and a split on control characters for Telecom. That works until real input arrives. This package is the other choice.
import { buildTelecomRequest, serializeTelecom, parseTelecom, claim } from "@cosyte/ncpdp/telecom";
// Emit a spec-clean Telecom B1 billing claim. Every value below is synthetic.
const wire = serializeTelecom(
buildTelecomRequest({
header: { transactionCode: "B1", binNumber: "999999", dateOfService: "20260115" },
segments: [
{ segmentId: "04", fields: [{ id: "C2", value: "SYNTHCARD09" }] },
{
segmentId: "07",
fields: [
{ id: "D2", value: "RX0000001" },
{ id: "E1", value: "03" },
{ id: "D7", value: "99999999999" },
{ id: "E7", value: "30000" },
{ id: "D5", value: "30" },
],
},
],
}),
);
// Read it back. A vendor quirk becomes a positioned warning here, never a throw.
const t = parseTelecom(wire);
const c = claim(t);
console.log(t.kind, t.header.transactionCode, t.warnings.length);
console.log(c?.cardholderId, c?.prescriptionReferenceNumber);
console.log(c?.product?.id, c?.product?.qualifier);
console.log(c?.quantityDispensed?.source, c?.quantityDispensed?.impliedDecimal);From the @cosyte/ncpdp README on GitHub, verbatim. Every value in it is synthetic.
Limits
Its README names the gaps rather than leaving them silent:
Alternatives
Each description comes from the project’s own documentation or listing, linked below.
E-prescribing network
The network pharmacists and prescribers use to exchange NCPDP-defined transactions such as NewRx, RxChange, RxRenewal and CancelRx. A library formats and reads the messages; a network delivers them.
Pharmacy claims switch
A claims switch that receives NCPDP transactions, sends them on to processors and returns the responses to the pharmacy.
EDI toolkit
A toolkit for translating EDI inside your own applications, covering ten EDI standards, NCPDP among them.
Works with
It is free and MIT-licensed. If it saves you a day, a star on GitHub helps other engineers find it.
Need it integrated? Talk to us, or see what our integration services cover.