cadrumo.domain.categories.spending_category module

Opaque spending-category tokens and mechanical family buckets.

The governed deductible-category vocabulary and its family membership live in the dated categories.profile facts registry. This module retains only the opaque token shape and the coarse family buckets used by presentation and aggregation mechanics. Callers obtain category tokens through the typed projection in spending_category_catalogue.

class SpendingCategory(value, *, _registry_validated=False)[source]

Bases: str

Registry-projected deductible-spending token.

Category membership is governing-body data, not a Python enum catalogue. Direct construction is therefore refused; from_registry() is used only by the typed facts projection, while Pydantic input is resolved through that same projection.

Parameters:
  • value (str)

  • _registry_validated (bool)

Return type:

Self

classmethod from_registry(value)[source]

Materialise one token after a registry catalogue has declared it.

Return type:

Self

Parameters:

value (str)

property value: str

Return the persisted registry token.

property name: str

Return the token for diagnostics where an enum name was expected.

class SpendingCategoryFamily(*values)[source]

Bases: StrEnum

Mechanical coarse buckets used by CLI listings and classifiers.

These values are presentation/aggregation grouping tokens, not the legal category catalogue. Their retained membership is resolved from the facts projection by categories_for_family().

SOCIAL_SECURITY
PREMISES
HOME_OFFICE_SUMINISTROS
HOME_OFFICE_OWNERSHIP
TELECOMS
OFFICE
VEHICLE
MEALS
PROFESSIONAL_SERVICES
TRAVEL
INSURANCE
FINANCIAL
DIRECT_COSTS
TAXES
family_for(category, *, effective_date=None, authority=None)[source]

Return the registry-declared coarse family for one category.

Return type:

SpendingCategoryFamily

Parameters:
categories_for_family(family, *, effective_date=None, authority=None)[source]

Return registry-declared category tokens for one mechanical family.

Return type:

tuple[SpendingCategory, ...]

Parameters:
home_office_categories(*, effective_date=None, authority=None)[source]

Return registry categories in the retained home-office buckets.

Return type:

frozenset[SpendingCategory]

Parameters: