npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ncbijs/rxnorm

v0.1.1

Published

Typed client for the RxNorm REST API — drug name normalization, concept lookup, drug classes, and NDC codes

Readme

@ncbijs/rxnorm

Runtime: Browser + Node.js

Typed client for the RxNorm REST API. Normalize drug names, look up concept properties, find drug classes via RxClass, and map NDC codes with automatic rate limiting and retry logic.

Installation

pnpm install @ncbijs/rxnorm

Usage

import { RxNorm } from '@ncbijs/rxnorm';

const rxnorm = new RxNorm();

const rxcui = await rxnorm.rxcui('aspirin');
console.log(rxcui); // '1191'

const props = await rxnorm.properties('1191');
console.log(props.name); // 'aspirin'

const related = await rxnorm.relatedByType('1191', ['SBD', 'SCD']);
for (const concept of related) {
  console.log(`${concept.rxcui}: ${concept.name}`);
}

const classes = await rxnorm.classByDrugName('aspirin', 'ATC');
for (const drugClass of classes) {
  console.log(`${drugClass.classId}: ${drugClass.className}`);
}

const suggestions = await rxnorm.spelling('asprin');
console.log(suggestions); // ['aspirin', ...]

const ndcCodes = await rxnorm.ndcByRxcui('1191');
console.log(ndcCodes);

API

new RxNorm(config?)

| Option | Default | Description | | ------------ | ------- | ----------------------------------- | | maxRetries | 3 | Number of retries on 429/5xx errors |

RxNorm is a fully public API with no API key required. Rate limit: 2 requests/second.

Concept lookup

rxcui(name: string): Promise<RxConcept | undefined>

Get the RxNorm concept identifier (RXCUI) from a drug name. Returns undefined if not found.

properties(rxcui: string): Promise<RxConceptProperties>

Get full concept properties by RXCUI.

relatedByType(rxcui: string, types: ReadonlyArray<string>): Promise<ReadonlyArray<RxConcept>>

Get related concepts filtered by relationship type (e.g. 'SBD', 'SCD', 'IN').

Drug search

drugs(name: string): Promise<DrugGroup>

Get the drug group with all associated concepts for a drug name.

spelling(name: string): Promise<ReadonlyArray<string>>

Get spelling suggestions for a drug name.

Drug classes (RxClass)

classByDrugName(drugName: string, relaSource?: string): Promise<ReadonlyArray<RxClassDrugInfo>>

Find drug classes associated with a drug name. Filter by relationship source ('ATC', 'VA', 'MEDRT', 'FDASPL').

classByRxcui(rxcui: string, relaSource?: string): Promise<ReadonlyArray<RxClassDrugInfo>>

Find drug classes associated with an RxCUI. Filter by relationship source.

classMembers(classId: string, relaSource?: string): Promise<ReadonlyArray<RxClassMember>>

Fetch drug members of a drug class (e.g., all drugs in ATC class 'N02BA').

Fuzzy search

approximateTerm(name: string, options?: ApproximateTermOptions): Promise<ReadonlyArray<RxTermCandidate>>

Fuzzy drug name lookup returning ranked candidates with scores.

ApproximateTermOptions

| Option | Type | Description | | ------------ | -------- | ------------------------------------------------ | | maxEntries | number | Maximum number of candidates to return | | option | 0 \| 1 | Search option (0 = best, 1 = all approximations) |

History

history(rxcui: string): Promise<RxConceptHistory>

Get historical status of an RxCUI including remapping information.

Properties

allProperties(rxcui: string, properties: ReadonlyArray<string>): Promise<ReadonlyArray<RxProperty>>

Fetch all properties for an RxCUI filtered by property category (e.g., 'NAMES', 'SOURCES').

NDC mapping

ndcByRxcui(rxcui: string): Promise<ReadonlyArray<string>>

Get National Drug Code (NDC) identifiers mapped to an RXCUI.

Error handling

import { RxNorm, RxNormHttpError } from '@ncbijs/rxnorm';

try {
  await rxnorm.properties('invalid');
} catch (err) {
  if (err instanceof RxNormHttpError) {
    console.error(`HTTP ${err.status}: ${err.body}`);
  }
}

The client automatically retries on HTTP 429, 500, 502, 503 and network errors with exponential backoff + jitter. RxNorm is rate-limited to 2 requests/second.

Response types

RxConcept

interface RxConcept {
  rxcui: string;
  name: string;
  tty: string;
}

RxConceptProperties

interface RxConceptProperties {
  rxcui: string;
  name: string;
  synonym: string;
  tty: string;
  language: string;
  suppress: string;
}

DrugGroup

interface DrugGroup {
  name: string;
  conceptGroup: Array<ConceptGroup>;
}

ConceptGroup

interface ConceptGroup {
  tty: string;
  conceptProperties: Array<RxConcept>;
}

RxClassDrugInfo

interface RxClassDrugInfo {
  rxcui: string;
  drugName: string;
  tty: string;
  classId: string;
  className: string;
  classType: string;
  rela: string;
  relaSource: string;
}

RxClassMember

interface RxClassMember {
  rxcui: string;
  name: string;
  tty: string;
}

ApproximateTermOptions

interface ApproximateTermOptions {
  maxEntries?: number;
  option?: 0 | 1;
}

RxTermCandidate

interface RxTermCandidate {
  rxcui: string;
  name: string;
  score: number;
  rank: number;
}

RxConceptHistory

interface RxConceptHistory {
  rxcui: string;
  name: string;
  status: string;
  remappedTo: Array<string>;
}

RxProperty

interface RxProperty {
  category: string;
  name: string;
  value: string;
}