Data Import Interface
app.application.interfaces.data_import_interfaceProtocol interface for layer data importers.
See Also
DetectionImportService— imports detection layersTrackingImportService— imports tracking layers
Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.
IDataImporter
Bases: Protocol
Abstraction boundary for services that load bounding-box data from a file into a session layer.
Any object that exposes import_layer() with a matching signature satisfies
this interface — no explicit inheritance is required (structural subtyping via
Protocol).
Note
Two concrete implementations exist:
DetectionImportService— targets detection layers (A / B).TrackingImportService— targets tracking layers (C / D).
Both share the same wire-format logic from
app.application.services.helpers.layer_io so the file produced by one
can be read back by the other (cross-layer import is intentionally
supported by the dialog).
Consider future improvement: add a validate_file(file_path) -> bool
method to the interface so callers can dry-run schema validation before
committing to the import.
Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.
import_layer(s_id: SessionId, layer: VideoDataLayer, file_path: str, mode: ImportMode | str) -> int
Import bounding-box data from file_path into layer for s_id.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Target session.
TYPE:
|
layer
|
Target layer inside the session's
TYPE:
|
file_path
|
Absolute path to a
TYPE:
|
mode
|
Merge strategy — accepts enum or string and is coerced
to
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of boxes actually written into the layer.
TYPE:
|