The best classes filter does not exclude rejected high confidence classes
The best class filter is supposed to include elements that have any validated classification, and elements that have any high confidence classification that was not rejected.
While looking for further optimizations on element list filters and testing indexes (#606 (closed)), I noticed that the state <> rejected
was missing from the queries. I did some tests and it turns out that with_best_classes
correctly ignores rejected high confidence classifications, but best_class
does not; it is then possible to have elements without any best class that are returned by best_class=True
, or best_class=<ID>
.
To reproduce
- Create an element, or use an existing element that has no validated classifications
- Add a high confidence classification on this element from any worker version (not manual)
- Reject that classification
- Use
ListElements
,ListElementParents
orListElementChildren
to find the element, and use thebest_class=True
andwith_best_classes=True
options.
The filter will still include this element, even though it should be excluded, and the best_classes
payload will be an empty array.