% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_helpers.R
\name{.hm_global_precompute}
\alias{.hm_global_precompute}
\title{Derive "Tier 0" variables before any marker function runs.}
\usage{
.hm_global_precompute(data, col_map = NULL, verbose = FALSE)
}
\arguments{
\item{data}{data.frame after col_map materialization.}

\item{col_map}{Named list of key -> column mappings (used only to resolve
the physical column names when materialization has NOT been run yet).}

\item{verbose}{Logical; emit one-line summary per derived variable.}
}
\value{
A list:
\describe{
\item{data}{data.frame with new columns appended.}
\item{precomputed}{Character vector of variable names that were derived.}
}
}
\description{
Computes the following variables \strong{only when they are absent} from \code{data}:
\describe{
\item{BMI}{from \code{weight} (kg) and \code{height} (m or cm) via \code{weight / height_m^2}}
\item{glucose / G0}{bidirectional alias: whichever is absent is filled from the other}
\item{insulin / I0}{bidirectional alias (pmol/L <-> muU/mL unchanged -- same unit assumed)}
\item{eGFR}{CKD-EPI 2009 creatinine equation from \code{creatinine}, \code{age}, \code{sex}
(and optionally \code{race}). Written as \code{eGFR} only; downstream
functions that need \code{eGFR_cr} receive it via col_map.}
\item{UACR}{\code{urine_albumin} / \code{urine_creatinine} (both in mg/mmol or the
ratio already in mg/g -- no unit conversion; caller's responsibility)}
\item{LDL_c}{Friedewald: \code{TC - HDL_c - TG/2.2} (mmol/L); skipped if TG > 4.5}
}
}
\details{
col_map keys are respected: if the user has mapped e.g.\ \code{creatinine -> "Cr_serum"},
the materialized \code{data[["creatinine"]]} column (placed there by \code{.hm_build_col_map()})
is used transparently.
}
\keyword{internal}
