ds_provider_powerofficego_py_lib.dataset.utils

File: utils.py Region: ds_provider_powerofficego_py_lib/dataset/utils

Shared helpers for PowerOfficeGo dataset reads.

Attributes

logger

_PROVIDER_FILTER_KEYS

Functions

records_from_body(→ list[dict[str, Any]])

Normalize a PowerOffice list or {data|value|values: [...]} payload to row dicts.

parse_iso8601_timestamp(→ datetime.datetime)

Parse an ISO-8601 timestamp string to an aware UTC datetime for comparison.

greatest_time_field_value(→ Any)

Return the original value that sorts last by parsed UTC datetime.

greatest_incremental_value(→ Any | None)

Return the greatest watermark among observed values for the given strategy.

build_checkpoint(→ dict[str, Any])

Build a checkpoint dictionary for pagination / incremental state.

build_params(→ dict[str, Any])

Build PowerOfficeGo query params from dataset read settings.

build_url(→ str)

Build the PowerOfficeGo API URL for data_product.

Module Contents

ds_provider_powerofficego_py_lib.dataset.utils.logger
ds_provider_powerofficego_py_lib.dataset.utils._PROVIDER_FILTER_KEYS
ds_provider_powerofficego_py_lib.dataset.utils.records_from_body(body: Any) → list[dict[str, Any]][source]

Normalize a PowerOffice list or {data|value|values: [...]} payload to row dicts.

ds_provider_powerofficego_py_lib.dataset.utils.parse_iso8601_timestamp(value: str) → datetime.datetime[source]

Parse an ISO-8601 timestamp string to an aware UTC datetime for comparison.

Handles up to 7 digits of fractional seconds by truncating to 6 (Python max).

ds_provider_powerofficego_py_lib.dataset.utils.greatest_time_field_value(values: collections.abc.Sequence[Any]) → Any[source]

Return the original value that sorts last by parsed UTC datetime.

ds_provider_powerofficego_py_lib.dataset.utils.greatest_incremental_value(values: collections.abc.Sequence[Any], *, kind: str) → Any | None[source]

Return the greatest watermark among observed values for the given strategy.

ds_provider_powerofficego_py_lib.dataset.utils.build_checkpoint(last_page: int | None, last_modified_date: str | None) → dict[str, Any][source]

Build a checkpoint dictionary for pagination / incremental state.

ds_provider_powerofficego_py_lib.dataset.utils.build_params(settings: Any, page: int, last_modified_date: str | None, *, as_of: str | None = None) → dict[str, Any][source]

Build PowerOfficeGo query params from dataset read settings.

as_of sets TrialBalance date and overrides filters.date. Product-only filter keys (e.g. date_from) are not forwarded.

LastChangedDateTimeOffset is auto-added to Fields for incremental products only — TrialBalance rejects that field (HTTP 400).

ds_provider_powerofficego_py_lib.dataset.utils.build_url(*, host: str, api_version: str, data_product: str) → str[source]

Build the PowerOfficeGo API URL for data_product.