$$ % Define your custom commands here \newcommand{\bmat}[1]{\begin{bmatrix}#1\end{bmatrix}} \newcommand{\E}{\mathbb{E}} \newcommand{\P}{\mathbb{P}} \newcommand{\S}{\mathbb{S}} \newcommand{\R}{\mathbb{R}} \newcommand{\S}{\mathbb{S}} \newcommand{\norm}[2]{\|{#1}\|_{{}_{#2}}} \newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}} \newcommand{\vectornorm}[1]{\left|\left|#1\right|\right|} \newcommand{\abs}[1]{\left|{#1}\right|} \newcommand{\mbf}[1]{\mathbf{#1}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\bm}[1]{\boldsymbol{#1}} \newcommand{\nicefrac}[2]{{}^{#1}\!/_{\!#2}} \newcommand{\argmin}{\operatorname*{arg\,min}} \newcommand{\argmax}{\operatorname*{arg\,max}} \newcommand{\dd}{\operatorname{d}\!} $$

schema

schema

CSV column definitions and validation.

The schema is deliberately permissive about missing values and strict about wrong ones. Missing data is the normal case – you will skip weigh-ins and forget to log meals, and the filter is built for exactly that. Silently wrong data is the dangerous case, because nothing downstream can detect it.

Classes

Name Description
ValidationReport Outcome of validating an observations file.

ValidationReport

schema.ValidationReport(
    errors=list(),
    warnings=list(),
    n_rows=0,
    n_episodes=0,
    n_weights=0,
    n_intake=0,
)

Outcome of validating an observations file.

errors block loading; warnings do not. The distinction is that an error means the data cannot be interpreted, while a warning means it can be interpreted but probably should not be trusted without a look.

Functions

Name Description
validate Validate a raw observations dataframe.

validate

schema.validate(df)

Validate a raw observations dataframe.

Checks, in order: required columns present, no unknown columns, dates parseable and unique within episode, numeric columns numeric and within plausible bounds, and macronutrients consistent with reported total energy.