cadrumo.application.ledger.import_ports module

Application-owned capabilities for ledger source imports.

The ledger import action coordinates source parsing and persistence, but it does not choose a provider implementation or know the secure-object namespace used by the transaction catalogue. Those choices are supplied by an outer composition root through the two capabilities in LedgerImportPorts.

The value records in this module are the small application boundary DTOs. An inbound adapter may use richer parser records internally, but it must translate them to these records before handing control to the application action.

class LedgerParsedRow(raw, direction)[source]

Bases: object

Application view of one parsed source row.

Parameters:
raw: RawTransaction
direction: TransactionDirection
class LedgerProviderValidation(is_valid, warnings=(), detected_encoding=None, detected_dialect=None, unavailable_optional_extra=None)[source]

Bases: object

Application view of provider validation facts.

Parameters:
is_valid: bool
warnings: tuple[str, ...]
detected_encoding: str | None
detected_dialect: str | None
unavailable_optional_extra: Mapping[str, str | bool] | None
class LedgerProviderResolverProtocol(*args, **kwargs)[source]

Bases: Protocol

Resolve one canonical provider ID to an application source port.

resolve(*, provider_id, path)[source]

Return a source provider, or None when detection declines it.

Implementations translate all provider-specific parser errors to the application transaction-validation error before they cross this port.

Return type:

FinancialProviderProtocol | None

Parameters:
class TransactionCatalogueLocationProtocol(*args, **kwargs)[source]

Bases: Protocol

Render the application-facing location of a persisted catalogue.

path_for(*, bucket_id)[source]

Return the stable display/reference path for one bucket catalogue.

Return type:

str

Parameters:

bucket_id (str)

class LedgerImportPorts(provider_resolver, catalogue_location)[source]

Bases: object

Required source and catalogue-location capabilities for ledger import.

Parameters:
provider_resolver: LedgerProviderResolverProtocol
catalogue_location: TransactionCatalogueLocationProtocol