aeat.application.overview._pipeline_health module¶
Pipeline health: cross-domain readiness summary for one filing period.
build_pipeline_health_report() is the application service backing
aeat app overview pipeline --year YEAR --period PERIOD. It answers the
operator-observable question “is my pipeline healthy for this period?” by
composing three already-existing read models for the requested
(filing_year, period) scope into one typed report:
ledger health —
summarize_manual_transactions()(active/pending-review/reviewed/skipped counts, readiness-issue count).modelo readiness — one
ModeloHealthRowperWorkUnittargeting the requested period, derived from itsCalculationRevisionstate (get_calculation_revision()) — not-started when no work unit exists yet for a modelo the operator would need to file.outstanding findings — every
BLOCKING/WARNINGModeloVerificationFindingfrom the latestVerificationReportagainst each period work unit’s current revision.
The builder is READ-ONLY: it inspects the transaction catalogue, the modelo
work-unit catalogue, the calculation-revision catalogue, and the
verification-report catalogue for the requested scope. It persists nothing
and never contacts AEAT. Every counter it reports is already produced by an
existing read model or a direct repository read; this module composes them
into one cross-domain dashboard rather than introducing a new aggregation
(the composition-service-no-parallel-write-path discipline).
See also
overviewSibling read-only overview builders (
status,prepare,calendar,agenda,backlog,explain) this module follows the same shape as.summarize_manual_transactions()Owns the ledger status counters this report’s ledger section reuses rather than re-deriving.
WorkUnitThe modelo work-unit record the readiness rows resolve against.
VerificationReportThe findings source each readiness row’s outstanding-findings list is drawn from.
- class ModeloReadinessState(*values)[source]¶
Bases:
StrEnumClosed lifecycle state for one modelo’s readiness within a period.
- Variables:
NOT_STARTED – No
WorkUnitexists yet for this(modelo, filing_year, period).CALCULATED – A work unit exists and its current revision has computed casilla values but has not been verified.
VERIFIED – The current revision reached
VERIFICADO_COMPLETO.FILED – The work unit’s filed revision matches its current revision (
PRESENTADOor superseded by a later filed revision of the same unit).BLOCKED – The latest verification report against the current revision carries at least one
BLOCKINGfinding.
- NOT_STARTED¶
- CALCULATED¶
- VERIFIED¶
- FILED¶
- BLOCKED¶
- class ModeloHealthRow(**data)[source]¶
Bases:
BaseModelOne modelo’s readiness row within a period health report.
- Variables:
modelo – AEAT modelo code (e.g.
"130","303").work_unit_id – The matching
WorkUnitid, orNonewhenstateisNOT_STARTED.state – Current
ModeloReadinessStatefor this modelo/period.blocking_finding_count – Count of
BLOCKINGseverity findings from the latest verification report against the current revision.warning_finding_count – Count of
WARNINGseverity (advisory) findings from the same report.summary – Human-readable one-line progress summary.
next_command – The exact next
aeatcommand to run to advance this modelo, or resolve its current gap.
- Parameters:
- modelo: str¶
- work_unit_id: str | None¶
- state: ModeloReadinessState¶
- blocking_finding_count: int¶
- warning_finding_count: int¶
- summary: str¶
- next_command: str¶
- class PipelineHealthReport(**data)[source]¶
Bases:
BaseModelOutcome of
build_pipeline_health_report().- Variables:
bucket_id – Active profile bucket the report is scoped to.
filing_year – Filing year for the requested scope.
period – Registry period token for the requested scope (e.g.
1T).ledger – The reused
LedgerStatusReportfor the same(bucket_id, period)scope.modelos – Ordered
ModeloHealthRowrows, one per work unit found for the period, sorted by modelo code. Empty when no work unit has been created for this period yet.total_blocking_findings – Sum of every row’s
blocking_finding_count.total_warning_findings – Sum of every row’s
warning_finding_count.ready –
Trueonly when the ledger reports no unresolved readiness issues (or was not scoped) and every modelo row isFILEDorVERIFIED, with zero modelos inBLOCKED.Falsewhen any modelo has not started or is blocked, or the ledger still carries pending-review rows or readiness issues. A pipeline with zero work units for the period is never reported ready — there is nothing to be ready about yet.
- Parameters:
bucket_id (str)
filing_year (int)
period (str)
ledger (LedgerStatusReport)
modelos (tuple[ModeloHealthRow, ...])
total_blocking_findings (int)
total_warning_findings (int)
ready (bool)
- bucket_id: str¶
- filing_year: int¶
- period: str¶
- ledger: LedgerStatusReport¶
- modelos: tuple[ModeloHealthRow, ...]¶
- total_blocking_findings: int¶
- total_warning_findings: int¶
- ready: bool¶
- build_pipeline_health_report(*, bucket_id, filing_year, period, ledger_report, work_units, revisions_by_id, reports_by_revision_id)[source]¶
Compose the cross-domain pipeline health report for one period.
- Parameters:
bucket_id (
str) – Active profile bucket the report is scoped to.filing_year (
int) – Filing year for the requested scope.period (
Period) – Typed filingPeriodfor the requested scope.ledger_report (
LedgerStatusReport) – Already-builtLedgerStatusReportfor(bucket_id, period)(period-scoped, soreadyandreadiness_issue_countare populated).work_units (
tuple[WorkUnit,...]) – Non-discardedWorkUnitrows forbucket_idmatching(filing_year, period). Callers filter to the requested scope; this builder does not re-filter.revisions_by_id (
dict[str,CalculationRevision]) – Mapping ofcalculation_revision_idto the loadedCalculationRevision, covering every work unit’scurrent_calculation_revision_id. A work unit whose id is absent from this mapping is treated as having no revision yet.reports_by_revision_id (
dict[str,tuple[VerificationReport,...]]) – Mapping ofcalculation_revision_idto itsVerificationReportrows, sorted oldest-first (the shapelist_verification_reports()returns). The latest (last) report is used.
- Return type:
- Returns:
A
PipelineHealthReportwith oneModeloHealthRowper work unit, findings totals, and an overallreadyverdict.