import type { InboundRequisition } from "../../../hooks/useInboundRequisitions.ts"; const LOINC = "http://loinc.org"; /** * The ordered test in this laboratory's own terms: our code for it, the coded test and the sender's account with us, * as an Akashic delivery carries them. Undefined when it carries none, as paper never does. */ export const testTermsOf = (requisition: InboundRequisition): string | undefined => { const coding = requisition.ourTestCoding; const parts = [ requisition.ourTestCode ? `Our code ${requisition.ourTestCode}` : undefined, coding?.code ? `${coding.system === LOINC ? "LOINC" : "Test code"} ${coding.code}` : undefined, requisition.accountNumber ? `Account ${requisition.accountNumber}` : undefined, ].filter(Boolean); return parts.length ? parts.join(" ยท ") : undefined; };