aeat.application.filing package¶
Public application facade for registry-backed filing drafts.
This package builds, reviews, approves, exports, verifies, imports, and
summarises local filing artefacts. All draft creation and validation consume
a RegistrySnapshot to resolve the
active ModeloRevision, its casilla
schema, relation inputs, and formula graph.
Major entry points:
build_draft()constructs a validatedModeloDraftfrom registry-backed inputs.approve_draft(),unapprove_draft(), andrefresh_review_status()manage local review state and approval basis.export_draft()writes a local fichero-BOE artefact, andverify_export()re-reads that file through the registry export parser.import_filing_from_justificante()reconstructs a draft-level local receipt baseline and companionModeloPresentadoaudit record from a justificante PDF without treating the receipt as a casilla-value authority.build_complementaria(),list_amendments(), andload_amendment()build and read governedModeloComplementariaandModeloSustitutivaamendment records.ModeloHistoryRepositorypersists encrypted lightweightModeloHistorysummaries for local filing-history views.build_runtime_schema_provider()supplies the runtime registry view used by draft construction, review, export, and verification.
The facade deliberately separates local filing state from live submission.
Remote AEAT submission is not exposed here; attempted live writes are refused
by LiveSubmitForbiddenError.
Imports from external PDFs stay evidence-scoped. A justificante import creates a local draft plus submission-audit baseline, while casilla-complete declaration and borrador parsing enter through the inbound adapter surfaces before application services decide how that evidence participates in a work-unit workflow.
Work-unit filing records for calculation revisions live in
modelo and domain.modelos. This package owns
draft-level construction, review, export, verification, justificante import,
local amendment construction, and lightweight local history; it does not create
ModeloRecord entries or stamp ExternalEvidence.
See also
modeloOperator-facing modelo facade that carries calculation revisions into this filing surface.
file_modelo_revision()Work-unit action that records a verified calculation revision as a current local
ModeloRecord.import_external_filing_evidence()External-evidence import path that creates an evidenced
ModeloRecordbaseline for amendments.domain.justificanteReceipt-metadata domain used by justificante PDF imports and receipt-bound external evidence.
domain.filingCanonical draft records, values, provenance, validation findings, and review helpers.
domain.submissionLocal-only submission audit records populated by justificante import; this is not an AEAT live-submit path.
domain.calculations.registryRegistry authority, snapshots, export layouts, and formula execution used by this application facade.
- build_draft(*, modelo, period, profile, inputs, schema_provider, deadline_checker=None, fail_on_warning=False)[source]¶
Build and validate a filing draft from a registry snapshot.
- Parameters:
modelo (
str) – Stable modelo string ID.period (
Period) – TypedPeriodbuilt from a filing year and bare registry token.profile (
ModeloProfile) –ModeloProfilethe draft would be built for.inputs (
TypeAliasType) – RawModeloInputs.schema_provider (
CasillaSchemaProvider) – Registry-backedCasillaSchemaProvider.deadline_checker (
DeadlineChecker|None) – OptionalDeadlineChecker.fail_on_warning (
bool) – Raise when validation produces any warning or error.
- Return type:
- Returns:
A fully constructed and validated
ModeloDraft.- Raises:
ModeloBuilderError – If the registry has no matching snapshot, inputs are malformed, or strict validation fails.
- validate_draft(draft, *, bucket_id, schema_provider, deadline_checker=None)[source]¶
Re-run validation against an existing draft.
The returned draft preserves
draft_idbecause the hash excludes findings, status,updated_atandnotes.- Parameters:
draft (
ModeloDraft) – TheModeloDraftto re-validate.bucket_id (
str) – Stable bucket identifier; forwarded torefresh_review_status()after validation.schema_provider (
CasillaSchemaProvider) –CasillaSchemaProviderresolving the casilla collection for the draft’s modelo.deadline_checker (
DeadlineChecker|None) – OptionalDeadlineCheckerProtocol implementation.
- Return type:
- Returns:
A new
ModeloDraftwith refreshed findings, status andupdated_at.
- iter_findings(draft, *, severity_at_least='WARNING')[source]¶
Yield findings filtered by minimum severity.
- Parameters:
draft (
ModeloDraft) – TheModeloDraftto scan for validation findings.severity_at_least (
str) – Minimum severity to yield, one of"INFO","WARNING","ERROR". Defaults to"WARNING".
- Yields:
Each
ModeloValidationFindingwhose severity meets or exceeds the threshold, in declaration order.- Raises:
ModeloCalculateError – When
severity_at_leastis not a known severity name ("INFO","WARNING", or"ERROR").- Return type:
Submodules¶
- aeat.application.filing._calculate module
DeclaracionCalculateNextActionDeclaracionCalculateSummaryDeclaracionCalculateSummary.draft_idDeclaracionCalculateSummary.modeloDeclaracionCalculateSummary.periodDeclaracionCalculateSummary.statusDeclaracionCalculateSummary.blocker_countDeclaracionCalculateSummary.warning_countDeclaracionCalculateSummary.info_countDeclaracionCalculateSummary.next_actionDeclaracionCalculateSummary.repair_hintsDeclaracionCalculateSummary.narrativeDeclaracionCalculateSummary.calculated_at
summarise_calculation()
- aeat.application.filing._complementaria module
- aeat.application.filing._export module
DeclaracionExportFormatDeclaracionVerifyVerdictDeclaracionExportResultDeclaracionExportResult.draft_idDeclaracionExportResult.modeloDeclaracionExportResult.periodDeclaracionExportResult.formatDeclaracionExportResult.output_pathDeclaracionExportResult.byte_sizeDeclaracionExportResult.file_sha256DeclaracionExportResult.exported_atDeclaracionExportResult.narrativeDeclaracionExportResult.casilla_provenance
DeclaracionVerifyResultDeclaracionVerifyResult.draft_idDeclaracionVerifyResult.file_pathDeclaracionVerifyResult.verdictDeclaracionVerifyResult.mismatched_casilla_idsDeclaracionVerifyResult.unchecked_casilla_idsDeclaracionVerifyResult.casilla_provenanceDeclaracionVerifyResult.mismatched_casilla_provenanceDeclaracionVerifyResult.file_sha256DeclaracionVerifyResult.verified_atDeclaracionVerifyResult.narrative
export_draft()export_layout_renderability_reason()verify_export()render_layout()boe_representable_casilla_ids()rendered_casilla_ids()assert_export_mirrors_manifest()
- aeat.application.filing._export_xml_dictionary module
- aeat.application.filing._history_models module
- aeat.application.filing._history_repository module
ModeloHistoryRepositoryModeloHistoryRepository.namespaceModeloHistoryRepository.sensitivityModeloHistoryRepository.schema_versionModeloHistoryRepository.payload_typeModeloHistoryRepository.bucket_idModeloHistoryRepository.extract_identifier()ModeloHistoryRepository.list_modelos()ModeloHistoryRepository.iter_histories()
- aeat.application.filing._import module
- aeat.application.filing._review module
ModeloApprovalStaleReasonModeloApprovalStaleReason.APPROVAL_BASIS_VERSION_CHANGEDModeloApprovalStaleReason.DRAFT_PAYLOAD_CHANGEDModeloApprovalStaleReason.DRAFT_REVIEW_CHANGEDModeloApprovalStaleReason.TRANSACTION_CATALOGUE_CHANGEDModeloApprovalStaleReason.INVOICE_CATALOGUE_CHANGEDModeloApprovalStaleReason.PRIOR_FILING_OBSERVATIONS_CHANGEDModeloApprovalStaleReason.PROFILE_ACTIVITY_CHANGEDModeloApprovalStaleReason.CATEGORY_PROFILES_CHANGEDModeloApprovalStaleReason.SCHEMA_FORMULA_CHANGED
compute_current_approval_basis()compute_review_checksum()approval_stale_reasons()approve_draft()unapprove_draft()refresh_review_status()describe_stale_reason()empty_prior_filing_observations_fingerprint()empty_profile_activity_fingerprint()
- aeat.application.filing._runtime_repository module
- aeat.application.filing._testing_registry module
- aeat.application.filing.errors module
- aeat.application.filing.runtime module
TaxpayerProfileIdentityModeloOperatorProfileRegistryCasillaSchemaRegistryCasillaSchema.casilla_idRegistryCasillaSchema.value_typeRegistryCasillaSchema.requiredRegistryCasillaSchema.formulaRegistryCasillaSchema.formula_input_casilla_idsRegistryCasillaSchema.legal_refsRegistryCasillaSchema.source_refsRegistryCasillaSchema.min_valueRegistryCasillaSchema.max_valueRegistryCasillaSchema.default
RegistryCasillaCollectionCasillaRecordMetadataRegistryModeloSubviewRegistryModeloSubview.modelo_idRegistryModeloSubview.revision_idRegistryModeloSubview.schema_versionRegistryModeloSubview.cadenceRegistryModeloSubview.period_selector_periodsRegistryModeloSubview.legal_ref_idsRegistryModeloSubview.source_ref_idsRegistryModeloSubview.extraction_profile_idsRegistryModeloSubview.verification_expectation_idsRegistryModeloSubview.reconciliation_total_casilla_idsRegistryModeloSubview.export_layout_idsRegistryModeloSubview.export_layoutsRegistryModeloSubview.application_link_idsRegistryModeloSubview.deadline_window_idsRegistryModeloSubview.completeness_manifestRegistryModeloSubview.casilla_record_metadataRegistryModeloSubview.has_completeness_manifest()
RegistrySchemaAccessorfiling_profile_from_taxpayer()load_default_filing_profile()build_runtime_schema_provider()clear_runtime_fingerprint_cache()registry_tree_fingerprint()collection_from_snapshot()registry_value_type()
- aeat.application.filing.testing module