% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatial-sanity.R
\name{prior_consistency_check}
\alias{prior_consistency_check}
\title{Check consistency between a deterministic RSG assignment and a
spatial prior}
\usage{
prior_consistency_check(rsg_code, prior, threshold = 0.01)
}
\arguments{
\item{rsg_code}{Two-letter RSG code (e.g. \code{"FR"}). Either the
\code{rsg_or_order} from a \code{\link{ClassificationResult}}
(in which case it must be the RSG name; we try to translate
via the trace) or the bare code from a key trace entry.}

\item{prior}{A spatial-prior data.table from
\code{\link{spatial_prior}}.}

\item{threshold}{Probability below which an assignment is flagged
inconsistent (default 0.01).}
}
\value{
A list with elements:
  \itemize{
    \item \code{consistent}: \code{TRUE} / \code{FALSE} / \code{NA}.
    \item \code{p}: probability of the assigned RSG in the prior
          (or \code{NA_real_} if not found).
    \item \code{threshold}: the threshold used.
    \item \code{status}: a short status string -- \code{"consistent"},
          \code{"inconsistent"}, or \code{"no_data"}.
    \item \code{note}: human-readable explanation.
    \item \code{top_prior}: \code{data.table} with the top three
          classes from the prior (for messages).
  }
}
\description{
Returns a list describing whether the assigned RSG is plausible
under the given prior. The deterministic classification is never
overridden -- this is purely a sanity-check signal.
}
