Functions
app.domain.helpers.functionsDomain utility functions for string handling and validation.
See Also
VideoDataLayer— layer values used by detection helpersEmptySetGeneratedFromKeysError— raised for invalid empty key sets
Layer: Domain. Context: Defines application concepts independently of UI and infrastructure implementations.
str_iterable_as_set_without_null_values(iterable: Iterable[str]) -> set[str]
Convert string iterable to set, filtering falsy values.
| PARAMETER | DESCRIPTION |
|---|---|
iterable
|
Input values to clean and deduplicate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
set[str]
|
set[str]: A set containing only truthy string values from |
| RAISES | DESCRIPTION |
|---|---|
EmptySetGeneratedFromKeysError
|
If every item in |
Note
Filters out empty or otherwise falsy values, deduplicates the remaining strings by converting them to a set, and validates that at least one usable value remains.
Example
keys = ["person", "car", "", None, "person"] # With empties result = str_iterable_as_set_without_null_values(keys)
→ {"person", "car"} (deduplicated, cleaned)
empty_keys = ["", "", ""] result = str_iterable_as_set_without_null_values(empty_keys)
→ EmptySetGeneratedFromKeysError (all were falsy)
map_detections_to_bbox(detections: list[DetectionResult]) -> ListOfBoxes
Maps a list of DetectionResult objects to a list of BBoxViewModel objects for UI display.
Note
DetectionResult ≡ BBoxViewModel But,
BBoxViewModel is used for UI representation and,
includes literal attributes source and key.
| PARAMETER | DESCRIPTION |
|---|---|
detections
|
List of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ListOfBoxes
|
List of |
new_passes_filter(layer_name: VideoDataLayer, box: BBoxViewModel, settings: ProcessingSettings) -> bool
Determines if a detection item passes the filter criteria for Layer B/D based on confidence and label settings.
Filter Criteria
- Confidence: The detection's confidence must be greater than or equal to the minimum detection confidence.
- Label: If specific labels are chosen, the detection's label must be in the chosen labels list.
| PARAMETER | DESCRIPTION |
|---|---|
layer_name
|
The layer name for which the filter is applied.
TYPE:
|
box
|
The detection item to be evaluated.
TYPE:
|
settings
|
The processing settings containing filter criteria.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the detection passes the filter, False otherwise.
TYPE:
|