framework for data gap patching knn alg