specklia 1.9.11__tar.gz → 1.9.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: specklia
3
- Version: 1.9.11
3
+ Version: 1.9.13
4
4
  Summary: Python client for Specklia, a geospatial point cloud database by Earthwave.
5
5
  Home-page: https://specklia.earthwave.co.uk/
6
6
  Author: Earthwave Ltd
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  from datetime import datetime
5
5
  import json
6
6
  import logging
7
- from typing import Dict, List, Optional, Tuple, Union
7
+ from typing import Dict, List, Literal, Optional, Tuple, Union
8
8
  import warnings
9
9
 
10
10
  from dateutil import parser
@@ -270,7 +270,8 @@ class Specklia:
270
270
  raise NotImplementedError()
271
271
 
272
272
  def add_points_to_dataset(
273
- self: Specklia, dataset_id: str, new_points: List[Dict[str, Union[Dict, gpd.GeoDataFrame]]]) -> None:
273
+ self: Specklia, dataset_id: str, new_points: List[Dict[str, Union[Dict, gpd.GeoDataFrame]]],
274
+ duplicate_source_behaviour: Literal['error', 'ignore', 'replace', 'merge'] = 'error') -> None:
274
275
  """
275
276
  Add new data to a dataset.
276
277
 
@@ -300,6 +301,12 @@ class Specklia:
300
301
  The timestamp column must contain POSIX timestamps.
301
302
  The 'geometry' column must contain Points following the (lon, lat) convention.
302
303
  The GeoDataFrame must have its CRS specified as EPSG 4326.
304
+ duplicate_source_behaviour : Literal['error', 'ignore', 'replace', 'merge']
305
+ Determines what should happen if a source already exists in the dataset:
306
+ - 'error': Throw an error.
307
+ - 'ignore': Ignore the incoming data and continue. Leave existing data unchanged.
308
+ - 'replace': Delete existing data for the source, and replace it with the incoming data.
309
+ - 'merge': Append incoming data to existing data, sharing the same source.
303
310
  """
304
311
  # serialise and upload each dataframe
305
312
  for n in new_points:
@@ -308,9 +315,15 @@ class Specklia:
308
315
  chunked_transfer.serialise_dataframe(n['gdf'])), _log)
309
316
  del n['gdf']
310
317
 
311
- response = requests.post(self.server_url + "/ingest",
312
- json={'dataset_id': dataset_id, 'new_points': new_points},
313
- headers={"Authorization": "Bearer " + self.auth_token})
318
+ response = requests.post(
319
+ self.server_url + "/ingest",
320
+ json={
321
+ 'dataset_id': dataset_id,
322
+ 'new_points': new_points,
323
+ 'duplicate_source_behaviour': duplicate_source_behaviour,
324
+ },
325
+ headers={"Authorization": "Bearer " + self.auth_token},
326
+ )
314
327
  _check_response_ok(response)
315
328
 
316
329
  _log.info('Added new data to specklia dataset ID %s.', dataset_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: specklia
3
- Version: 1.9.11
3
+ Version: 1.9.13
4
4
  Summary: Python client for Specklia, a geospatial point cloud database by Earthwave.
5
5
  Home-page: https://specklia.earthwave.co.uk/
6
6
  Author: Earthwave Ltd
@@ -104,7 +104,8 @@ def test_add_points_to_dataset(
104
104
  call('https://localhost/ingest',
105
105
  json={'dataset_id': 'dummy_dataset',
106
106
  'new_points': [
107
- {'source': {'reference': 'cheese'}, 'chunk_set_uuid': 'brian'}]},
107
+ {'source': {'reference': 'cheese'}, 'chunk_set_uuid': 'brian'}],
108
+ 'duplicate_source_behaviour': 'error'},
108
109
  headers={'Authorization': 'Bearer fake_token'})])
109
110
 
110
111
 
File without changes
File without changes
File without changes
File without changes