Exemple #1
0
 def test_closest_point(self):
     params = {'distance': 0, 'filter': False}
     link_strategy = ClosestPoint(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     linked_file = App.link_closest_points(self.gf1.get_id(), self.gf2.get_id(), "name", "description", params)
     dataset_linked = linked_file.get_data()
     pd.testing.assert_frame_equal(dataset, dataset_linked)
Exemple #2
0
def link_closest_point(request, pk_a, pk_b, name, description):
    params = {'distance': 0, 'filter': False}
    linked_file = App.link_closest_points(pk_a, pk_b, name, description,
                                          params)
    [data, cols] = App.make_response_link(linked_file.get_data())
    return Response(data={
        "data": data,
        "id": linked_file.get_id(),
        "cols": cols
    },
                    status=status.HTTP_200_OK)
Exemple #3
0
def link_closest_point_filter(request, pk_a, pk_b, max_distance, name,
                              description):
    # create the strategy
    params = {'distance': max_distance / 1000, 'filter': True}
    linked_file = App.link_closest_points(pk_a, pk_b, name, description,
                                          params)
    [data, cols] = App.make_response_link(linked_file.get_data())
    return Response(data={
        "data": data,
        "id": linked_file.get_id(),
        "cols": cols
    },
                    status=status.HTTP_200_OK)