Box Io
app.shared.box_ioModule for box io; provides reusable helpers across application layers.
See Also
BBoxViewModel— the view-model shape serialized by these helpersBoxSource— source values included in serialized boxes
Layer: Shared utilities. Context: Provides reusable helpers across application layers at this architectural boundary.
box_to_dict(box: BBoxViewModel) -> dict[str, object]
Serialize a box view model to a JSON-compatible mapping.
| PARAMETER | DESCRIPTION |
|---|---|
box
|
Bounding box whose fields are serialized.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
Mapping containing the box ID, source, label, coordinates, color, confidence, and key. |
dict_to_box(data: dict[str, object]) -> BBoxViewModel
Build a box view model from its serialized fields.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Mapping with
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BBoxViewModel
|
Box view model populated from the mapping. |