% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/route.R
\name{filter_products_by_route}
\alias{filter_products_by_route}
\title{Filter RxNorm product concepts by route of administration.}
\usage{
filter_products_by_route(
  products,
  route = "ORAL",
  keep_route_info = TRUE,
  include_historical = FALSE,
  show_progress = interactive()
)
}
\arguments{
\item{products}{A tibble containing a \code{product_rxcui} column, such as the
output of \code{\link[=products_for_ingredients]{products_for_ingredients()}}.}

\item{route}{Character vector of routes to keep. Common values include
\code{"ORAL"}, \code{"INJECTION"}, \code{"OPHTHALMIC"}, \code{"OTIC"}, \code{"INHALATION"},
\code{"TOPICAL"}, \code{"RECTAL"}, \code{"VAGINAL"}, \code{"URETHRAL"}, and \code{"IMPLANT"}.}

\item{keep_route_info}{Logical. If \code{TRUE} (default), append route, dose form, and
dose-form group summaries to the returned table.}

\item{include_historical}{Logical. If \code{TRUE}, use RxCUI history status
metadata as a fallback for RxCUIs that do not return active clinical
attributes. This is useful for obsolete, remapped, quantified, or otherwise
non-current RxCUIs found in historical prescribing data. If \code{products}
contains a \code{concept_status} column with non-\code{"active"} value, historical
lookup is enabled automatically.}

\item{show_progress}{Logical. Show a progress bar in interactive sessions.
Progress is shown only when at least 5 inputs are supplied.}
}
\value{
A tibble containing only rows whose \code{product_rxcui} has at least one
matching route.
}
\description{
Filters a product-level rxref table using route information from
\code{\link[=get_clinical_attributes]{get_clinical_attributes()}}. Useful when a drug or class includes
products across multiple routes, such as oral tablets, ophthalmic solutions,
injectables, patches, or topical formulations.
}
\examples{
\dontrun{
ing <- find_ingredients("metoprolol")

prods <- products_for_ingredients(
  ing$rxcui,
  include_combos = TRUE
)

filter_products_by_route(prods, route = "ORAL")

# Historical/current products can also be route-filtered
prods_hist <- products_for_ingredients(
  ing$rxcui,
  include_combos = TRUE,
  concept_status = "active_and_historical"
)

filter_products_by_route(prods_hist, route = "ORAL")
}

}
