Data Export Interface
app.application.interfaces.data_export_interfaceProtocol interface for layer data exporters.
See Also
DetectionExportService— exports detection layersTrackingExportService— exports tracking layers
Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.
IDataExporter
Bases: Protocol
Abstraction boundary for services that serialise a session layer to a file.
Any object that exposes export_layer() with a matching signature satisfies
this interface — no explicit inheritance required (structural subtyping via
Protocol).
Note
Two concrete implementations exist:
DetectionExportService— reads from detection layers (A / B).TrackingExportService— reads from tracking layers (C / D).
The file format (JSON or CSV) is determined by the extension of
file_path and handled entirely by the concrete service; callers
do not need to be aware of the format.
Consider future improvement: add a supported_formats() -> list[str]
method to the interface so the dialog can dynamically build its format
combo box from what the service advertises, rather than hard-coding
["json", "csv"] on the UI side.
Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.
export_layer(s_id: SessionId, layer: VideoDataLayer, file_path: str) -> int
Export bounding-box data from layer for session s_id to file_path.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Source session.
TYPE:
|
layer
|
Source layer inside the session's
TYPE:
|
file_path
|
Absolute destination path. The file extension (
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of boxes written to the file.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the file extension is not recognised. |