aeat.domain.categories._spending_category module

AEAT-aligned spending-category taxonomy.

Defines the closed enum SpendingCategory of deductible autónomo expense classes, the coarse SpendingCategoryFamily groups, and the static CATEGORY_FAMILY_MEMBERS membership table. The taxonomy is the stable identifier surface every other package binds to; renaming a member is a breaking change.

class SpendingCategory(*values)[source]

Bases: StrEnum

Stable identifiers for deductible autónomo spending categories.

Members map one-to-one to the deductible expense classes recognised by AEAT. Each value is the stable kebab-style Spanish identifier used in the on-disk corpus and in CLI flags.

CUOTAS_COLEGIALES
CUOTAS_AUTONOMOS_SS
MUTUALIDAD_ALTERNATIVA
ARRENDAMIENTO_LOCAL
ARRENDAMIENTO_VIVIENDA_AFECTO
IBI_LOCAL_AFECTO
SUMINISTROS_HOME_OFFICE_LUZ
SUMINISTROS_HOME_OFFICE_AGUA
SUMINISTROS_HOME_OFFICE_GAS
SUMINISTROS_HOME_OFFICE_INTERNET
AMORTIZACION_VIVIENDA_AFECTO
IBI_VIVIENDA_AFECTO
COMUNIDAD_VIVIENDA_AFECTO
TELEFONIA_MOVIL
TELEFONIA_FIJA
MATERIAL_OFICINA
SOFTWARE_SUSCRIPCION
HARDWARE_AMORTIZABLE
MOBILIARIO_AMORTIZABLE
REPARACIONES_CONSERVACION
VEHICULO_COMBUSTIBLE
VEHICULO_MANTENIMIENTO
VEHICULO_SEGURO
VEHICULO_PEAJE
VEHICULO_PARKING
MANUTENCION_DIETAS_NACIONAL
MANUTENCION_DIETAS_EXTRANJERO
ASESORIA_FISCAL
ASESORIA_JURIDICA
ASESORIA_CONTABLE
PUBLICIDAD_MARKETING
FORMACION_PROFESIONAL
VIAJES_TRANSPORTE
VIAJES_ALOJAMIENTO
SEGUROS_RESPONSABILIDAD_CIVIL
SEGUROS_SALUD_AUTONOMO
GASTOS_BANCARIOS
GASTOS_FINANCIEROS
SUMINISTROS_CLIENTE_DIRECTOS
SUBCONTRATACION
TRIBUTOS_FISCALMENTE_DEDUCIBLES
class SpendingCategoryFamily(*values)[source]

Bases: StrEnum

Coarse families used by CLI listings and downstream classifiers.

Each SpendingCategory belongs to exactly one family — the membership table is CATEGORY_FAMILY_MEMBERS and the invariant is enforced by domain.categories.tests.test_spending_category.test_every_category_belongs_to_exactly_one_family().

The home-office bucket is split into two distinct families per LIRPF Art. 30.2 rule 5 (Ley 6/2017, BOE-A-2017-12544): the HOME_OFFICE_SUMINISTROS family carries the utility costs on which the statutory 0.30 multiplier applies on top of the operator-chosen vivienda afectación ratio; the HOME_OFFICE_OWNERSHIP family carries the titularity-attached costs (amortización, IBI, comunidad) that deduct at the raw vivienda afectación ratio with no statutory multiplier.

SOCIAL_SECURITY
PREMISES
HOME_OFFICE_SUMINISTROS
HOME_OFFICE_OWNERSHIP
TELECOMS
OFFICE
VEHICLE
MEALS
PROFESSIONAL_SERVICES
TRAVEL
INSURANCE
FINANCIAL
DIRECT_COSTS
TAXES
CATEGORY_FAMILY_MEMBERS: dict[SpendingCategoryFamily, tuple[SpendingCategory, ...]]

Static membership table from SpendingCategoryFamily to its members.

Every SpendingCategory appears in exactly one entry. The table is the source of truth for family_for() and categories_for_family().

family_for(category)[source]

Return the coarse family that a spending category belongs to.

Parameters:

category (SpendingCategory) – A SpendingCategory member.

Return type:

SpendingCategoryFamily

Returns:

The unique SpendingCategoryFamily containing category.

Raises:

KeyError – If category is not registered in CATEGORY_FAMILY_MEMBERS.

categories_for_family(family)[source]

Return the categories belonging to a coarse family.

Parameters:

family (SpendingCategoryFamily) – A SpendingCategoryFamily member.

Return type:

tuple[SpendingCategory, ...]

Returns:

Tuple of SpendingCategory members in the family.