% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/search.R
\name{search_drug}
\alias{search_drug}
\title{Search free-text drug name and return product CUIs and/or NDCs}
\usage{
search_drug(
  term,
  return = c("rxcui", "ndc", "both"),
  ndc_status = NULL,
  ttys = .rxref_default_ttys,
  route = NULL,
  show_progress = interactive(),
  ...
)
}
\arguments{
\item{term}{Character vector; free-text drug names.}

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

\item{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).}

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

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

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

\item{...}{Passed to \code{products_for_ingredients()} (e.g., include_combos = FALSE)}
}
\value{
If \code{return="rxcui"}: tibble of products.
If \code{"ndc"}: tibble of NDCs with \code{ingredient_rxcui}, \code{product_rxcui}, \code{ndc11}, \code{ndc_status}.
If \code{"both"}: list(products=…, ndcs=…).
}
\description{
High-level convenience: free text -> ingredient(s) (IN/PIN) -> verified product
CUIs, and optionally expand to NDCs with status filtering.
}
