hydroserverpy 0.4.0__py3-none-any.whl → 0.5.0b1__py3-none-any.whl

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.

Potentially problematic release.


This version of hydroserverpy might be problematic. Click here for more details.

Files changed (65) hide show
  1. hydroserverpy/__init__.py +2 -3
  2. hydroserverpy/api/http.py +24 -0
  3. hydroserverpy/api/main.py +152 -0
  4. hydroserverpy/api/models/__init__.py +18 -0
  5. hydroserverpy/api/models/base.py +74 -0
  6. hydroserverpy/api/models/etl/__init__.py +0 -0
  7. hydroserverpy/api/models/iam/__init__.py +0 -0
  8. hydroserverpy/api/models/iam/account.py +12 -0
  9. hydroserverpy/api/models/iam/collaborator.py +34 -0
  10. hydroserverpy/api/models/iam/role.py +10 -0
  11. hydroserverpy/api/models/iam/workspace.py +203 -0
  12. hydroserverpy/api/models/sta/__init__.py +0 -0
  13. hydroserverpy/api/models/sta/datastream.py +336 -0
  14. hydroserverpy/api/models/sta/observed_property.py +72 -0
  15. hydroserverpy/api/models/sta/processing_level.py +50 -0
  16. hydroserverpy/api/models/sta/result_qualifier.py +49 -0
  17. hydroserverpy/api/models/sta/sensor.py +105 -0
  18. hydroserverpy/api/models/sta/thing.py +217 -0
  19. hydroserverpy/api/models/sta/unit.py +49 -0
  20. hydroserverpy/api/services/__init__.py +8 -0
  21. hydroserverpy/api/services/base.py +92 -0
  22. hydroserverpy/api/services/etl/__init__.py +0 -0
  23. hydroserverpy/api/services/iam/__init__.py +0 -0
  24. hydroserverpy/api/services/iam/workspace.py +126 -0
  25. hydroserverpy/api/services/sta/__init__.py +0 -0
  26. hydroserverpy/api/services/sta/datastream.py +354 -0
  27. hydroserverpy/api/services/sta/observed_property.py +98 -0
  28. hydroserverpy/api/services/sta/processing_level.py +78 -0
  29. hydroserverpy/api/services/sta/result_qualifier.py +74 -0
  30. hydroserverpy/api/services/sta/sensor.py +116 -0
  31. hydroserverpy/api/services/sta/thing.py +188 -0
  32. hydroserverpy/api/services/sta/unit.py +82 -0
  33. hydroserverpy/etl/loaders/hydroserver_loader.py +1 -1
  34. hydroserverpy/etl_csv/hydroserver_etl_csv.py +1 -1
  35. {hydroserverpy-0.4.0.dist-info → hydroserverpy-0.5.0b1.dist-info}/METADATA +4 -3
  36. hydroserverpy-0.5.0b1.dist-info/RECORD +59 -0
  37. {hydroserverpy-0.4.0.dist-info → hydroserverpy-0.5.0b1.dist-info}/WHEEL +1 -1
  38. hydroserverpy/core/endpoints/__init__.py +0 -9
  39. hydroserverpy/core/endpoints/base.py +0 -146
  40. hydroserverpy/core/endpoints/data_loaders.py +0 -93
  41. hydroserverpy/core/endpoints/data_sources.py +0 -93
  42. hydroserverpy/core/endpoints/datastreams.py +0 -225
  43. hydroserverpy/core/endpoints/observed_properties.py +0 -111
  44. hydroserverpy/core/endpoints/processing_levels.py +0 -111
  45. hydroserverpy/core/endpoints/result_qualifiers.py +0 -111
  46. hydroserverpy/core/endpoints/sensors.py +0 -111
  47. hydroserverpy/core/endpoints/things.py +0 -261
  48. hydroserverpy/core/endpoints/units.py +0 -111
  49. hydroserverpy/core/schemas/__init__.py +0 -9
  50. hydroserverpy/core/schemas/base.py +0 -124
  51. hydroserverpy/core/schemas/data_loaders.py +0 -73
  52. hydroserverpy/core/schemas/data_sources.py +0 -223
  53. hydroserverpy/core/schemas/datastreams.py +0 -330
  54. hydroserverpy/core/schemas/observed_properties.py +0 -43
  55. hydroserverpy/core/schemas/processing_levels.py +0 -31
  56. hydroserverpy/core/schemas/result_qualifiers.py +0 -26
  57. hydroserverpy/core/schemas/sensors.py +0 -68
  58. hydroserverpy/core/schemas/things.py +0 -346
  59. hydroserverpy/core/schemas/units.py +0 -29
  60. hydroserverpy/core/service.py +0 -200
  61. hydroserverpy-0.4.0.dist-info/RECORD +0 -51
  62. /hydroserverpy/{core → api}/__init__.py +0 -0
  63. {hydroserverpy-0.4.0.dist-info → hydroserverpy-0.5.0b1.dist-info/licenses}/LICENSE +0 -0
  64. {hydroserverpy-0.4.0.dist-info → hydroserverpy-0.5.0b1.dist-info}/top_level.txt +0 -0
  65. {hydroserverpy-0.4.0.dist-info → hydroserverpy-0.5.0b1.dist-info}/zip-safe +0 -0
