Function: defineLivdCatalog()
defineLivdCatalog(
entries):LivdCatalog
Build a LivdCatalog from LIVD entries a consumer supplies. Entries are
indexed by their vendorCode (verbatim). When several entries share a vendor
code:
- all agreeing on the same
loinc→ a singlemappedresult (the first entry's optionalloincLongNameis kept); - disagreeing (two distinct LOINCs) → an
ambiguousresult carrying every distinct candidate, and no choice between them.
The returned catalog is deeply frozen; nothing is mutated after construction.
Parameters
entries
readonly LivdEntry[]
The consumer's LIVD mapping rows.
Returns
An immutable catalog.
Example
import { defineLivdCatalog } from "@cosyte/astm";
const catalog = defineLivdCatalog([
{ vendorCode: "687", loinc: "1920-8", loincLongName: "AST" },
{ vendorCode: "690", loinc: "1742-6", loincLongName: "ALT" },
]);
catalog.lookup("687"); // { status: "mapped", loinc: "1920-8", loincLongName: "AST" }
catalog.lookup("999"); // { status: "unmapped" }