% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/map.R
\name{map_rxcui_to_ndc}
\alias{map_rxcui_to_ndc}
\title{Map RxCUIs to NDCs}
\usage{
map_rxcui_to_ndc(
  x,
  status = NULL,
  history = c("active", "direct", "all"),
  show_progress = interactive()
)
}
\arguments{
\item{x}{Character vector of RxCUIs.}

\item{status}{Optional character vector of NDC statuses to retain, such as
\code{"ACTIVE"}, \code{"OBSOLETE"}, \code{"ALIEN"}, or \code{"UNKNOWN"}. If \code{NULL}, no
status-based filtering is applied to the retrieved NDCs. Note that
\code{history = "active"} uses RxNorm's active NDC endpoint, so returned NDCs
are expected to be active even when \code{status = NULL}.}

\item{history}{For \code{to = "ndc"} only, the NDC association history to
retrieve. One of \code{"active"}, \code{"direct"}, or \code{"all"}.
\itemize{
\item \code{"active"} retrieves currently active NDCs associated with the supplied
RxCUI.
\item \code{"direct"} retrieves NDCs ever directly associated with the supplied
RxCUI.
\item \code{"all"} retrieves NDCs ever directly or indirectly associated with the
supplied RxCUI, including associations through remapped or archived
concepts.
}

If \code{NULL} and \code{to = "ndc"}, defaults to \code{"active"}. Ignored when
\code{to = "rxcui"}.}

\item{show_progress}{Logical; if \code{TRUE}, show a progress bar for vectorized
mapping operations. Defaults to \code{interactive()}.}
}
\value{
A tibble with one row per RxCUI/NDC mapping.

For \code{history = "active"}, returns columns:
\describe{
\item{rxcui}{Input RxCUI.}
\item{ndc11}{Mapped NDC.}
\item{ndc_status}{NDC status returned by RxNorm, when available.}
}

For \code{history = "direct"} or \code{"all"}, the output may also include:
\describe{
\item{related_rxcui}{RxCUI associated with the historical NDC record. This
may differ from the input RxCUI when historical or indirect associations
are retrieved.}
\item{ndc_start_date}{Start date of the NDC association, when available.}
\item{ndc_end_date}{End date of the NDC association, when available.}
}
}
\description{
Convenience wrapper around \code{\link[=map_to]{map_to()}} for mapping RxNorm Concept Unique
Identifiers (RxCUIs) to National Drug Codes (NDCs).
}
\details{
By default, this function retrieves currently active NDCs associated with
the supplied RxCUIs. Use \code{history = "direct"} or \code{history = "all"} to
retrieve historical NDC associations.

\code{status = NULL} means that no status filter is applied after NDCs are
retrieved. It does not, by itself, request historical NDCs. To retrieve
historical NDCs, set \code{history = "direct"} or \code{history = "all"}.
}
\examples{
\dontrun{
# Current active NDCs
map_rxcui_to_ndc("1049630")

# NDCs ever directly associated with this RxCUI
map_rxcui_to_ndc("1049630", history = "direct")

# All historical NDCs, retaining obsolete NDCs only
map_rxcui_to_ndc(
  "1049630",
  history = "all",
  status = "OBSOLETE"
)
}

}
