Skip to content

DTOs

matchbox.common.dtos

Data transfer objects for Matchbox API.

Classes:

OKMessage

Bases: BaseModel

Generic HTTP OK response.

Attributes:

status class-attribute instance-attribute

status: str = Field(default='OK')

version class-attribute instance-attribute

version: str = Field(
    default_factory=lambda: version("matchbox-db")
)

BackendCountableType

Bases: StrEnum

Enumeration of supported backend countable types.

Attributes:

DATASETS class-attribute instance-attribute

DATASETS = 'datasets'

MODELS class-attribute instance-attribute

MODELS = 'models'

DATA class-attribute instance-attribute

DATA = 'data'

CLUSTERS class-attribute instance-attribute

CLUSTERS = 'clusters'

CREATES class-attribute instance-attribute

CREATES = 'creates'

MERGES class-attribute instance-attribute

MERGES = 'merges'

PROPOSES class-attribute instance-attribute

PROPOSES = 'proposes'

ModelResultsType

Bases: StrEnum

Enumeration of supported model results types.

Attributes:

PROBABILITIES class-attribute instance-attribute

PROBABILITIES = 'probabilities'

CLUSTERS class-attribute instance-attribute

CLUSTERS = 'clusters'

BackendRetrievableType

Bases: StrEnum

Enumeration of supported backend retrievable types.

Attributes:

SOURCE class-attribute instance-attribute

SOURCE = 'source'

RESOLUTION class-attribute instance-attribute

RESOLUTION = 'resolution'

BackendUploadType

Bases: StrEnum

Enumeration of supported backend upload types.

Attributes:

INDEX class-attribute instance-attribute

INDEX = 'index'

RESULTS class-attribute instance-attribute

RESULTS = 'results'

schema property

schema

Get the schema for the upload type.

ModelType

Bases: StrEnum

Enumeration of supported model types.

Attributes:

LINKER class-attribute instance-attribute

LINKER = 'linker'

DEDUPER class-attribute instance-attribute

DEDUPER = 'deduper'

ModelOperationType

Bases: StrEnum

Enumeration of supported model operations.

Attributes:

INSERT class-attribute instance-attribute

INSERT = 'insert'

UPDATE_TRUTH class-attribute instance-attribute

UPDATE_TRUTH = 'update_truth'

UPDATE_ANCESTOR_CACHE class-attribute instance-attribute

UPDATE_ANCESTOR_CACHE = 'update_ancestor_cache'

DELETE class-attribute instance-attribute

DELETE = 'delete'

ModelMetadata

Bases: BaseModel

Metadata for a model.

Attributes:

name instance-attribute

name: str

description instance-attribute

description: str

type instance-attribute

type: ModelType

left_resolution instance-attribute

left_resolution: str

right_resolution class-attribute instance-attribute

right_resolution: str | None = None

ModelAncestor

Bases: BaseModel

A model’s ancestor and its truth value.

Attributes:

name class-attribute instance-attribute

name: str = Field(
    ..., description="Name of the ancestor model"
)

truth class-attribute instance-attribute

truth: int | None = Field(
    default=None,
    description="Truth threshold value",
    ge=0,
    le=100,
    strict=True,
)

ModelOperationStatus

Bases: BaseModel

Status response for any model operation.

Methods:

Attributes:

success instance-attribute

success: bool

model_name instance-attribute

model_name: str

operation instance-attribute

operation: ModelOperationType

details class-attribute instance-attribute

details: str | None = None

status_409_examples classmethod

status_409_examples() -> dict

Examples for 409 status code.

status_500_examples classmethod

status_500_examples() -> dict

Examples for 500 status code.

CountResult

Bases: BaseModel

Response model for count results.

Attributes:

entities instance-attribute

UploadStatus

Bases: BaseModel

Response model for any file upload processes, like Source or Model results.

Methods:

Attributes:

id class-attribute instance-attribute

id: str | None = None

status instance-attribute

status: Literal[
    "ready",
    "awaiting_upload",
    "queued",
    "processing",
    "complete",
    "failed",
]

details class-attribute instance-attribute

details: str | None = None

entity class-attribute instance-attribute

entity: BackendUploadType | None = None

get_http_code

get_http_code(status: bool) -> int

Get the HTTP status code for the upload status.

status_400_examples classmethod

status_400_examples() -> dict

Examples for 400 status code.

NotFoundError

Bases: BaseModel

API error for a 404 status code.

Attributes:

details instance-attribute

details: str

entity instance-attribute