aeat.domain.user_profile._schema module

Strict Pydantic records for the centralized user-profile schema.

Each schema section declares a SensitivityClass that governs the encryption tier applied when the section’s data is persisted to the secure DB backend.

class ProfileFieldType(*values)[source]

Bases: StrEnum

Closed catalogue of field types allowed by the profile schema TOML.

STRING
BOOLEAN
INTEGER
DECIMAL
MONEY
DATE
EMAIL
ENUM
ARRAY
OBJECT
class ProfileSnapshotPolicy(*values)[source]

Bases: StrEnum

Accepted profile snapshot stale-check policies.

IMMUTABLE_SECURE_SNAPSHOT_HASH
class ProfileRemovePolicy(*values)[source]

Bases: StrEnum

Accepted profile removal policies.

LIVE_PROFILE_TOMBSTONE_RETAIN_SNAPSHOTS
class ProfileFieldDefinition(**data)[source]

Bases: BaseModel

One field declared inside a user-profile schema section.

Parameters:
  • key (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=64, pattern=^[a-z][a-z0-9_]*$, ascii_only=None)])

  • type (ProfileFieldType)

  • required (bool)

  • nullable (bool)

  • sensitivity (SensitivityClass)

  • effective_dated (bool)

  • description (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=512, pattern=None, ascii_only=None)])

  • enum_values (tuple[str, ...])

  • model_selectors (tuple[Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=256, pattern=None, ascii_only=None)], ...])

  • export_headers (tuple[Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=256, pattern=None, ascii_only=None)], ...])

  • schedule_predicates (tuple[Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=256, pattern=None, ascii_only=None)], ...])

  • legal_refs (tuple[Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=512, pattern=None, ascii_only=None)], ...])

  • minimum (Decimal | None)

  • maximum (Decimal | None)

key: _FieldKey
type: ProfileFieldType
required: bool
nullable: bool
sensitivity: SensitivityClass
effective_dated: bool
description: _Description
enum_values: tuple[str, ...]
model_selectors: tuple[_Selector, ...]
export_headers: tuple[_Selector, ...]
schedule_predicates: tuple[_Selector, ...]
legal_refs: tuple[_Description, ...]
minimum: Decimal | None
maximum: Decimal | None
class ProfileSectionDefinition(**data)[source]

Bases: BaseModel

A top-level section in the user-profile schema.

Parameters:
  • key (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=64, pattern=^[a-z][a-z0-9_]*$, ascii_only=None)])

  • title (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=512, pattern=None, ascii_only=None)])

  • sensitivity (SensitivityClass)

  • effective_dated (bool)

  • repeatable (bool)

  • fields (tuple[ProfileFieldDefinition, ...])

key: _SectionKey
title: _Description
sensitivity: SensitivityClass
effective_dated: bool
repeatable: bool
fields: tuple[ProfileFieldDefinition, ...]
class ProfileSchemaDefinition(**data)[source]

Bases: BaseModel

The committed centralized user-profile schema.

Parameters:
  • id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=128, pattern=^[a-z][a-z0-9_.-]*$, ascii_only=None)])

  • version (int)

  • title (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=512, pattern=None, ascii_only=None)])

  • snapshot_policy (ProfileSnapshotPolicy)

  • remove_policy (ProfileRemovePolicy)

  • sections (tuple[ProfileSectionDefinition, ...])

id: _SchemaId
version: int
title: _Description
snapshot_policy: ProfileSnapshotPolicy
remove_policy: ProfileRemovePolicy
sections: tuple[ProfileSectionDefinition, ...]
property field_paths: tuple[str, ...]

Canonical dotted field paths declared by the schema.

section(key)[source]

Return a ProfileSectionDefinition by canonical section key.

Return type:

ProfileSectionDefinition

Parameters:

key (str)

field(path)[source]

Return a field by canonical dotted path.

Return type:

ProfileFieldDefinition

Returns:

The ProfileFieldDefinition for the given path.

Parameters:

path (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=3, max_length=160, pattern=^[a-z][a-z0-9_]*(?:\.[a-z0-9_]+)+$, ascii_only=None)])