@@ -0,0 +1,116 @@
1
+ from typing import Optional, Union, List, TYPE_CHECKING
2
+ from uuid import UUID
3
+ from ..base import SensorThingsService
4
+ from hydroserverpy.api.models import Sensor
5
+
6
+
7
+ if TYPE_CHECKING:
8
+ from hydroserverpy import HydroServer
9
+ from hydroserverpy.api.models import Workspace
10
+
11
+
12
+ class SensorService(SensorThingsService):
13
+ def __init__(self, connection: "HydroServer"):
14
+ self._model = Sensor
15
+ self._api_route = "api/data"
16
+ self._endpoint_route = "sensors"
17
+ self._sta_route = "api/sensorthings/v1.1/Sensors"
18
+
19
+ super().__init__(connection)
20
+
21
+ def list(
22
+ self,
23
+ workspace: Optional[Union["Workspace", UUID, str]] = None,
24
+ page: int = 1,
25
+ page_size: int = 100,
26
+ ) -> List["Sensor"]:
27
+ """Fetch a collection of sensors."""
28
+
29
+ params = {"$top": page_size, "$skip": page_size * (page - 1)}
30
+
31
+ if workspace:
32
+ params["$filter"] = (
33
+ f"properties/workspace/id eq '{str(getattr(workspace, 'uid', workspace))}'"
34
+ )
35
+
36
+ return super()._list(params=params)
37
+
38
+ def get(
39
+ self, uid: Union[UUID, str], fetch_by_datastream_uid: bool = False
40
+ ) -> "Sensor":
41
+ """Get a sensor by ID."""
42
+
43
+ return self._get(
44
+ uid=str(uid),
45
+ path=(
46
+ f"api/sensorthings/v1.1/Datastreams('{str(uid)}')/Sensor"
47
+ if fetch_by_datastream_uid
48
+ else None
49
+ ),
50
+ )
51
+
52
+ def create(
53
+ self,
54
+ workspace: Union["Workspace", UUID, str],
55
+ name: str,
56
+ description: str,
57
+ encoding_type: str,
58
+ method_type: str,
59
+ manufacturer: Optional[str] = None,
60
+ sensor_model: Optional[str] = None,
61
+ sensor_model_link: Optional[str] = None,
62
+ method_link: Optional[str] = None,
63
+ method_code: Optional[str] = None,
64
+ ) -> "Sensor":
65
+ """Create a new sensor."""
66
+
67
+ kwargs = {
68
+ "name": name,
69
+ "description": description,
70
+ "encodingType": encoding_type,
71
+ "methodType": method_type,
72
+ "manufacturer": manufacturer,
73
+ "model": sensor_model,
74
+ "modelLink": sensor_model_link,
75
+ "methodLink": method_link,
76
+ "methodCode": method_code,
77
+ "workspaceId": str(getattr(workspace, "uid", workspace)),
78
+ }
79
+
80
+ return super()._create(**kwargs)
81
+
82
+ def update(
83
+ self,
84
+ uid: Union[UUID, str],
85
+ name: str = ...,
86
+ description: str = ...,
87
+ encoding_type: str = ...,
88
+ method_type: str = ...,
89
+ manufacturer: Optional[str] = ...,
90
+ sensor_model: Optional[str] = ...,
91
+ sensor_model_link: Optional[str] = ...,
92
+ method_link: Optional[str] = ...,
93
+ method_code: Optional[str] = ...,
94
+ ) -> "Sensor":
95
+ """Update a sensor."""
96
+
97
+ kwargs = {
98
+ "name": name,
99
+ "description": description,
100
+ "encodingType": encoding_type,
101
+ "methodType": method_type,
102
+ "manufacturer": manufacturer,
103
+ "model": sensor_model,
104
+ "modelLink": sensor_model_link,
105
+ "methodLink": method_link,
106
+ "methodCode": method_code,
107
+ }
108
+
109
+ return super()._update(
110
+ uid=str(uid), **{k: v for k, v in kwargs.items() if v is not ...}
111
+ )
112
+
113
+ def delete(self, uid: Union[UUID, str]) -> None:
114
+ """Delete a sensor."""
115
+
116
+ super()._delete(uid=str(uid))
@@ -0,0 +1,188 @@
1
+ import json
2
+ from typing import TYPE_CHECKING, Union, IO, List, Dict, Optional
3
+ from uuid import UUID
4
+ from ..base import SensorThingsService
5
+ from hydroserverpy.api.models import Thing
6
+
7
+
8
+ if TYPE_CHECKING:
9
+ from hydroserverpy import HydroServer
10
+ from hydroserverpy.api.models import Workspace
11
+
12
+
13
+ class ThingService(SensorThingsService):
14
+ def __init__(self, connection: "HydroServer"):
15
+ self._model = Thing
16
+ self._api_route = "api/data"
17
+ self._endpoint_route = "things"
18
+ self._sta_route = "api/sensorthings/v1.1/Things"
19
+
20
+ super().__init__(connection)
21
+
22
+ def list(
23
+ self,
24
+ workspace: Optional[Union["Workspace", UUID, str]] = None,
25
+ page: int = 1,
26
+ page_size: int = 100,
27
+ ) -> List["Thing"]:
28
+ """Fetch a collection of things."""
29
+
30
+ params = {
31
+ "$top": page_size,
32
+ "$skip": page_size * (page - 1),
33
+ "$expand": "Locations",
34
+ }
35
+
36
+ if workspace:
37
+ params["$filter"] = (
38
+ f"properties/workspace/id eq '{str(getattr(workspace, 'uid', workspace))}'"
39
+ )
40
+
41
+ return super()._list(params=params)
42
+
43
+ def get(
44
+ self, uid: Union[UUID, str], fetch_by_datastream_uid: bool = False
45
+ ) -> "Thing":
46
+ """Get a thing by ID."""
47
+
48
+ params = {"$expand": "Locations"}
49
+ return self._get(
50
+ uid=str(uid),
51
+ path=(
52
+ f"api/sensorthings/v1.1/Datastreams('{str(uid)}')/Thing"
53
+ if fetch_by_datastream_uid
54
+ else None
55
+ ),
56
+ params=params,
57
+ )
58
+
59
+ def create(
60
+ self,
61
+ workspace: Union["Workspace", UUID, str],
62
+ name: str,
63
+ description: str,
64
+ sampling_feature_type: str,
65
+ sampling_feature_code: str,
66
+ site_type: str,
67
+ is_private: False,
68
+ latitude: float,
69
+ longitude: float,
70
+ elevation_m: Optional[float] = None,
71
+ elevation_datum: Optional[str] = None,
72
+ state: Optional[str] = None,
73
+ county: Optional[str] = None,
74
+ country: Optional[str] = None,
75
+ data_disclaimer: Optional[str] = None,
76
+ ) -> "Thing":
77
+ """Create a new thing."""
78
+
79
+ kwargs = {
80
+ "name": name,
81
+ "description": description,
82
+ "samplingFeatureType": sampling_feature_type,
83
+ "samplingFeatureCode": sampling_feature_code,
84
+ "siteType": site_type,
85
+ "isPrivate": is_private,
86
+ "latitude": latitude,
87
+ "longitude": longitude,
88
+ "elevation_m": elevation_m,
89
+ "elevationDatum": elevation_datum,
90
+ "state": state,
91
+ "county": county,
92
+ "country": country,
93
+ "dataDisclaimer": data_disclaimer,
94
+ "workspaceId": str(getattr(workspace, "uid", workspace)),
95
+ }
96
+
97
+ return super()._create(**kwargs)
98
+
99
+ def update(
100
+ self,
101
+ uid: Union[UUID, str],
102
+ name: str = ...,
103
+ description: str = ...,
104
+ sampling_feature_type: str = ...,
105
+ sampling_feature_code: str = ...,
106
+ site_type: str = ...,
107
+ is_private: False = ...,
108
+ latitude: float = ...,
109
+ longitude: float = ...,
110
+ elevation_m: Optional[float] = ...,
111
+ elevation_datum: Optional[str] = ...,
112
+ state: Optional[str] = ...,
113
+ county: Optional[str] = ...,
114
+ country: Optional[str] = ...,
115
+ data_disclaimer: Optional[str] = ...,
116
+ ) -> "Thing":
117
+ """Update a thing."""
118
+
119
+ kwargs = {
120
+ "name": name,
121
+ "description": description,
122
+ "samplingFeatureType": sampling_feature_type,
123
+ "samplingFeatureCode": sampling_feature_code,
124
+ "siteType": site_type,
125
+ "isPrivate": is_private,
126
+ "latitude": latitude,
127
+ "longitude": longitude,
128
+ "elevation_m": elevation_m,
129
+ "elevationDatum": elevation_datum,
130
+ "state": state,
131
+ "county": county,
132
+ "country": country,
133
+ "dataDisclaimer": data_disclaimer,
134
+ }
135
+
136
+ return super()._update(
137
+ uid=str(uid), **{k: v for k, v in kwargs.items() if v is not ...}
138
+ )
139
+
140
+ def delete(self, uid: Union[UUID, str]) -> None:
141
+ """Delete a thing."""
142
+
143
+ super()._delete(uid=str(uid))
144
+
145
+ def add_tag(self, uid: Union[UUID, str], key: str, value: str) -> Dict[str, str]:
146
+ """Tag a HydroServer thing."""
147
+
148
+ return self._connection.request(
149
+ "post",
150
+ f"{self._api_route}/{self._endpoint_route}/{str(uid)}/tags",
151
+ data=json.dumps({"key": key, "value": value}),
152
+ ).json()
153
+
154
+ def update_tag(self, uid: Union[UUID, str], key: str, value: str) -> Dict[str, str]:
155
+ """Update the tag of a HydroServer thing."""
156
+
157
+ return self._connection.request(
158
+ "put",
159
+ f"{self._api_route}/{self._endpoint_route}/{str(uid)}/tags",
160
+ data=json.dumps({"key": key, "value": value}),
161
+ ).json()
162
+
163
+ def delete_tag(self, uid: Union[UUID, str], key: str) -> None:
164
+ """Remove a tag from a HydroServer thing."""
165
+
166
+ self._connection.request(
167
+ "delete",
168
+ f"{self._api_route}/{self._endpoint_route}/{str(uid)}/tags",
169
+ data=json.dumps({"key": key}),
170
+ )
171
+
172
+ def add_photo(self, uid: Union[UUID, str], file: IO[bytes]) -> Dict[str, str]:
173
+ """Add a photo of a HydroServer thing."""
174
+
175
+ return self._connection.request(
176
+ "post",
177
+ f"{self._api_route}/{self._endpoint_route}/{str(uid)}/photos",
178
+ files={"file": file},
179
+ ).json()
180
+
181
+ def delete_photo(self, uid: Union[UUID, str], name: str) -> None:
182
+ """Delete a photo of a HydroServer thing."""
183
+
184
+ self._connection.request(
185
+ "delete",
186
+ f"{self._api_route}/{self._endpoint_route}/{str(uid)}/photos",
187
+ data=json.dumps({"name": name}),
188
+ )
@@ -0,0 +1,82 @@
1
+ from typing import Optional, Union, List, TYPE_CHECKING
2
+ from uuid import UUID
3
+ from ..base import EndpointService
4
+ from hydroserverpy.api.models import Unit
5
+
6
+
7
+ if TYPE_CHECKING:
8
+ from hydroserverpy import HydroServer
9
+ from hydroserverpy.api.models import Workspace
10
+
11
+
12
+ class UnitService(EndpointService):
13
+ def __init__(self, connection: "HydroServer"):
14
+ self._model = Unit
15
+ self._api_route = "api/data"
16
+ self._endpoint_route = "units"
17
+
18
+ super().__init__(connection)
19
+
20
+ def list(
21
+ self,
22
+ workspace: Optional[Union["Workspace", UUID, str]] = None,
23
+ ) -> List["Unit"]:
24
+ """Fetch a collection of units."""
25
+
26
+ workspace_id = getattr(workspace, "uid", workspace)
27
+ workspace_id = str(workspace_id) if workspace_id else None
28
+
29
+ return super()._list(
30
+ params={"workspace_id": workspace_id} if workspace_id else {},
31
+ )
32
+
33
+ def get(self, uid: Union[UUID, str]) -> "Unit":
34
+ """Get a unit by ID."""
35
+
36
+ return super()._get(uid=str(uid))
37
+
38
+ def create(
39
+ self,
40
+ workspace: Union["Workspace", UUID, str],
41
+ name: str,
42
+ symbol: str,
43
+ definition: str,
44
+ unit_type: str,
45
+ ) -> "Unit":
46
+ """Create a new unit."""
47
+
48
+ kwargs = {
49
+ "name": name,
50
+ "symbol": symbol,
51
+ "definition": definition,
52
+ "type": unit_type,
53
+ "workspaceId": str(getattr(workspace, "uid", workspace)),
54
+ }
55
+
56
+ return super()._create(**kwargs)
57
+
58
+ def update(
59
+ self,
60
+ uid: Union[UUID, str],
61
+ name: str = ...,
62
+ symbol: str = ...,
63
+ definition: str = ...,
64
+ unit_type: str = ...,
65
+ ) -> "Unit":
66
+ """Update a unit."""
67
+
68
+ kwargs = {
69
+ "name": name,
70
+ "symbol": symbol,
71
+ "definition": definition,
72
+ "type": unit_type,
73
+ }
74
+
75
+ return super()._update(
76
+ uid=str(uid), **{k: v for k, v in kwargs.items() if v is not ...}
77
+ )
78
+
79
+ def delete(self, uid: Union[UUID, str]) -> None:
80
+ """Delete a unit."""
81
+
82
+ super()._delete(uid=str(uid))
@@ -1,4 +1,4 @@
1
- from hydroserverpy.core.service import HydroServer
1
+ from hydroserverpy import HydroServer
2
2
  from typing import Dict, Optional
