flatTuple filter code