auviewer.patternset module

Class and related functionality for pattern sets.

class auviewer.patternset.PatternSet(projparent, dbmodel)[source]

Bases: object

Represents a pattern set.

addPatterns(df, validate=True)[source]

Add patterns to the pattern set. By default, the rows will be validated (e.g. for matching file ID & filename). This may be skipped in the case of extremely high volume, but it may lead to database integrity issues to do so.

During validation, if filename is present and file_id is not, then file_id will be populated according to the filename. If both are populated, then the file_id will be validated to match the filename. The provided pattern set must contain ‘file_id’ and/or ‘filename’ columns as well as [‘series’, ‘left’, ‘right’, ‘label’]. :return: None

assignToUsers(user_ids)[source]

Assign the pattern set to user(s). Idempotent. :param user_ids: May be single user ID or list of user IDs. :return: None

Parameters:

user_ids (int | List[int])

Return type:

None

delete(deletePatterns=False)[source]

Deletes the pattern set from the database and the parent project instance. If the pattern set has patterns, the deletion will fail, unless the deletePatterns flag is True, in which case it will first delete the child patterns.

deletePatterns()[source]

Delete the patterns belonging to this pattern set. :return: number of deleted patterns

Return type:

int

deleteUnannotatedPatterns()[source]

Delete all patterns which have not yet been annotated from the set. :return: number of deleted patterns

Return type:

int

getAnnotationCount()[source]

Returns a count of annotations which annotate any pattern in this set.

Return type:

int

getAnnotations()[source]

Returns a DataFrame of the annotations in this set.

Return type:

DataFrame

getPatternCount()[source]

Returns a count of the patterns in this set.

Return type:

int

getPatterns()[source]

Returns a DataFrame of the patterns in this set.

Return type:

DataFrame

refresh()[source]

Refresh model & update the count of patterns belonging to this set (this is normally an internally-used method).

setDescription(description)[source]

Set the pattern set’s description.

Parameters:

description (str)

setName(name)[source]

Set the pattern set’s name.

Parameters:

name (str)

setShowByDefault(show)[source]

Set whether a pattern set should show by default.

Parameters:

show (bool)

auviewer.patternset.getAssignmentsPayload(user_id)[source]