smartem_backend.model.database#

Members

Acquisition

AgentConnection

Tracks active SSE connections from agents.

AgentInstruction

Represents instructions sent to microscopy agents with full lifecycle tracking.

AgentInstructionAcknowledgement

Stores the history of instruction acknowledgements from agents.

AgentSession

Represents a microscopy session conducted by an agent.

Atlas

AtlasTile

AtlasTileGridSquarePosition

CurrentQualityPrediction

CurrentQualityPredictionModelWeight

FoilHole

Grid

GridSquare

Micrograph

OverallQualityPrediction

QualityMetric

QualityMetricStatistics

QualityPrediction

QualityPredictionModel

QualityPredictionModelParameter

QualityPredictionModelWeight

main

class smartem_backend.model.database.AgentSession(*, id: int | None = None, session_id: str, agent_id: str, acquisition_uuid: str | None = None, name: str | None = None, description: str | None = None, experimental_parameters: dict | None = None, status: str = 'active', created_at: ~datetime.datetime = <factory>, started_at: ~datetime.datetime | None = None, ended_at: ~datetime.datetime | None = None, last_activity_at: ~datetime.datetime = <factory>)[source]#

Represents a microscopy session conducted by an agent. Sessions group related instructions and provide experimental context. Backend-originated entity using BIGSERIAL primary key for scalability.

class smartem_backend.model.database.AgentInstruction(*, id: int | None = None, instruction_id: str, session_id: str, agent_id: str, instruction_type: str, payload: dict, sequence_number: int | None = None, priority: str = 'normal', status: str = 'pending', created_at: ~datetime.datetime = <factory>, sent_at: ~datetime.datetime | None = None, acknowledged_at: ~datetime.datetime | None = None, expires_at: ~datetime.datetime | None = None, retry_count: int = 0, max_retries: int = 3, instruction_metadata: dict | None = None)[source]#

Represents instructions sent to microscopy agents with full lifecycle tracking. Instructions contain the command payload and track delivery/acknowledgement status. Backend-originated entity using BIGSERIAL primary key for scalability.

class smartem_backend.model.database.AgentConnection(*, id: int | None = None, connection_id: str, session_id: str, agent_id: str, connection_type: str = 'sse', client_info: dict | None = None, status: str = 'active', created_at: ~datetime.datetime = <factory>, last_heartbeat_at: ~datetime.datetime = <factory>, closed_at: ~datetime.datetime | None = None, close_reason: str | None = None)[source]#

Tracks active SSE connections from agents. Used for connection health monitoring and cleanup. Backend-originated entity using BIGSERIAL primary key for scalability.

class smartem_backend.model.database.AgentInstructionAcknowledgement(*, acknowledgement_id: str, instruction_id: str, agent_id: str, session_id: str, status: str, result: str | None = None, error_message: str | None = None, processing_time_ms: int | None = None, acknowledgement_metadata: dict | None = None, created_at: ~datetime.datetime = <factory>, processed_at: ~datetime.datetime | None = None)[source]#

Stores the history of instruction acknowledgements from agents. Provides audit trail for instruction processing and scientific reproducibility. Agent-originated entity using UUID primary key for distributed creation.