Skip to main content
Version: v0.0.2

Function: approximateMatch()

approximateMatch(graph, query, options?): readonly RxNormApproximateMatch[]

Opt-in, explicitly labeled approximate name matching - find loaded concepts whose names are token-similar to query. This is never the default resolution path and its results are never an exact code assertion: every candidate is marked approximate: true with a derived RxNormApproximateMatch.score. A caller opts in by calling this function explicitly.

Coverage is not correctness: a "no match" is an empty array (typed, honest), distinct from a fabricated nearest guess. The engine never promotes an approximate hit to an exact one.

Parameters

graph

RxNormGraph

A loaded RxNormGraph.

query

string

A free-text drug name to match against loaded concept names.

options?

ApproximateMatchOptions = {}

ApproximateMatchOptions (min score, limit).

Returns

readonly RxNormApproximateMatch[]

The labeled approximate candidates, best-first (possibly empty). Never an exact resolution.

Example

import { loadRxNormGraph, approximateMatch } from "@cosyte/terminology";

const g = loadRxNormGraph({
conso: "1|ENG||||||||||RXNORM|IN||lisinopril||N||",
rel: "",
});
approximateMatch(g, "lisinopril")[0]?.approximate; // => true