Source code for avatars.models

# This file has been generated - DO NOT MODIFY
# API Version : 3.20.2

# generated by datamodel-codegen:
#   filename:  input.json
from __future__ import annotations

from enum import IntEnum, StrEnum
from typing import Annotated, Any, Protocol, runtime_checkable
from uuid import UUID

import pandas as pd
from pydantic import AwareDatetime, BaseModel, Field


[docs] class ApiKey(BaseModel): """Response model for an API key.""" id: Annotated[UUID, Field(title="Id")] name: Annotated[str, Field(title="Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] expires_at: Annotated[AwareDatetime, Field(title="Expires At")] revoked_at: Annotated[AwareDatetime | None, Field(title="Revoked At")] = None last_used_at: Annotated[AwareDatetime | None, Field(title="Last Used At")] = None
[docs] class ApiKeyWithPlaintext(BaseModel): """API Key response model that includes the secret for creation.""" id: Annotated[UUID, Field(title="Id")] name: Annotated[str, Field(title="Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] expires_at: Annotated[AwareDatetime, Field(title="Expires At")] revoked_at: Annotated[AwareDatetime | None, Field(title="Revoked At")] = None last_used_at: Annotated[AwareDatetime | None, Field(title="Last Used At")] = None plaintext: Annotated[str, Field(title="Plaintext")]
[docs] class BulkDeleteRequest(BaseModel): """Request model for bulk job deletion.""" job_names: Annotated[list[str], Field(max_length=100, title="Job Names")]
[docs] class CompatibilityStatus(StrEnum): compatible = "compatible" incompatible = "incompatible" unknown = "unknown"
[docs] class ConnectionDraft(BaseModel): """A connection being stored or tested. `dsn` is write-only. Every field has a default, and is checked by the service instead: a body missing a required field is echoed back whole in FastAPI's validation error -- and logged -- which for this body means the connection string. """ engine: Annotated[str | None, Field(title="Engine")] = "" label: Annotated[str | None, Field(title="Label")] = None dsn: Annotated[str | None, Field(title="Dsn")] = "" fields: Annotated[dict[str, str] | None, Field(title="Fields")] = None scope: Annotated[str | None, Field(title="Scope")] = "organization"
[docs] class ConnectionPatch(BaseModel): """What a rename or relabel changes. Absent means unchanged; there is no DSN here.""" name: Annotated[str | None, Field(title="Name")] = None label: Annotated[str | None, Field(title="Label")] = None
[docs] class ConnectionPresetRequest(BaseModel): """Which presets to add, and for whom. Strings, checked by the route, like a draft's.""" kind: Annotated[str, Field(title="Kind")] scope: Annotated[str | None, Field(title="Scope")] = "user"
[docs] class ConnectionProbe(BaseModel): """What opening one connection found. Every field is a fact about the database, never about the credential: the DSN is not in here, and neither is anything derived from it beyond the engine family, which is the DSN's scheme and not a secret. """ reachable: Annotated[bool, Field(title="Reachable")] engine: Annotated[str | None, Field(title="Engine")] = None has_schema: Annotated[bool | None, Field(title="Has Schema")] = None is_empty: Annotated[bool | None, Field(title="Is Empty")] = None table_count: Annotated[int | None, Field(title="Table Count")] = None error: Annotated[str | None, Field(title="Error")] = None
[docs] class ConnectionSample(BaseModel): """A few values of the columns asked for, never whole rows.""" samples: Annotated[dict[str, dict[str, list[str | None]]] | None, Field(title="Samples")] = ( None ) missing: Annotated[list[str] | None, Field(title="Missing")] = None error: Annotated[str | None, Field(title="Error")] = None
[docs] class ConnectionSampleRequest(BaseModel): """Which key columns to show, per table, and how many values of each.""" columns: Annotated[dict[str, list[str]], Field(max_length=10, min_length=1, title="Columns")] limit: Annotated[int | None, Field(ge=1, le=20, title="Limit")] = 5
[docs] class ConnectionScope(StrEnum): """Who declared a connection, and so who may change it.""" deployment = "deployment" organization = "organization" user = "user"
[docs] class ConnectionSummary(BaseModel): """A named connection, never its connection string.""" name: Annotated[str, Field(title="Name")] label: Annotated[str | None, Field(title="Label")] = None engine: Annotated[str, Field(title="Engine")] scope: ConnectionScope | None = ConnectionScope.deployment redacted: Annotated[str | None, Field(title="Redacted")] = None
[docs] class ExpirationDays(IntEnum): """Expiration preset in days (choose from 30/60/120/365/3650)""" integer_30 = 30 integer_60 = 60 integer_120 = 120 integer_365 = 365 integer_3650 = 3650
[docs] class CreateApiKeyRequest(BaseModel): """Request body for creating an API key.""" name: Annotated[ str, Field( description="Human-readable label for the API key", max_length=255, min_length=1, title="Name", ), ] expiration_days: Annotated[ ExpirationDays, Field( description="Expiration preset in days (choose from 30/60/120/365/3650)", title="Expiration Days", ), ]
[docs] class CreateApiKeyResponse(BaseModel): """Response for API key creation.""" api_key: ApiKeyWithPlaintext message: Annotated[str, Field(title="Message")]
[docs] class CreditsInfo(BaseModel): credits: Annotated[int | None, Field(title="Credits")] is_credit_enabled: Annotated[bool, Field(title="Is Credit Enabled")]
[docs] class DatabaseConnectionSummary(BaseModel): """A named connection, never its connection string. The name is what a job carries; the deployment resolves it. A DSN in this payload would be a password in a response body, an OpenAPI example and a browser cache. """ name: Annotated[str, Field(title="Name")] label: Annotated[str | None, Field(title="Label")] = None engine: Annotated[str, Field(title="Engine")] scope: ConnectionScope | None = ConnectionScope.deployment
[docs] class EnvironmentInfo(BaseModel): """Resolved environment values for the current user.""" dataset_expiration_days: Annotated[ int, Field( description="Number of days before a dataset expires.", title="Dataset Expiration Days", ), ] max_allowed_dimensions_per_dataset: Annotated[ int, Field( description="Maximum number of dimensions (columns) allowed per dataset.", title="Max Allowed Dimensions Per Dataset", ), ] max_allowed_lines_per_dataset: Annotated[ int, Field( description="Maximum number of rows allowed per dataset.", title="Max Allowed Lines Per Dataset", ), ] license_type: Annotated[ str | None, Field( description="License type of the user's organization. Accept any string, or null.", title="License Type", ), ] = None
[docs] class EventLogResponse(BaseModel): """A single audit-trail entry visible to the user.""" id: Annotated[UUID, Field(title="Id")] verb: Annotated[str, Field(title="Verb")] object_id: Annotated[UUID | None, Field(title="Object Id")] = None object_type: Annotated[str, Field(title="Object Type")] created_at: Annotated[AwareDatetime, Field(title="Created At")]
[docs] class FeatureScope(StrEnum): avatar_parameters = "avatar_parameters" single_table = "single_table" multi_table = "multi_table" time_series = "time_series" report = "report" geolocalization = "geolocalization" privacy_assessment = "privacy_assessment" differential_privacy = "differential_privacy" data_augmentation = "data_augmentation" database = "database" documents = "documents"
[docs] class FeaturesInfo(BaseModel): feature_scopes: Annotated[list[FeatureScope], Field(title="Feature Scopes")]
[docs] class FieldOption(BaseModel): value: Annotated[str, Field(title="Value")] label: Annotated[str, Field(title="Label")]
[docs] class FieldType(StrEnum): text = "text" number = "number" select = "select"
[docs] class FileCredentials(BaseModel): access_key_id: Annotated[str, Field(title="Access Key Id")] secret_access_key: Annotated[str, Field(title="Secret Access Key")]
[docs] class JobCreateRequest(BaseModel): set_name: Annotated[UUID, Field(title="Set Name")] parameters_name: Annotated[str, Field(title="Parameters Name")] depends_on: Annotated[list[str] | None, Field(title="Depends On")] = []
[docs] class JobCreateResponse(BaseModel): name: Annotated[str, Field(title="Name")] Location: Annotated[str, Field(title="Location")]
[docs] class JobFlowCreateRequest(BaseModel): set_name: Annotated[UUID, Field(title="Set Name")]
[docs] class JobFlowCreateResponse(BaseModel): jobs: Annotated[list[JobCreateResponse], Field(title="Jobs")]
[docs] class JobKind(StrEnum): standard = "standard" privacy_metrics = "privacy_metrics" signal_metrics = "signal_metrics" report = "report" advice = "advice" extract = "extract" schema_discovery = "schema_discovery" reference = "reference" regenerate = "regenerate"
[docs] class JobStatus(StrEnum): """Status of a job in its lifecycle. Typical happy-path order: QUEUED → CREATED → PENDING → FINISHED Error paths: PARENT_ERROR (a dependency job failed) ERROR (the job itself failed) LOST (worker disappeared) ORPHANED (worker lost contact before running) Stopped on request: CANCELLED (somebody asked; also every job that was waiting on it) DEFAULT ("") is the initial value before any status is assigned. """ queued = "queued" created = "created" orphaned = "orphaned" parent_error = "parent_error" error = "error" finished = "finished" field_ = "" pending = "pending" lost = "lost" cancelled = "cancelled"
[docs] class ObjectType(StrEnum): user = "user" job = "job" api_key = "api_key" resource = "resource" organization = "organization" file = "file" connection = "connection" field_ = ""
[docs] class PresetKind(StrEnum): """What a connection the deployment offers is for.""" demo = "demo" sample = "sample"
[docs] class ResourceSetResponse(BaseModel): set_name: Annotated[UUID, Field(title="Set Name")] display_name: Annotated[str, Field(title="Display Name")]
[docs] class SourceKind(StrEnum): """The shape of the data a connection reaches.""" sql = "sql" documents = "documents"
[docs] class UserRole(StrEnum): admin = "admin" user = "user"
[docs] class ValidationError(BaseModel): loc: Annotated[list[str | int], Field(title="Location")] msg: Annotated[str, Field(title="Message")] type: Annotated[str, Field(title="Error Type")] input: Annotated[Any | None, Field(title="Input")] = None ctx: Annotated[dict[str, Any] | None, Field(title="Context")] = None
[docs] class Verb(StrEnum): login = "login" logout = "logout" download = "download" read = "read" create = "create" update = "update" delete = "delete" cancel = "cancel" startup = "startup" test = "test"
[docs] class CapabilitiesResponse(BaseModel): input_protocols: Annotated[list[str], Field(title="Input Protocols")] database_engines: Annotated[list[str], Field(title="Database Engines")] connections: Annotated[list[DatabaseConnectionSummary], Field(title="Connections")]
[docs] class CompatibilityResponse(BaseModel): message: Annotated[str, Field(title="Message")] most_recent_compatible_client: Annotated[ str | None, Field(title="Most Recent Compatible Client") ] = None status: CompatibilityStatus
[docs] class ConnectionField(BaseModel): """One input of the form.""" key: Annotated[str, Field(title="Key")] label: Annotated[str, Field(title="Label")] type: FieldType | None = FieldType.text required: Annotated[bool | None, Field(title="Required")] = False secret: Annotated[bool | None, Field(title="Secret")] = False default: Annotated[str | None, Field(title="Default")] = None placeholder: Annotated[str | None, Field(title="Placeholder")] = None options: Annotated[list[FieldOption] | None, Field(title="Options")] = None advanced: Annotated[bool | None, Field(title="Advanced")] = False
[docs] class ConnectionList(BaseModel): connections: Annotated[list[ConnectionSummary], Field(title="Connections")]
[docs] class ConnectionPresetSummary(BaseModel): """A connection this deployment offers to add. Never its connection string.""" name: Annotated[str, Field(title="Name")] label: Annotated[str | None, Field(title="Label")] = None engine: Annotated[str, Field(title="Engine")] kind: PresetKind
[docs] class EngineDescriptor(BaseModel): """A kind of database, and the form that connects to it.""" engine: Annotated[str, Field(title="Engine")] label: Annotated[str, Field(title="Label")] kind: SourceKind available: Annotated[bool, Field(title="Available")] preview: Annotated[bool | None, Field(title="Preview")] = False fields: Annotated[list[ConnectionField], Field(title="Fields")]
[docs] class EngineList(BaseModel): engines: Annotated[list[EngineDescriptor], Field(title="Engines")]
[docs] class FileAccess(BaseModel): url: Annotated[str, Field(title="Url")] credentials: FileCredentials
[docs] class HTTPValidationError(BaseModel): detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = None
[docs] class JobResponse(BaseModel): name: Annotated[str, Field(title="Name")] set_name: Annotated[UUID, Field(title="Set Name")] parameters_name: Annotated[str, Field(title="Parameters Name")] display_name: Annotated[str, Field(title="Display Name")] created_at: Annotated[AwareDatetime, Field(title="Created At")] kind: JobKind status: JobStatus exception: Annotated[str, Field(title="Exception")] done: Annotated[bool, Field(title="Done")] progress: Annotated[float | None, Field(title="Progress")] phase: Annotated[str | None, Field(title="Phase")] = "" phase_done: Annotated[int | None, Field(title="Phase Done")] = 0 phase_total: Annotated[int | None, Field(title="Phase Total")] = 0 deleted_at: Annotated[AwareDatetime | None, Field(title="Deleted At")] = None
[docs] class JobResponseList(BaseModel): jobs: Annotated[list[JobResponse], Field(title="Jobs")]
[docs] class MeUser(BaseModel): id: Annotated[UUID, Field(title="Id")] organization_id: Annotated[UUID, Field(title="Organization Id")] email: Annotated[str, Field(title="Email")] role: UserRole | None = UserRole.user environment: EnvironmentInfo
[docs] class User(BaseModel): id: Annotated[UUID, Field(title="Id")] organization_id: Annotated[UUID, Field(title="Organization Id")] email: Annotated[str, Field(title="Email")] role: UserRole | None = UserRole.user
[docs] class BulkDeleteResponse(BaseModel): """Response model for bulk job deletion.""" deleted_jobs: Annotated[list[JobResponse], Field(title="Deleted Jobs")] failed_jobs: Annotated[list[str], Field(title="Failed Jobs")]
[docs] class ConnectionPresetList(BaseModel): presets: Annotated[list[ConnectionPresetSummary], Field(title="Presets")]
[docs] @runtime_checkable class Processor(Protocol):
[docs] def preprocess(self, df: pd.DataFrame) -> pd.DataFrame: ...
[docs] def postprocess(self, source: pd.DataFrame, dest: pd.DataFrame) -> pd.DataFrame: ...