hydroserverpy 0.2.0__tar.gz → 0.2.1__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.
Potentially problematic release.
This version of hydroserverpy might be problematic. Click here for more details.
- {hydroserverpy-0.2.0/src/hydroserverpy.egg-info → hydroserverpy-0.2.1}/PKG-INFO +1 -1
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/setup.cfg +1 -1
- hydroserverpy-0.2.1/src/hydroserverpy/__init__.py +19 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/etl.py +11 -8
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/datastreams.py +3 -1
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/observed_properties.py +1 -1
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/processing_levels.py +6 -4
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/result_qualifiers.py +6 -4
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/sensors.py +4 -2
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/units.py +1 -1
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1/src/hydroserverpy.egg-info}/PKG-INFO +1 -1
- hydroserverpy-0.2.0/src/hydroserverpy/__init__.py +0 -13
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/LICENSE +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/README.md +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/pyproject.toml +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/setup.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/__init__.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/data_loaders.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/data_sources.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/datastreams.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/observed_properties.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/processing_levels.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/result_qualifiers.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/sensors.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/things.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/units.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/users.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/exceptions.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/main.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/models.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/__init__.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/data_loaders.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/data_sources.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/things.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/schemas/users.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/service.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/utils.py +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy.egg-info/SOURCES.txt +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy.egg-info/dependency_links.txt +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy.egg-info/requires.txt +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy.egg-info/top_level.txt +0 -0
- {hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy.egg-info/zip-safe +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .main import HydroServer
|
|
2
|
+
from .schemas.things import ThingPostBody
|
|
3
|
+
from .schemas.sensors import SensorPostBody
|
|
4
|
+
from .schemas.observed_properties import ObservedPropertyPostBody
|
|
5
|
+
from .schemas.units import UnitPostBody
|
|
6
|
+
from .schemas.processing_levels import ProcessingLevelPostBody
|
|
7
|
+
from .schemas.result_qualifiers import ResultQualifierPostBody
|
|
8
|
+
from .schemas.datastreams import DatastreamPostBody
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"HydroServer",
|
|
12
|
+
"ThingPostBody",
|
|
13
|
+
"SensorPostBody",
|
|
14
|
+
"ObservedPropertyPostBody",
|
|
15
|
+
"UnitPostBody",
|
|
16
|
+
"ProcessingLevelPostBody",
|
|
17
|
+
"ResultQualifierPostBody",
|
|
18
|
+
"DatastreamPostBody"
|
|
19
|
+
]
|
|
@@ -5,10 +5,10 @@ import croniter
|
|
|
5
5
|
from typing import IO, List
|
|
6
6
|
from datetime import datetime, timezone, timedelta
|
|
7
7
|
from dateutil.parser import isoparse
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
8
|
+
from .schemas.data_sources import DataSourceGetResponse
|
|
9
|
+
from .schemas.datastreams import DatastreamGetResponse
|
|
10
|
+
from .exceptions import HeaderParsingError, TimestampParsingError
|
|
11
|
+
from .schemas.data_sources import DataSourcePatchBody
|
|
12
12
|
|
|
13
13
|
logger = logging.getLogger('hydroserver_etl')
|
|
14
14
|
logger.addHandler(logging.NullHandler())
|
|
@@ -137,7 +137,7 @@ class HydroServerETL:
|
|
|
137
137
|
|
|
138
138
|
try:
|
|
139
139
|
self._timestamp_column_index = row.index(self._data_source.timestamp_column) \
|
|
140
|
-
if
|
|
140
|
+
if isinstance(self._data_source.timestamp_column, str) \
|
|
141
141
|
else int(self._data_source.timestamp_column) - 1
|
|
142
142
|
if self._timestamp_column_index > len(row):
|
|
143
143
|
raise ValueError
|
|
@@ -151,6 +151,7 @@ class HydroServerETL:
|
|
|
151
151
|
max(self._datastream_column_indexes.values()) > len(row):
|
|
152
152
|
raise ValueError
|
|
153
153
|
except ValueError as e:
|
|
154
|
+
logger.error(f'Failed to load data from data source: "{self._data_source.name}"')
|
|
154
155
|
raise HeaderParsingError(str(e)) from e
|
|
155
156
|
|
|
156
157
|
def _parse_row_timestamp(self, row: List[str]) -> datetime:
|
|
@@ -163,7 +164,7 @@ class HydroServerETL:
|
|
|
163
164
|
"""
|
|
164
165
|
|
|
165
166
|
try:
|
|
166
|
-
if self._data_source.timestamp_format == 'iso':
|
|
167
|
+
if self._data_source.timestamp_format == 'iso' or self._data_source.timestamp_format is None:
|
|
167
168
|
timestamp = isoparse(
|
|
168
169
|
row[self._timestamp_column_index]
|
|
169
170
|
)
|
|
@@ -188,6 +189,7 @@ class HydroServerETL:
|
|
|
188
189
|
).tzinfo
|
|
189
190
|
)
|
|
190
191
|
except ValueError as e:
|
|
192
|
+
logger.error(f'Failed to load data from data source: "{self._data_source.name}"')
|
|
191
193
|
raise TimestampParsingError(str(e)) from e
|
|
192
194
|
|
|
193
195
|
return timestamp
|
|
@@ -214,7 +216,7 @@ class HydroServerETL:
|
|
|
214
216
|
f'Loading observations from ' +
|
|
215
217
|
f'{observations[0]["phenomenon_time"].strftime("%Y-%m-%dT%H:%M:%S%z")} to ' +
|
|
216
218
|
f'{observations[-1]["phenomenon_time"].strftime("%Y-%m-%dT%H:%M:%S%z")} for datastream: ' +
|
|
217
|
-
f'{str(datastream_id)}.'
|
|
219
|
+
f'{str(datastream_id)} in data source "{self._data_source.name}".'
|
|
218
220
|
)
|
|
219
221
|
|
|
220
222
|
data_array_value = getattr(fsc.model, 'ext').data_array_value.DataArrayValue()
|
|
@@ -250,7 +252,8 @@ class HydroServerETL:
|
|
|
250
252
|
f'Skipping observations POST request from ' +
|
|
251
253
|
f'{observations[0]["phenomenon_time"].strftime("%Y-%m-%dT%H:%M:%S%z")} to ' +
|
|
252
254
|
f'{observations[-1]["phenomenon_time"].strftime("%Y-%m-%dT%H:%M:%S%z")} for datastream: ' +
|
|
253
|
-
f'{str(datastream_id)}
|
|
255
|
+
f'{str(datastream_id)} in data source "{self._data_source.name}",' +
|
|
256
|
+
f'due to previous failed POST request.'
|
|
254
257
|
)
|
|
255
258
|
|
|
256
259
|
self._observations = {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from pydantic import BaseModel
|
|
2
2
|
from uuid import UUID
|
|
3
3
|
from typing import Optional
|
|
4
|
-
from
|
|
5
|
-
from
|
|
4
|
+
from ..utils import allow_partial
|
|
5
|
+
from ..schemas.users import UserFields
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ProcessingLevelID(BaseModel):
|
|
@@ -16,14 +16,16 @@ class ProcessingLevelFields(BaseModel):
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ProcessingLevelGetResponse(ProcessingLevelFields, ProcessingLevelID):
|
|
19
|
-
owner: Optional[
|
|
19
|
+
owner: Optional[str]
|
|
20
20
|
|
|
21
21
|
class Config:
|
|
22
22
|
allow_population_by_field_name = True
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ProcessingLevelPostBody(ProcessingLevelFields):
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
class Config:
|
|
28
|
+
allow_population_by_field_name = True
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
@allow_partial
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from pydantic import BaseModel
|
|
2
2
|
from uuid import UUID
|
|
3
3
|
from typing import Optional
|
|
4
|
-
from
|
|
5
|
-
from
|
|
4
|
+
from ..utils import allow_partial
|
|
5
|
+
from ..schemas.users import UserFields
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ResultQualifierID(BaseModel):
|
|
@@ -15,14 +15,16 @@ class ResultQualifierFields(BaseModel):
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class ResultQualifierGetResponse(ResultQualifierFields, ResultQualifierID):
|
|
18
|
-
owner: Optional[
|
|
18
|
+
owner: Optional[str]
|
|
19
19
|
|
|
20
20
|
class Config:
|
|
21
21
|
allow_population_by_field_name = True
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class ResultQualifierPostBody(ResultQualifierFields):
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
class Config:
|
|
27
|
+
allow_population_by_field_name = True
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
@allow_partial
|
|
@@ -22,14 +22,16 @@ class SensorFields(BaseModel):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class SensorGetResponse(SensorFields, SensorID):
|
|
25
|
-
owner: Optional[
|
|
25
|
+
owner: Optional[str]
|
|
26
26
|
|
|
27
27
|
class Config:
|
|
28
28
|
allow_population_by_field_name = True
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class SensorPostBody(SensorFields):
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
class Config:
|
|
34
|
+
allow_population_by_field_name = True
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
@allow_partial
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from hydroserverpy.main import HydroServer
|
|
2
|
-
from hydroserverpy.schemas.things import ThingPostBody
|
|
3
|
-
from hydroserverpy.schemas.observed_properties import ObservedPropertyPostBody
|
|
4
|
-
from hydroserverpy.schemas.units import UnitPostBody
|
|
5
|
-
from hydroserverpy.schemas.datastreams import DatastreamPostBody
|
|
6
|
-
|
|
7
|
-
__all__ = [
|
|
8
|
-
"HydroServer",
|
|
9
|
-
"ThingPostBody",
|
|
10
|
-
"ObservedPropertyPostBody",
|
|
11
|
-
"UnitPostBody",
|
|
12
|
-
"DatastreamPostBody"
|
|
13
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/observed_properties.py
RENAMED
|
File without changes
|
{hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/processing_levels.py
RENAMED
|
File without changes
|
{hydroserverpy-0.2.0 → hydroserverpy-0.2.1}/src/hydroserverpy/components/result_qualifiers.py
RENAMED
|
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
|