Skip to main content
Version: v0.0.4

Function: ingredientsOf()

ingredientsOf(graph, rxcui): RxNormNavResult

The ingredients of a concept - the concepts it links to by a direct has_ingredient / has_precise_ingredient edge in the loaded release.

This follows the authored, direct edge only (never-fabricate, never a synthesized path), and RxNorm's ingredient topology is not the obvious one. Always read the TTY of what comes back:

  • concepts on the clinical side (SCDC, SCDF, SCDG) link to the ingredient itself, an IN;
  • concepts on the branded side (SBD, SBDC, SBDF, SBDG) link to their brand name, a BN. That is what the release says and what is echoed back, term type included. It is not the active ingredient. (has_precise_ingredient, which this function also follows, likewise reaches a PIN.)
  • a clinical drug (SCD) carries no has_ingredient edge at all. RxNorm authors none, in any release, so this honestly returns found-with-empty-targets rather than walking a path on the caller's behalf.
  • the precise forms (SCDFP, SBDFP, SCDGP) carry neither edge, so this returns found-with-empty-targets for them too. They do not behave like their non-precise siblings: an SCDFP reaches its basis-of-strength substance(s) by has_boss, a one-to-many relation with a different meaning whose targets can be a PIN or a plain IN, and which this function deliberately does not follow; an SBDFP and an SCDGP author no ingredient-bearing edge at all and are reached instead through form_of / tradename_of / isa.

Those pairings are the ones RxNorm authors, not a closed set a caller may rely on: check the returned TTY rather than assuming it from the one you queried.

To reach an active ingredient, walk to the CLINICAL component and take its edge. From an SCD that is SCD ⟶consists_of⟶ SCDC ⟶has_ingredient⟶ IN, i.e. consistsOf then ingredientsOf. From an SBD it needs one more decision, because consists_of returns both its branded component (SBDC, whose own ingredient edge is the BN again) and the clinical SCDC: it is the SCDC that leads to the IN. The engine never invents the transitive edge and never picks that branch for you.

Parameters

graph

RxNormGraph

A loaded RxNormGraph.

rxcui

string

The concept (a drug or a clinical/branded component).

Returns

RxNormNavResult

The directly-linked ingredient concepts (possibly empty), or a typed unknown source.

Example

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

// The ingredient edge is authored on the COMPONENT, not on the clinical drug.
const g = loadRxNormGraph({
conso: "1|ENG||||||||||RXNORM|IN||lisinopril||N||\n2|ENG||||||||||RXNORM|SCDC||lisinopril 10 MG||N||",
rel: "1|||RN|2|||has_ingredient|||RXNORM||||||",
});
ingredientsOf(g, "2").found; // => true