cadrumo.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. Filing state comes from the persistedCalculationRevision; otherwise readiness comes from the latest persistedVerificationReport, with no report rendered as never verified.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 aeat-architecture-boundaries 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 no persisted verification report.
INCOMPLETO – The latest persisted verification report found required inputs or casillas still missing.
VERIFIED – The latest persisted verification report granted the
verificado_completotransition.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 persisted verification report has a
BLOCKEDcompleteness outcome.
- NOT_STARTED¶
- CALCULATED¶
- INCOMPLETO¶
- 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_action – The catalogue action that advances this modelo, or resolves its current gap, carrying the work unit or modelo this row already identifies.
- Parameters:
data (Any)
- modelo: str¶
- work_unit_id: WorkUnitId | None¶
- state: ModeloReadinessState¶
- blocking_finding_count: int¶
- warning_finding_count: int¶
- summary: str¶
- next_action: DeclaredNextAction | None¶
- 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 is not started, never verified, incomplete, or 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:
data (Any)
- bucket_id: BucketId¶
- 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.