% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hm_col_report.R
\name{hm_col_report}
\alias{hm_col_report}
\title{Diagnose and report column name mapping for your data}
\usage{
hm_col_report(
  data,
  col_map = NULL,
  verbose = TRUE,
  fuzzy = FALSE,
  show_unmatched = FALSE
)
}
\arguments{
\item{data}{A \code{data.frame} or \code{tibble}.}

\item{col_map}{Optional named list of manually specified mappings
(\code{list(TG = "trig_my_col")}).  These always take priority.}

\item{verbose}{Logical (default \code{TRUE}).  Print the formatted report.}

\item{fuzzy}{Logical (default \code{FALSE}).  Enable fuzzy / approximate
matching as a final layer.  May produce false positives; review results
with care.}

\item{show_unmatched}{Logical (default \code{FALSE}).  If \code{TRUE},
also list every key that could not be matched.  Useful when you expect a
variable to be found but it isn't.}
}
\value{
Invisibly returns a named list: internal key \eqn{\to} matched
data-column name.  Keys that were not found are omitted.  You can assign
this to \code{col_map} and pass it to any \pkg{HealthMarkers} function.
}
\description{
Scans the column names of your data frame against the internal synonym
dictionary used by all \pkg{HealthMarkers} functions and prints a
formatted report showing which internal keys were matched automatically and
which were not found.  The function uses five matching layers in order:
\enumerate{
\item \strong{User-supplied} (via \code{col_map}) — always wins.
\item \strong{Exact synonym match} — column name is in the synonym list.
\item \strong{Case-insensitive exact} — same, ignoring upper/lower case.
\item \strong{Column contains synonym} — data column name contains a synonym as a
whole word (e.g.\ \code{"trig_baseline"} matches \code{"trig"}).
\item \strong{Synonym contains column} — a synonym contains the column name as a
whole word (e.g.\ \code{"TG_fasting"} synonym matches column \code{"TG"}).
\item \strong{Fuzzy} (opt-in via \code{fuzzy = TRUE}) — Levenshtein-based approximate
matching as a last resort.
}

The function returns the matched mappings invisibly as a named list that
can be passed directly as the \code{col_map} argument to any
\pkg{HealthMarkers} function.
}
\examples{
\dontrun{
# Basic diagnostic
hm_col_report(my_data)

# Fuzzy matching + show all unmatched
hm_col_report(my_data, fuzzy = TRUE, show_unmatched = TRUE)

# Capture the result as a ready-to-use col_map
cm <- hm_col_report(my_data, verbose = FALSE)
all_health_markers(my_data, col_map = cm)
}

}
