scdata 1.0.1__tar.gz → 1.0.2__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.
Files changed (86) hide show
  1. {scdata-1.0.1/scdata.egg-info → scdata-1.0.2}/PKG-INFO +2 -2
  2. {scdata-1.0.1 → scdata-1.0.2}/requirements.txt +1 -1
  3. {scdata-1.0.1 → scdata-1.0.2}/scdata/__init__.py +1 -1
  4. {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/config.py +2 -16
  5. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/device.py +2 -0
  6. {scdata-1.0.1 → scdata-1.0.2}/scdata/models/models.py +1 -1
  7. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/test.py +27 -16
  8. {scdata-1.0.1 → scdata-1.0.2/scdata.egg-info}/PKG-INFO +2 -2
  9. {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/requires.txt +1 -1
  10. {scdata-1.0.1 → scdata-1.0.2}/setup.py +1 -1
  11. {scdata-1.0.1 → scdata-1.0.2}/LICENSE +0 -0
  12. {scdata-1.0.1 → scdata-1.0.2}/MANIFEST.in +0 -0
  13. {scdata-1.0.1 → scdata-1.0.2}/README.md +0 -0
  14. {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/__init__.py +0 -0
  15. {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/custom_logger.py +0 -0
  16. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/__init__.py +0 -0
  17. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/__init__.py +0 -0
  18. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/alphasense.py +0 -0
  19. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/baseline.py +0 -0
  20. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/formulae.py +0 -0
  21. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/geoseries.py +0 -0
  22. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/params.py +0 -0
  23. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/regression.py +0 -0
  24. {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/timeseries.py +0 -0
  25. {scdata-1.0.1 → scdata-1.0.2}/scdata/io/__init__.py +0 -0
  26. {scdata-1.0.1 → scdata-1.0.2}/scdata/io/device_api.py +0 -0
  27. {scdata-1.0.1 → scdata-1.0.2}/scdata/io/device_file.py +0 -0
  28. {scdata-1.0.1 → scdata-1.0.2}/scdata/io/model.py +0 -0
  29. {scdata-1.0.1 → scdata-1.0.2}/scdata/models/__init__.py +0 -0
  30. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/__init__.py +0 -0
  31. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/checks/__init__.py +0 -0
  32. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/checks/checks.py +0 -0
  33. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/dispersion/__init__.py +0 -0
  34. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/dispersion/dispersion.py +0 -0
  35. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/__init__.py +0 -0
  36. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/templates/sc_template.html +0 -0
  37. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/to_file.py +0 -0
  38. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/__init__.py +0 -0
  39. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/box_plot.py +0 -0
  40. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/heatmap_iplot.py +0 -0
  41. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/heatmap_plot.py +0 -0
  42. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/maps.py +0 -0
  43. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/plot_tools.py +0 -0
  44. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_dispersion_grid.py +0 -0
  45. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_iplot.py +0 -0
  46. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_plot.py +0 -0
  47. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/target_diagram.py +0 -0
  48. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dendrogram.py +0 -0
  49. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_grid.py +0 -0
  50. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_plot.py +0 -0
  51. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_uplot.py +0 -0
  52. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_iplot.py +0 -0
  53. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_plot.py +0 -0
  54. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_scatter.py +0 -0
  55. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_uplot.py +0 -0
  56. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/__init__.py +0 -0
  57. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/combine.py +0 -0
  58. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/history.py +0 -0
  59. {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/prepare.py +0 -0
  60. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/__init__.py +0 -0
  61. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/cleaning.py +0 -0
  62. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/custom_logger.py +0 -0
  63. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/date.py +0 -0
  64. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/dictmerge.py +0 -0
  65. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/find.py +0 -0
  66. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/gets.py +0 -0
  67. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/interim/example.csv +0 -0
  68. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/interim/geodata.csv +0 -0
  69. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/lazy.py +0 -0
  70. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/location.py +0 -0
  71. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/report.py +0 -0
  72. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/stats.py +0 -0
  73. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/units.py +0 -0
  74. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/example_upload_1.json +0 -0
  75. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/example_zenodo_upload.yaml +0 -0
  76. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/report.pdf +0 -0
  77. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/url_check.py +0 -0
  78. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo.py +0 -0
  79. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/README.md +0 -0
  80. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/template_zenodo_dataset.json +0 -0
  81. {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/template_zenodo_publication.json +0 -0
  82. {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/SOURCES.txt +0 -0
  83. {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/dependency_links.txt +0 -0
  84. {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/not-zip-safe +0 -0
  85. {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/top_level.txt +0 -0
  86. {scdata-1.0.1 → scdata-1.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scdata
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Analysis of sensors and time series data
5
5
  Home-page: https://github.com/fablabbcn/smartcitizen-data
6
6
  Author: oscgonfer
@@ -29,7 +29,7 @@ Requires-Dist: numpy~=1.25.2
29
29
  Requires-Dist: pandas~=2.2.2
30
30
  Requires-Dist: pydantic
31
31
  Requires-Dist: pytest
32
- Requires-Dist: PyYAML==5.3.1
32
+ Requires-Dist: PyYAML~=6.0.1
33
33
  Requires-Dist: requests
34
34
  Requires-Dist: scipy
35
35
  Requires-Dist: scikit-learn
@@ -16,7 +16,7 @@ pandas~=2.2.2
16
16
  pydantic
17
17
  pytest
18
18
  # TODO To be updated?
19
- PyYAML==5.3.1
19
+ PyYAML~=6.0.1
20
20
  requests
21
21
  scipy
22
22
  scikit-learn
@@ -3,4 +3,4 @@ from .device import Device
3
3
  from .test import Test
4
4
  from .models import Source, TestOptions, DeviceOptions, APIParams, FileParams, CSVParams
5
5
 
6
- __version__ = '1.0.1'
6
+ __version__ = '1.0.2'
@@ -38,9 +38,6 @@ class Config(object):
38
38
  if 'IPython' in sys.modules: _ipython_avail = True
39
39
  else: _ipython_avail = False
40
40
 
41
- # Returns when iterables cannot be fully processed
42
- _strict = False
43
-
44
41
  # Timeout for http requests
45
42
  _timeout = 3
46
43
  _max_http_retries = 2
@@ -51,20 +48,9 @@ class Config(object):
51
48
  ### ---------------------------------------
52
49
  ### -----------------DATA------------------
53
50
  ### ---------------------------------------
54
-
55
51
  data = {
56
- # Whether or not to reload metadata from git repo
57
- 'reload_metadata': True,
58
- # Whether or not to load or store cached data (saves time when requesting a lot of data)
59
- 'load_cached_api': True,
60
- 'store_cached_api': True,
61
- # If reloading data from the API, how much gap between the saved data and the
62
- # latest reading in the API should be ignore
63
- 'cached_data_margin': 1,
64
- # clean_na
65
- 'clean_na': None,
66
- # Ignore additional channels from API or CSV that are not in the blueprint.json
67
- 'strict_load': False
52
+ 'cached_data_margin': '10Min', # Data Margin in minutes for consecutive requests
53
+ 'reload_metadata': True # Reload metadata
68
54
  }
69
55
 
70
56
  # Maximum amount of points to load when postprocessing data
@@ -300,6 +300,7 @@ class Device(BaseModel):
300
300
  else:
301
301
  raise NotImplementedError(f'Cache needs to be a .csv file. Got {cache}.')
302
302
 
303
+ # Make request with a logical min_date
303
304
  if not cached_data.empty:
304
305
  # Update min_date
305
306
  min_date=cached_data.index[-1].tz_convert('UTC')+Timedelta(frequency)
@@ -327,6 +328,7 @@ class Device(BaseModel):
327
328
  # In principle this links both dataframes as they are unmutable
328
329
  self.data = self.handler.data
329
330
  # Wrap it all up
331
+ # TODO Avoid doing this if not needed?
330
332
  self.loaded = self.__load_wrapup__(max_amount, convert_units=convert_units, convert_names=convert_names, cached_data=cached_data)
331
333
 
332
334
  self.processed = False
@@ -3,7 +3,7 @@ from typing import Optional, List
3
3
  from datetime import datetime
4
4
 
5
5
  class TestOptions(BaseModel):
6
- cache: Optional[bool] = False
6
+ cache: Optional[bool] = True
7
7
 
8
8
  class Metric(BaseModel):
9
9
  id: Optional[int] = None
@@ -67,7 +67,6 @@ class Test(BaseModel):
67
67
 
68
68
  self.devices = TypeAdapter(List[Device]).validate_python(tj['devices'])
69
69
  self.options = TypeAdapter(TestOptions).validate_python(tj['options'])
70
- print (tj['meta'])
71
70
  self.type = tj['meta']['type']
72
71
  if self.name != tj['meta']['name']:
73
72
  raise ValueError('Name not matching')
@@ -334,20 +333,20 @@ class Test(BaseModel):
334
333
 
335
334
  return fname
336
335
 
337
- def cache(self):
338
- logger.info(f'Caching files...')
339
- for device in self.devices:
340
- logger.info(f'Caching files for {device.id}...')
336
+ # def cache(self):
337
+ # logger.info(f'Caching files...')
338
+ # for device in self.devices:
339
+ # logger.info(f'Caching files for {device.id}...')
341
340
 
342
- cached_file_path = join(self.path, 'cached')
343
- if not exists(cached_file_path):
344
- logger.info('Creating path for exporting cached data')
345
- makedirs(cached_file_path)
341
+ # cached_file_path = join(self.path, 'cached')
342
+ # if not exists(cached_file_path):
343
+ # logger.info('Creating path for exporting cached data')
344
+ # makedirs(cached_file_path)
346
345
 
347
- if device.export(cached_file_path, forced_overwrite = True, file_format = 'csv'):
348
- logger.info(f'Device {device.id} cached')
346
+ # if device.export(cached_file_path, forced_overwrite = True, file_format = 'csv'):
347
+ # logger.info(f'Device {device.id} cached')
349
348
 
350
- return all([exists(join(self.path, 'cached', f'{d.id}.csv')) for d in self.devices])
349
+ # return all([exists(join(self.path, 'cached', f'{d.id}.csv')) for d in self.devices])
351
350
 
352
351
  async def load(self):
353
352
  '''
@@ -359,17 +358,29 @@ class Test(BaseModel):
359
358
  '''
360
359
  logger.info('Loading test...')
361
360
 
361
+ if self.options.cache:
362
+ cache_dir = join(self.path, 'cached')
363
+ if not exists(cache_dir):
364
+ logger.info('Creating path for exporting cached data...')
365
+ makedirs(cache_dir)
366
+ logger.info(f'Cache will be available in: {cache_dir}')
367
+
362
368
  for device in self.devices:
363
369
  # Check for cached data
364
- cached_file_path = ''
370
+ device_cache_path = ''
365
371
  if self.options.cache:
366
372
  tentative_path = join(self.path, 'cached', f'{device.id}.csv')
367
- if exists(tentative_path): cached_file_path = tentative_path
373
+ if exists(tentative_path):
374
+ device_cache_path = tentative_path
375
+
368
376
  # Load device (no need to go async, it's fast enough)
369
- await device.load(cache=cached_file_path)
377
+ await device.load(cache=device_cache_path)
378
+
379
+ if self.options.cache:
380
+ if device.export(cache_dir, forced_overwrite = True, file_format = 'csv'):
381
+ logger.info(f'Device {device.id} cached')
370
382
 
371
383
  logger.info('Test load done')
372
- if self.options.cache: self.cache()
373
384
 
374
385
  self.loaded = all([d.loaded for d in self.devices])
375
386
  return self.loaded
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scdata
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Analysis of sensors and time series data
5
5
  Home-page: https://github.com/fablabbcn/smartcitizen-data
6
6
  Author: oscgonfer
@@ -29,7 +29,7 @@ Requires-Dist: numpy~=1.25.2
29
29
  Requires-Dist: pandas~=2.2.2
30
30
  Requires-Dist: pydantic
31
31
  Requires-Dist: pytest
32
- Requires-Dist: PyYAML==5.3.1
32
+ Requires-Dist: PyYAML~=6.0.1
33
33
  Requires-Dist: requests
34
34
  Requires-Dist: scipy
35
35
  Requires-Dist: scikit-learn
@@ -9,7 +9,7 @@ numpy~=1.25.2
9
9
  pandas~=2.2.2
10
10
  pydantic
11
11
  pytest
12
- PyYAML==5.3.1
12
+ PyYAML~=6.0.1
13
13
  requests
14
14
  scipy
15
15
  scikit-learn
@@ -19,7 +19,7 @@ REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
19
19
 
20
20
  setup(
21
21
  name='scdata',
22
- version='1.0.1',
22
+ version='1.0.2',
23
23
  description='Analysis of sensors and time series data',
24
24
  author='oscgonfer',
25
25
  license='GNU-GPL3.0',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes