% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zzz-validate_inputs.R
\name{validate_inputs}
\alias{validate_inputs}
\title{Validate required inputs for a calling function}
\usage{
validate_inputs(data, col_map, fun_name, required_keys = NULL)
}
\arguments{
\item{data}{data.frame or tibble}

\item{col_map}{named list mapping keys to column names}

\item{fun_name}{character scalar naming the calling function (e.g., "lipid_markers").
Used to look up built-in required keys when \code{required_keys} is not supplied.}

\item{required_keys}{optional character vector of required col_map keys. When
supplied, this takes precedence over the \code{fun_name} built-in lookup, making
the function useful for any caller regardless of \code{fun_name}.}
}
\value{
invisibly TRUE on success; otherwise aborts
}
\description{
Ensures required keys exist in \code{col_map} and have non-empty mappings.
Missing keys are reported in a stable order aligned with tests.
}
\examples{
df <- data.frame(TG = c(1.5, 2.0), HDL_c = c(1.2, 1.0),
  LDL_c = c(2.0, 2.5), TC = c(4.5, 5.0))
# Using built-in lookup
validate_inputs(df,
  list(TG = "TG", HDL_c = "HDL_c", LDL_c = "LDL_c", TC = "TC"),
  fun_name = "lipid_markers")
# Using explicit required_keys (works for any function)
validate_inputs(df,
  list(TG = "TG", HDL_c = "HDL_c"),
  fun_name = "my_function",
  required_keys = c("TG", "HDL_c"))
}
