katana_public_api_client.domain.base¶
katana_public_api_client.domain.base
¶
Base domain model for Katana entities.
This module provides the foundation for Pydantic domain models that represent business entities from the Katana Manufacturing ERP system.
Domain models are separate from the generated API request/response models and are optimized for: - ETL and data processing - Business logic - Data validation - JSON schema generation - Clean, ergonomic APIs
Classes¶
KatanaBaseModel
¶
Bases: BaseModel
Base class for all Pydantic domain models.
Provides: - Immutability by default (frozen=True) - Automatic validation - JSON schema generation - Easy serialization for ETL - Common timestamp fields
Example
Functions¶
model_dump_for_etl()
¶
Export to ETL-friendly format.
Removes None values and uses field aliases for cleaner output.
Returns:
Example
Source code in katana_public_api_client/domain/base.py
to_dict_with_computed()
¶
Export including computed fields.
Unlike model_dump(), this includes @computed_field properties.
Returns:
Source code in katana_public_api_client/domain/base.py
to_warehouse_json()
¶
Export as JSON for data warehouse.
Returns:
-
str–JSON string with all non-None fields
Example
Source code in katana_public_api_client/domain/base.py
Functions¶
decimal_str_to_float(value)
¶
Coalesce a Katana decimal field to float.
Several Katana read fields arrive as fixed-precision decimal strings
(e.g. "12.00000000000") rather than JSON numbers. Domain models expose
them as float | None; this normalizes the string (or an already-numeric
int/float) to float. None and the empty string (which the
wire occasionally uses for "no value") map to None; this mirrors
tool_result_utils.float_or_none so the two layers agree.