Put the calculate_clusters function inside the populate_db view, instead of having it in its own view.