aeat.application.corpus_search._terminology module¶
Product-side reader and search over the bundled Terminology Handbook.
The Handbook concept fragments under _data/terminology/concepts/*.toml are
authored/compiled by the dev.docs.terminology_handbook dev tooling, which is
NOT shipped in the wheel. This module is the shipped, product-side consumer: a
lean strict loader that projects each concept for a requested locale and a
simple in-memory search over the small concept set.
Per the glossary-concepts-are-taxpayer-facing rule the shipped search
surfaces only approved-lifecycle concepts — the ratified taxpayer/operator
vocabulary — excluding draft (unreviewed) and deprecated (internal
machinery) concepts, which the taxpayer glossary also excludes.
See also
search_terminology()Public facade for approved-concept terminology search.
lookup_terminology()Public facade for exact concept-id lookup.
terminology_payload_from_hits()MCP transport mapper for ranked terminology hits.
- class TerminologyConcept(**data)[source]¶
Bases:
BaseModelOne Handbook concept projected for a single locale.
- Parameters:
concept_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
domain (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
lifecycle (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
locale (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
preferred_label (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
short_description (str)
definition (str)
scope_note (str | None)
- concept_id: _Text¶
- domain: _Text¶
- lifecycle: _Text¶
- locale: _Text¶
- preferred_label: _Text¶
- terms: tuple[str, ...]¶
- short_description: str¶
- definition: str¶
- scope_note: str | None¶
- legal_refs: tuple[str, ...]¶
- class TerminologyHit(**data)[source]¶
Bases:
BaseModelOne ranked terminology search result.
- Parameters:
concept_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
preferred_label (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
short_description (str)
score (int)
matched_on (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=None, ascii_only=None)])
- concept_id: _Text¶
- preferred_label: _Text¶
- short_description: str¶
- score: int¶
- matched_on: _Text¶
- load_terminology_concepts(locale='es')[source]¶
Load every Handbook concept projected for
locale(fallbackes).- Return type:
- Returns:
- Parameters:
locale (str)
- search_terminology(query, *, locale='es', limit=8, lifecycles=('approved',))[source]¶
Search the Handbook for
query, returning ranked hits.Only concepts whose lifecycle is in
lifecycles(approvedby default, the taxpayer-facing set) are considered.- Raises:
CorpusSearchInputError – If
queryis blank orlimitis not positive.- Return type:
- Returns:
- Parameters:
- lookup_terminology(concept_id, *, locale='es')[source]¶
Return one concept by id.
- Raises:
CorpusSearchInputError – If
concept_idis unknown.- Return type:
- Returns:
- Parameters: