Import Service
app.application.services.tracking.import_serviceTracking layer import service — loads bounding-box data into layers C or D.
See Also
IDataImporter— defines the import contractImportMode— selects how imported boxes merge with existing data
Layer: Application. Context: Coordinates domain state and infrastructure to complete application use cases.
TrackingImportService
Bases: QObject
Loads persisted bounding-box data into tracking layers C or D.
Responsibilities
- Read a JSON or CSV file produced by
TrackingExportService(or any exporter that uses the shared wire format). - Apply the chosen
ImportModemerge strategy. - Return the total number of boxes written.
Note
This service satisfies the IDataImporter interface
Protocol via structural subtyping.
Layers C/D are the tracking layers. Writing detection-source boxes
(BoxSource.DETECTION) into layer C is technically allowed by the
data store but semantically unusual — the dialog restricts this by
scoping the layer combo to C/D only.
Consider future improvement: after a successful import into layer C,
automatically trigger Application.sync_tracking_cache() so that
any downstream view model caches are refreshed without requiring the
user to manually re-run tracking.
| PARAMETER | DESCRIPTION |
|---|---|
app
|
Application used to resolve the destination session and replace imported tracking-layer data.
TYPE:
|
__init__(app: Application) -> None
import_layer(s_id: SessionId, layer: VideoDataLayer | str, file_path: str, mode: ImportMode | str) -> int
Import bounding-box data from file_path into tracking layer.
| PARAMETER | DESCRIPTION |
|---|---|
s_id
|
Target session.
TYPE:
|
layer
|
Target layer — should be
TYPE:
|
file_path
|
Absolute path to a
TYPE:
|
mode
|
Merge strategy (enum or string).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of boxes written.
TYPE:
|
Note
Accepts both VideoDataLayer enums and string layer names to handle
Qt signal/slot type coercion.