Skip to content

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

  1. Create an element, or use an existing element that has no validated classifications
  2. Add a high confidence classification on this element from any worker version (not manual)
  3. Reject that classification
  4. Use ListElements, ListElementParents or ListElementChildren to find the element, and use the best_class=True and with_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.