sanitize_data_item
FunctionSource
sanitized_item: AnnoItem | None = sanitize_data_item(data_item: AnnoItem | AnnoMark)
Perform the full sanitization on an annotation item.
The sanitization will ensure that:
- The result is a dictionary typed by
AnnoItem
. - A
None
value comment will be removed. - The position of the annotation mark will always have positive width and height. (Negative values means that the starting location is reversed.)
- If no ID is specified, will return a randomly generated 6-character ID.
Aliases
This function can be acquired by
import dash_picture_annotation as dpa
dpa.sanitize_data_item
dpa.utilities.sanitize_data_item
Arguments
Requires
Argument | Type | Required | |
---|---|---|---|
data_item | AnnoItem | AnnoMark | The annotation item data to be sanitized. If the data_item is just a mark, will add ID for it. |
Returns
Argument | Type | |
---|---|---|
sanitized_item | AnnoItem | None | The sanitized copy of the data item. Will return None if the given data cannot be sanitized. |