3
3
  from .base import Loader
4
4
  import logging
@@ -10,7 +10,7 @@ from .exceptions import HeaderParsingError, TimestampParsingError
10
10
  import warnings
11
11
 
12
12
  if TYPE_CHECKING:
13
- from ..core.schemas import DataSource
13
+ from hydroserverpy_old.core.schemas import DataSource
14
14
 
15
15
  logger = logging.getLogger("hydroserver_etl")
16
16
  logger.addHandler(logging.NullHandler())
@@ -1,10 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: hydroserverpy
3
- Version: 0.4.0
3
+ Version: 0.5.0b1
4
4
  Requires-Python: <4,>=3.9
5
5
  License-File: LICENSE
6
6
  Requires-Dist: requests>=2
7
7
  Requires-Dist: pydantic>=2.6
8
+ Requires-Dist: pydantic[email]>=2.6
8
9
  Requires-Dist: pandas>=2.2
9
10
  Requires-Dist: numpy>=2.0
10
11
  Requires-Dist: pyyaml>=5
@@ -12,7 +13,7 @@ Requires-Dist: simplejson>=3
12
13
  Requires-Dist: crontab>=1
13
14
  Requires-Dist: python-dateutil>=2.8.2
14
15
  Requires-Dist: croniter>=2.0.1
