Skip to contents

High-level convenience: free text -> ingredient(s) (IN/PIN) -> verified product CUIs, and optionally expand to NDCs with status filtering.

Usage

search_drug(
  term,
  return = c("rxcui", "ndc", "both"),
  ndc_status = NULL,
  ttys = .rxref_default_ttys,
  route = NULL,
  show_progress = interactive(),
  ...
)

Arguments

term

Character vector; free-text drug names.

return

One of c("rxcui","ndc","both"). Note that "both" will return a list with both an rxcui tibble and an ndc tibble.

ndc_status

Optional character vector to filter NDCs. Options are "ACTIVE", "OBSOLETE", "UNSPECIFIED" (the API may also return no value, which will appear as NA).

ttys

Character vector of TTYs to include in product search. Defaults to .rxref_default_ttys. Other prespecified option is .rxref_extended_ttys or a character vector of explicit TTYs. Run tty_catalogue() to review options.

route

Optional character vector of routes to retain before returning products or mapping to NDCs. If NULL, no route filtering is performed. Common values include "ORAL", "INJECTION", "OPHTHALMIC", "INHALATION", and "TOPICAL".

show_progress

Logical. Show a progress bar in interactive sessions. Progress is shown only when at least 5 inputs are supplied.

...

Passed to products_for_ingredients() (e.g., include_combos = FALSE)

Value

If return="rxcui": tibble of products. If "ndc": tibble of NDCs with ingredient_rxcui, product_rxcui, ndc11, ndc_status. If "both": list(products=…, ndcs=…).