Skip to content

Application Interface

app.application.interfaces.application_interface

View source code

Interface contract for session repository / session access.

See Also

Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.

UIApplicationInterface

Bases: Protocol

Abstraction boundary for accessing and managing sessions.

Services and managers depend on this interface rather than directly importing the concrete Application class, keeping the application layer decoupled from the top-level façade.

The concrete Application class satisfies this interface structurally (structural subtyping via Protocol) — no explicit inheritance needed. The AppApplicationAdapter provides an explicit wrapper when explicit type evidence is preferred.

Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.

active_session: Session | None property

Retrieve the currently active Session instance, or None if no session is active.

RETURNS DESCRIPTION
Session | None

The active session, or None if there is no active session.

active_session_id: SessionId | None property

Return the SessionId of the currently active session, or None.

RETURNS DESCRIPTION
SessionId | None

The active session identifier, or None if none is active.

all_s_ids: Iterable[SessionId] property

Iterate over all SessionId instances currently managed by the application.

RETURNS DESCRIPTION
Iterable[SessionId]

Identifiers for sessions currently managed by the application.

get_layer_box_by_key(s_id: SessionId, layer_name: VideoDataLayer, key: str) -> BBoxViewModel | None

Fetch a single bounding detection by its unique key from layer_name.

PARAMETER DESCRIPTION
s_id

Identifier of the session containing the box.

TYPE: SessionId

layer_name

Data layer in which to search.

TYPE: VideoDataLayer

key

Unique box key to match.

TYPE: str

RETURNS DESCRIPTION
BBoxViewModel | None

Matching box view model, or None if the layer has no box with this key.

get_selected_detection_model_name(s_id: SessionId) -> str

Retrieve the name of the currently selected detection model for s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose configured model name is returned.

TYPE: SessionId

RETURNS DESCRIPTION
str

Name of the selected detection model.

get_session_by_id(s_id: SessionId) -> Session

Fetch the Session instance identified by s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session to return.

TYPE: SessionId

RETURNS DESCRIPTION
Session

The session identified by s_id.

get_tab_frame_boxes_for_session_id(s_id: SessionId, tab: VideoDataLayerGroup) -> FrameBoxesViewModel

Retrieve all bounding boxes for the current frame in the specified tab layer.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose current frame is queried.

TYPE: SessionId

tab

Detection or tracking tab selecting its editable box layer.

TYPE: VideoDataLayerGroup

RETURNS DESCRIPTION
FrameBoxesViewModel

Frame-box view model for the selected tab and current frame.

is_at_last_frame(s_id: SessionId) -> bool

Check if the playback position for s_id is at the final frame.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose playback position is checked.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True when playback is positioned at the final frame.

is_session_playing(s_id: SessionId) -> bool

Check if the Session identified by s_id is currently playing.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose playback state is inspected.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True while the session's playback state is active.

open_videos(paths: Iterable[str]) -> list[str]

Create new Session instances from video files at the given paths.

PARAMETER DESCRIPTION
paths

Video file paths to open.

TYPE: Iterable[str]

RETURNS DESCRIPTION
list[str]

Paths of videos opened successfully; already-open paths are excluded.

session_has_buffered_frame(s_id: SessionId) -> bool

Check if a pre-decoded frame is available in the buffer for s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose decode buffer is inspected.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True when the session's decode buffer contains a readable frame.

session_has_running_detection_worker(s_id: SessionId) -> bool

Check if a DetectionWorker is actively running for s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose detection worker state is queried.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True when a detection worker is running.

session_has_running_tracking_worker(s_id: SessionId) -> bool

Check if a TrackingWorker is actively running for s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose tracking worker state is queried.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True when a tracking worker is running.

session_is_ready_for_export(s_id: SessionId) -> bool

Check if the session s_id has valid tracking data and is ready to export.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose tracking data is checked for export.

TYPE: SessionId

RETURNS DESCRIPTION
bool

True when the session has tracking data that can be exported.