cadrumo.adapters.outbound.google.calc_sheets_pull_records module

Typed records exchanged by the Google Sheets calculation pull adapter.

class ValueRange[source]

Bases: TypedDict

A single batch-get value-range entry from the Sheets API.

Cell values are object: the API returns whichever JSON scalar the cell holds, and callers must narrow before use. Every key is optional because Sheets omits an empty range’s values rather than sending an empty list.

range: str
majorDimension: str
as_value_range(entry)[source]

Translate one Sheets valueRanges entry into this adapter’s record.

The vendor schema pins majorDimension to a Literal and types cell values as Any; this record widens the former to str and narrows the latter to object, so the two are not mutually assignable and the entry is copied key by key.

Return type:

ValueRange

Parameters:

entry (SheetsValueRange)

class OperatorEdit(**data)[source]

Bases: BaseModel

One operator-edited cell value.

Parameters:

data (Any)

casilla_id: CasillaId
display_number: str
label: str
value: Decimal | str | bool | None
class BindingEdit(**data)[source]

Bases: BaseModel

One operator-edited binding cell value (numeric or enum).

Parameters:

data (Any)

binding: BindingId
value: Decimal | str | None
class RelationEdit(**data)[source]

Bases: BaseModel

One pre-resolved cross-revision relation value mirrored in Tarifas.

Parameters:

data (Any)

relation: RelationId
value: Decimal | None
provenance: SheetRelationProvenanceValue | None
source_modelo: ModeloId | None
source_filing_year: FilingYear | None
source_periods: tuple[str, ...]
source_casilla_ids: tuple[CasillaId, ...]
legal_refs: tuple[LegalRefId, ...]
source_refs: tuple[SourceRefId, ...]
resolved_at: datetime | None
relation_edit_payload(edit)[source]

Project one relation edit into its operator-facing payload row.

Return type:

dict[str, object]

Parameters:

edit (RelationEdit)

class RowSetCellEdit(**data)[source]

Bases: BaseModel

One operator-edited cell from a Detalle tab row-set.

Parameters:

data (Any)

binding: BindingId
row_index: int
value: Decimal | str | None
class RowSetEdit(**data)[source]

Bases: BaseModel

All operator-supplied detail rows for one row-set grouping.

Parameters:

data (Any)

grouping: str
cells: tuple[RowSetCellEdit, ...]
class PullMetadata(**data)[source]

Bases: BaseModel

Workbook identity metadata recovered from developer metadata.

Parameters:

data (Any)

modelo_id: str
revision_id: RevisionId
filing_year: int
period: str
engine_version: str
registry_sha: str
exported_at: str | None
class MetadataMatchState(*values)[source]

Bases: StrEnum

Registry-SHA and stamp alignment result for a pulled workbook.

MATCHES
STALE
MISSING
class PullResult(**data)[source]

Bases: BaseModel

Outcome of one Google Sheets pull cycle.

Parameters:

data (Any)

spreadsheet_id: str
operator_edits: tuple[OperatorEdit, ...]
binding_edits: tuple[BindingEdit, ...]
relation_edits: tuple[RelationEdit, ...]
row_set_edits: tuple[RowSetEdit, ...]
metadata: PullMetadata
metadata_match: MetadataMatchState
cells_read: NonNegativeInt