15
- Requires-Dist: country-list>=1.1.0
16
16
  Requires-Dist: jmespath>=1.0.1
17
17
  Provides-Extra: docs
18
18
  Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
19
+ Dynamic: license-file
@@ -0,0 +1,59 @@
1
+ hydroserverpy/__init__.py,sha256=FgaGFyhCjwmpJYEKNzOZxvfRx2neWMaOybj1z02_VSE,218
2
+ hydroserverpy/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ hydroserverpy/api/http.py,sha256=be2L_0t9RtpjRlS4YYlJ0T09wyvUYw2-fg5eXBQwNXA,632
4
+ hydroserverpy/api/main.py,sha256=2IVNMsf5h1UWfDZSxJn1wewOmN2D2kIMq7iqwiBqCNY,4216
5
+ hydroserverpy/api/models/__init__.py,sha256=YwO9ixElkQp3Nwi6gb0XPj4H32aNmUOFm0oXc20E_F8,550
6
+ hydroserverpy/api/models/base.py,sha256=dc2tfMSgizymxAAOVURfy7Jzeh6xIiiq7hfWZI7l1_Q,2280
7
+ hydroserverpy/api/models/etl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ hydroserverpy/api/models/iam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ hydroserverpy/api/models/iam/account.py,sha256=7COk_CPYFlthg1uFWTBlJESfnuqMW90TSjZoIcBb-_8,439
10
+ hydroserverpy/api/models/iam/collaborator.py,sha256=jp661DKDCwk8c8HFPAV-YVhEc80F5eGDKaSHmH62Q8Q,1007
11
+ hydroserverpy/api/models/iam/role.py,sha256=8FVTj_1QwtPF9tk7baliMVg000kjc5N8oP6eYo8vTDY,275
12
+ hydroserverpy/api/models/iam/workspace.py,sha256=IonbIWMGAuxPVum0i0kEy0EJq7l79eH40-2P_SZAJHs,6194
13
+ hydroserverpy/api/models/sta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ hydroserverpy/api/models/sta/datastream.py,sha256=SfBixRPsR0j6g1hNnjg0fzlCK4AfQxo8voXVyU0tS-o,10744
15
+ hydroserverpy/api/models/sta/observed_property.py,sha256=ThTg8aPMHPxbk9Hzpxw3AwM16gE1xvYpRK8UkiOdGeA,2180
16
+ hydroserverpy/api/models/sta/processing_level.py,sha256=y5_0wX7QGXgswvukXJtbpOiTCZ9pI8E08DXaTSUHakg,1470
17
+ hydroserverpy/api/models/sta/result_qualifier.py,sha256=IJcY04KjP9e2D-jPzUJjH2PC-JvDNCjbi5LKkTVSwgw,1416
18
+ hydroserverpy/api/models/sta/sensor.py,sha256=TD9R1Uwcu1t9tRQBfk0crsSJmV5UN_9kH9Ye9b7lDJc,3055
19
+ hydroserverpy/api/models/sta/thing.py,sha256=o4Xn_Luy2IEOCBjXTbek7GvPoXZyKA0dhfzoFM6nfTs,6357
20
+ hydroserverpy/api/models/sta/unit.py,sha256=Pbxxp9hZErsrYImIb8-1HVnZAsJopE3US_AplSQWOJQ,1398
21
+ hydroserverpy/api/services/__init__.py,sha256=PhqbFlKfZ8a3WJidJUwa0gJ3OADcivepEEqfbQXb1dc,371
22
+ hydroserverpy/api/services/base.py,sha256=Y2aJDMcVR7qxTgZQh1s8UYyRsoogjDY6TkCxvV9jfxA,3025
23
+ hydroserverpy/api/services/etl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ hydroserverpy/api/services/iam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ hydroserverpy/api/services/iam/workspace.py,sha256=jJiqkMxFEp9REjR4LXyVp2o45CGBrrEadGelPPCuRJs,4547
26
+ hydroserverpy/api/services/sta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
+ hydroserverpy/api/services/sta/datastream.py,sha256=_m-xFom3z8wo5-1_q8NjWUpcw36wYv1brIG7xeGGadk,12402
28
+ hydroserverpy/api/services/sta/observed_property.py,sha256=7V2PjsQqEGPEWk1n_o3MS0UM_tKQdTCEjDYM2XKMk0I,2894
29
+ hydroserverpy/api/services/sta/processing_level.py,sha256=Oupfeww2XgT83AwR5Spt91VjZK6MG0XIl11Et9fRjA0,2255
30
+ hydroserverpy/api/services/sta/result_qualifier.py,sha256=XG5Ng3xdFT-l3Ktkuq23Cty1RfmepBO7EQ9gPzidZuA,2069
31
+ hydroserverpy/api/services/sta/sensor.py,sha256=SbDhLjlOaM2ypLDfXmQVinj7eHHJ_fHxjTD68dM2pQI,3473
32
+ hydroserverpy/api/services/sta/thing.py,sha256=QL7IBwHHIgDFBpXnQF-LOUpxiRlm_HFWB1qqe7Iqq9s,5972
33
+ hydroserverpy/api/services/sta/unit.py,sha256=ksO-3g___9pPNBNbgM0jyDf1NeBqX79fjeJjCshrftY,2138
34
+ hydroserverpy/etl/__init__.py,sha256=qK2m4LZl8czR3VE8SxrlipSy5tLGLNB60lxD7dD0GjU,659
35
+ hydroserverpy/etl/hydroserver_etl.py,sha256=FSdvM3T7QHEWWulWRT8t-FMHSxAGB4GvleUXtSk5IWc,1507
36
+ hydroserverpy/etl/types.py,sha256=4PY3CM-uoXIsf2lhcqtLC6HaRGXe7HKGDU22R8-H35c,135
37
+ hydroserverpy/etl/extractors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ hydroserverpy/etl/extractors/base.py,sha256=GZKJfAhfJedRcNagnoqUiDZn286r-JzM7dW_F1dWsfY,275
39
+ hydroserverpy/etl/extractors/ftp_extractor.py,sha256=5LwvHuvLk6LwRSVyE9EkV3DPgVlAvRrOBpl1a8B7dLg,1387
40
+ hydroserverpy/etl/extractors/http_extractor.py,sha256=-duQwnsFBk4NQS2qhO55evcCUOnrBe3JX_LU9RyysX4,2709
41
+ hydroserverpy/etl/extractors/local_file_extractor.py,sha256=T_Y9NTO0cC5L9mDPbIG6wYlXDQoatg8MobP97liFl4U,692
42
+ hydroserverpy/etl/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ hydroserverpy/etl/loaders/base.py,sha256=DrA9u7SNBxkPKqaszlP368yNbxihdqIGzP8rA6NAp6U,295
44
+ hydroserverpy/etl/loaders/hydroserver_loader.py,sha256=bl4Z5TkXgJyKEHuPdY7LSrKMKOoZW_EDFl8dIRwDkv4,2549
45
+ hydroserverpy/etl/transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
+ hydroserverpy/etl/transformers/base.py,sha256=237oVBhS3HQ3fcE4bZT5U1437WzV2x5kOFC229DY53M,1741
47
+ hydroserverpy/etl/transformers/csv_transformer.py,sha256=9DKSO4NfUUDlr_c6UnH4AU3-7LxwSSeuQdou0iiCjdM,3238
48
+ hydroserverpy/etl/transformers/json_transformer.py,sha256=ity0MXcYjEnlun4Y6cVSrnjrglKrK4JOXXHxWHIHN2A,2323
49
+ hydroserverpy/etl_csv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
+ hydroserverpy/etl_csv/exceptions.py,sha256=0UY8YUlNepG0y6FfH36hJyR1bOhwYHSZIdUSSMTg7GA,314
51
+ hydroserverpy/etl_csv/hydroserver_etl_csv.py,sha256=lpZmlh4BAsljLLCEj4UiDtty3m28MJbnSiOE71gDrCQ,13260
52
+ hydroserverpy/quality/__init__.py,sha256=GGBMkFSXciJLYrbV-NraFrj_mXWCy_GTcy9KKrKXU4c,84
53
+ hydroserverpy/quality/service.py,sha256=U02UfLKVmFvr5ySiH0n0JYzUIabq5uprrHIiwcqBlqY,13879
54
+ hydroserverpy-0.5.0b1.dist-info/licenses/LICENSE,sha256=xVqFxDw3QOEJukakL7gQCqIMTQ1dlSCTo6Oc1otNW80,1508
55
+ hydroserverpy-0.5.0b1.dist-info/METADATA,sha256=ZhKOorHNQG_J18X3L2HnUqBp5gFZBx8QuwwlmPpc0FM,532
56
+ hydroserverpy-0.5.0b1.dist-info/WHEEL,sha256=L0N565qmK-3nM2eBoMNFszYJ_MTx03_tQ0CQu1bHLYo,91
57
+ hydroserverpy-0.5.0b1.dist-info/top_level.txt,sha256=Zf37hrncXLOYvXhgCrf5mZdeq81G9fShdE2LfYbtb7w,14
58
+ hydroserverpy-0.5.0b1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
59
+ hydroserverpy-0.5.0b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (78.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- from .data_loaders import DataLoaderEndpoint
2
- from .data_sources import DataSourceEndpoint
3
- from .datastreams import DatastreamEndpoint
4
- from .observed_properties import ObservedPropertyEndpoint
5
- from .processing_levels import ProcessingLevelEndpoint
6
- from .result_qualifiers import ResultQualifierEndpoint
7
- from .sensors import SensorEndpoint
8
- from .things import ThingEndpoint
9
- from .units import UnitEndpoint
@@ -1,146 +0,0 @@
1
- import json
2
- from uuid import UUID
3
- from typing import TYPE_CHECKING, Type, Union, List, TypeVar, Optional
4
-
5
- if TYPE_CHECKING:
6
- from hydroserverpy import HydroServer
7
- from hydroserverpy.core.schemas.base import HydroServerCoreModel
8
-
9
- HydroServerModelType = TypeVar("HydroServerModelType", bound=HydroServerCoreModel)
10
-
11
-
12
- def expand_docstring(
13
- model: Optional[Type["HydroServerCoreModel"]] = None, include_uid: bool = False
14
- ):
15
- def decorator(func):
16
- docstring = func.__doc__
17
- if model is not None or include_uid is True:
18
- docstring += "\n"
19
- if include_uid is True:
20
- docstring += f":param uid: The entity ID.\n"
21
- docstring += f":type uid: Union[UUID, str]\n"
22
- if model is not None:
23
- for field_name, field in model.model_fields.items():
24
- docstring += f":param {field_name}: {field.description}\n"
25
- docstring += f':type {field_name}: {getattr(field.annotation, "__name__", field.annotation)}\n'
26
- func.__doc__ = docstring
27
- return func
28
-
29
- return decorator
30
-
31
-
32
- class HydroServerEndpoint:
33
- """
34
- A base class for interacting with specific API endpoints within a HydroServer service.
35
-
36
- :ivar _model: The model class associated with this endpoint.
37
- :ivar _api_route: The base route of the API.
38
- :ivar _endpoint_route: The specific route of the endpoint.
39
- """
40
-
41
- _model: Type["HydroServerCoreModel"]
42
- _api_route: str
43
- _endpoint_route: str
44
-
45
- def __init__(self, service: "HydroServer") -> None:
46
- """
47
- Initialize the HydroServerEndpoint.
48
-
49
- :param service: The HydroServer service instance to use for requests.
50
- :type service: HydroServer
51
- """
52
-
53
- self._service = service
54
-
55
- def _get(
56
- self, uid: Optional[Union[UUID, str]] = None, params: dict = None
57
- ) -> Union[List["HydroServerModelType"], "HydroServerModelType"]:
58
- """
59
- Fetch an entity collection or single entity from a HydroServer endpoint.
60
-
61
- :param uid: The unique identifier of the entity to retrieve.
62
- :type uid: Optional[Union[UUID, str]]
63
- :returns: A model instance representing the entity.
64
- :rtype: HydroServerCoreModel
65
- """
66
-
67
- if params is None:
68
- params = {}
69
-
70
- path = f'{self._api_route}/data/{self._endpoint_route}{"/" + str(uid) if uid else ""}'
71
- response = getattr(self._service, "_request")("get", path, params=params)
72
-
73
- if uid:
74
- entity = json.loads(response.content)
75
- result = self._model(
76
- _endpoint=self, _uid=UUID(str(entity.pop("id"))), **entity
77
- )
78
- else:
79
- result = [
80
- self._model(_endpoint=self, _uid=UUID(str(entity.pop("id"))), **entity)
81
- for entity in json.loads(response.content)
82
- ]
83
-
84
- return result
85
-
86
- def _post(self, **kwargs) -> "HydroServerModelType":
87
- """
88
- Create a new entity using the endpoint.
89
-
90
- :param kwargs: The attributes to set on the new entity.
91
- :returns: A model instance representing the newly created entity.
92
- :rtype: HydroServerModelType
93
- """
94
-
95
- response = getattr(self._service, "_request")(
96
- "post",
97
- f"{self._api_route}/data/{self._endpoint_route}",
98
- headers={"Content-type": "application/json"},
99
- data=self._model(_endpoint=self, **kwargs).json(
100
- exclude_unset=True, by_alias=True
101
- ),
102
- )
103
- entity = json.loads(response.content)
104
-
105
- return self._model(_endpoint=self, _uid=UUID(str(entity.pop("id"))), **entity)
106
-
107
- def _patch(self, uid: Union[UUID, str], **kwargs) -> "HydroServerModelType":
108
- """
109
- Update an existing entity in the endpoint.
110
-
111
- :param uid: The unique identifier of the entity to update.
112
- :type uid: Union[UUID, str]
113
- :param kwargs: The attributes to update on the entity.
114
- :returns: A model instance representing the updated entity.
115
- :rtype: HydroServerModelType
116
- """
117
-
118
- response = getattr(self._service, "_request")(
119
- "patch",
120
- f"{self._api_route}/data/{self._endpoint_route}/{str(uid)}",
121
- headers={"Content-type": "application/json"},
122
- data=json.dumps(
123
- {
124
- self._model.model_fields[key].serialization_alias: value
125
- for key, value in kwargs.items()
126
- },
127
- default=str,
128
- ),
129
- )
130
- entity = json.loads(response.content)
131
-
132
- return self._model(_endpoint=self, _uid=UUID(str(entity.pop("id"))), **entity)
133
-
134
- def _delete(self, uid: Union[UUID, str]) -> None:
135
- """
136
- Delete an entity from the endpoint by its unique identifier.
137
-
138
- :param uid: The unique identifier of the entity to delete.
139
- :type uid: Union[UUID, str]
140
- :returns: None
141
- """
142
-
143
- getattr(self._service, "_request")(
144
- "delete",
145
- f"{self._api_route}/data/{self._endpoint_route}/{str(uid)}",
146
- )