Skip to main content
Version: v0.0.6

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 single mapped result (the first entry's optional loincLongName is kept);
  • disagreeing (two distinct LOINCs) → an ambiguous result 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

LivdCatalog

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" }