aeat.application.overview._explain module¶
Overview explain: per-(modelo, year) applicability decomposition.
build_overview_explain() is the application service backing
aeat app overview explain MODELO [--year YYYY]. The applicable
verdict is DERIVED from the three-axis
TaxpayerProfile taxpayer model through
the registry-grounded
derive_modelo_applicability()
rule table, never assumed from an autónomo default. An undeclared taxpayer
model yields an explicit incomplete verdict: the service
reports “declare your taxpayer type first” rather than a confident
wrong obligation.
The deadline-engine explain text is still surfaced as the
scheduling rationale (when the modelo’s filing windows are
registered for the year), but it no longer drives the applicability
flag. The service also enumerates the profile keys the answer depends
on so the operator can audit them. Local-only: never contacts AEAT.
See also
ModeloRevisionCompiled revision whose deadline windows are matched against the taxpayer profile to build the scheduling rationale.
- class DeadlineExplanationEngine(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for the deadline engine’s scheduling-rationale method.
- class OverviewExplain(**data)[source]¶
Bases:
BaseModelOutcome of
build_overview_explain.The model separates the registry-applicability verdict from the optional deadline-engine scheduling rationale. That keeps
ApplicabilityVerdictauthoritative even when a known modelo has no registered filing window for the requested year.- Variables:
modelo – AEAT modelo identifier the explanation is for.
year – The fiscal year the applicability was evaluated against.
applicable – Whether the modelo positively applies to the profile this year. Only an
ApplicabilityVerdict.APPLICABLEverdict isTrue;NOT_APPLICABLEandINCOMPLETEare bothFalse— the operator is never told a modelo applies unless the taxpayer model positively justifies it.verdict – The three-state
ApplicabilityVerdictderived from the taxpayer model.INCOMPLETEmeans the operator must declare their taxpayer type first.rationale – Operator-facing prose explaining the verdict, derived from the registry-grounded applicability rule.
legal_refs – Opaque BOE / AEAT citation keys grounding the applicability rule. Always at least one entry.
scheduling_rationale – The deadline engine’s registry-backed scheduling text, when the modelo’s filing windows are registered for the year.
Nonewhen no deadline-window data exists (registry-track gap R1) — the applicabilityverdictis independent of it.out_of_plazo_warning – Warning text when the matching registry filing window closed more than twelve months before the reference date. The warning annotates the voluntary-deadline state and the ordinary four-year LGT prescription horizon without changing the applicability verdict.
profile_facts – Subset of the operator’s
TaxpayerProfilefields the answer depends on. Keys are stable field names; values are JSON-serialisable scalars.generated_at – UTC timestamp of when the aggregator ran.
- Parameters:
- modelo: str¶
- year: int¶
- applicable: bool¶
- verdict: ApplicabilityVerdict¶
- rationale: str¶
- legal_refs: tuple[LegalRefId, ...]¶
- scheduling_rationale: str | None¶
- out_of_plazo_warning: str | None¶
- profile_facts: dict[str, _ProfileFactValue]¶
- generated_at: datetime¶
- build_overview_explain(profile, *, modelo, year=None, engine=None, today=None)[source]¶
Decompose a modelo’s applicability against the operator’s profile.
The
applicableflag and theverdictare DERIVED from the three-axis taxpayer model throughderive_modelo_applicability()— never from an autónomo default. An undeclared taxpayer model yields anINCOMPLETEverdict: the service reports “declare your taxpayer type first” instead of a confident wrong obligation.The deadline engine’s
explaintext is still surfaced asscheduling_rationalewhen the modelo’s filing windows are registered for the year. When the modelo is a known registry modelo but no deadline windows are registered (registry-track gap R1), the scheduling rationale is leftNone; the applicabilityverdictis unaffected. A genuinely unknown modelo identifier still raisesOverviewExplainError.- Parameters:
profile (
TaxpayerProfile) – TheTaxpayerProfilewhose attributes determine applicability.modelo (
str) – Modelo identifier to explain (e.g."130").year (
int|None) – Optional calendar year. Defaults to the current year.engine (
DeadlineExplanationEngine|None) – OptionalDeadlineExplanationEngineoverride.today (
date|None) – Optional reference date for out-of-plazo annotation. Defaults to today. Tests pass this explicitly; the CLI uses the real current date.
- Return type:
- Returns:
An
OverviewExplaincarrying the applicability verdict, optional scheduling rationale, and profile facts used by the verdict.- Raises:
OverviewExplainError – When the modelo identifier is blank or unknown to the registry, or when the deadline engine fails for a reason other than a missing deadline-window dataset.