katana_public_api_client.domain.material¶
katana_public_api_client.domain.material
¶
Domain model for Material entities.
This module provides a Pydantic model representing a Material (raw material or component) optimized for ETL, data processing, and business logic.
Classes¶
KatanaMaterial
¶
Bases: KatanaBaseModel
Domain model for a Material.
A Material represents raw materials and components used in manufacturing, including inventory tracking, supplier information, and batch management. This is a Pydantic model optimized for: - ETL and data processing - Business logic - Data validation - JSON schema generation
Unlike the generated attrs model, this model: - Has no Unset sentinel values - Provides ETL-friendly methods - Is immutable by default - Clean Optional types
Example
material = KatanaMaterial(
id=3201,
name="Stainless Steel Sheet 304",
type="material",
uom="m²",
category_name="Raw Materials",
is_sellable=False,
batch_tracked=True,
)
# Business methods available
print(material.get_display_name()) # "Stainless Steel Sheet 304"
# ETL export
csv_row = material.to_csv_row()
schema = KatanaMaterial.model_json_schema()
Functions¶
get_display_name()
¶
Get formatted display name.
Returns:
-
str–Material name, or "Unnamed Material {id}" if no name
Example
Source code in katana_public_api_client/domain/material.py
matches_search(query)
¶
Check if material matches search query.
Searches across: - Material name - Category name
Parameters:
-
query(str) –Search query string (case-insensitive)
Returns:
-
bool–True if material matches query
Example
Source code in katana_public_api_client/domain/material.py
to_csv_row()
¶
Export as CSV-friendly row.
Returns: