% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validate_inputs_before_perturbation.R
\name{validate_inputs_bigquery}
\alias{validate_inputs_bigquery}
\title{Validate Inputs Before Perturbation using BigQuery}
\usage{
validate_inputs_bigquery(
  con,
  data,
  ptable,
  geog,
  tab_vars,
  record_key,
  use_existing_ons_id,
  threshold
)
}
\arguments{
\item{con}{--\code{DBIConnection}.
An active BigQuery connection created with \code{DBI::dbConnect()}}

\item{data}{--\code{character}.
BigQuery table name for microdata in full format:
\code{"<PROJECT>.<DATASET>.<TABLE>"}.
One row per statistical unit (person, household, business, etc.),
and one column per variable (e.g. age, sex, health status)}

\item{ptable}{--\code{character}.
BigQuery table name for the p-table in full format:
\code{"<PROJECT>.<DATASET>.<TABLE>"}.}

\item{geog}{--\verb{character vector}.
Column name containing the desired geography level for the frequency table.
e.g., \code{c("Region")} or \code{c("LocalAuthority")}.
Use \code{c()} if no geography breakdown required.}

\item{tab_vars}{--\verb{character vector}.
Column names to tabulate, e.g., \code{c("Age", "Health", "Occupation")}.}

\item{record_key}{--\code{character}.
Column name with record keys required for perturbation,
e.g., \code{"Record_Key"}.
If data contains "ons_id" and use_existing_ons_id = TRUE,
set (record_key = NULL), as record key will be generated from "ons_id".}

\item{use_existing_ons_id}{-- \code{logical}
Whether to create record keys from ons_id, if ons_id exists in data.
It will be irrelevant if microdata does not contain ons_id.
Default is TRUE.}

\item{threshold}{--\code{integer}.
Suppression threshold; perturbed counts below this value are suppressed.
Default 10.}
}
\value{
Invisibly returns TRUE on success. Throws stop or Warning messages
if any validation fails.
}
\description{
Validates BigQuery inputs for a perturbation process.
\itemize{
\item Validate input arguments
\itemize{
\item Check that at least one variable specified for geog or tab_vars
\item Check geog and tab_vars are either character vectors or NULL
\item Check specified record_key is character vector or NULL
\item Check threshold is an integer and non-negative
}
\item Validate microdata and ptable contain required columns
\itemize{
\item Check data contain the specified geog, tab_vars & record_key
\item Check ptable contains required columns
}
\item Validate the range of record keys and cell keys
\item Validate data has sufficient records with record keys to apply perturbation
}
}
