aeat.domain.iva._lookup module¶
Lookup helpers for IVA registry data.
lookup_rate() resolves EUMemberState and IvaRateKind
queries into IvaRateRecord records loaded by
aeat.domain.iva.load_iva_rate_table(); cite() renders
IvaCategory catalogue citations from an IvaCatalogue.
- lookup_rate(member_state, kind, on_date)[source]¶
Return the
aeat.domain.iva.IvaRateRecordmatching the supplied query.Iterates the rates registered for
member_stateinaeat.domain.iva.IVA_RATE_TABLEand returns the first record whoseaeat.domain.iva.IvaRateRecord.kindmatcheskindand whose effective window coverson_date.- Parameters:
member_state (
EUMemberState) – The EU member state whose rate is requested.kind (
IvaRateKind) – The rate tier (general / reduced / …).on_date (
date) – The effective date for the lookup.
- Return type:
- Returns:
The matching
aeat.domain.iva.IvaRateRecord.- Raises:
IvaRateNotFoundError – If no registered rate satisfies the query.
- cite(category, *, on=None, catalogue=None)[source]¶
Return the canonical citation string for
category.Uses the first
aeat.domain.iva.IvaCitationon the matching regulation as the canonical reference. The result includes a human-readable source label and the article reference so it is self-identifying when written to a log line.- Parameters:
category (
IvaCategory) – The IVA category whose canonical citation is requested.on (
date|None) – Effective date used to resolve the committed catalogue.catalogue (
IvaCatalogue|None) – Optional catalogue override.
- Return type:
- Returns:
A canonical citation string such as
"Ley 37/1992, Art. 90.Uno — <quoted_text>".- Raises:
IvaCatalogueError – If both
catalogueandonareNone.