sta-dggs-client 0.1.0__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 (36) hide show
  1. sta_dggs_client-0.1.0/LICENSE +165 -0
  2. sta_dggs_client-0.1.0/PKG-INFO +90 -0
  3. sta_dggs_client-0.1.0/README.md +60 -0
  4. sta_dggs_client-0.1.0/setup.cfg +10 -0
  5. sta_dggs_client-0.1.0/setup.py +27 -0
  6. sta_dggs_client-0.1.0/sta_dggs_client/__init__.py +44 -0
  7. sta_dggs_client-0.1.0/sta_dggs_client/__version__.py +8 -0
  8. sta_dggs_client-0.1.0/sta_dggs_client/dao/__init__.py +16 -0
  9. sta_dggs_client-0.1.0/sta_dggs_client/dao/base.py +71 -0
  10. sta_dggs_client-0.1.0/sta_dggs_client/dao/cell.py +59 -0
  11. sta_dggs_client-0.1.0/sta_dggs_client/dao/datastream.py +37 -0
  12. sta_dggs_client-0.1.0/sta_dggs_client/dao/multi_datastream.py +37 -0
  13. sta_dggs_client-0.1.0/sta_dggs_client/dao/observation.py +37 -0
  14. sta_dggs_client-0.1.0/sta_dggs_client/model/__init__.py +19 -0
  15. sta_dggs_client-0.1.0/sta_dggs_client/model/cell.py +401 -0
  16. sta_dggs_client-0.1.0/sta_dggs_client/model/datastream.py +59 -0
  17. sta_dggs_client-0.1.0/sta_dggs_client/model/ext/__init__.py +14 -0
  18. sta_dggs_client-0.1.0/sta_dggs_client/model/ext/datatypes.py +38 -0
  19. sta_dggs_client-0.1.0/sta_dggs_client/model/ext/entity_list.py +82 -0
  20. sta_dggs_client-0.1.0/sta_dggs_client/model/ext/entity_type.py +124 -0
  21. sta_dggs_client-0.1.0/sta_dggs_client/model/mixins.py +73 -0
  22. sta_dggs_client-0.1.0/sta_dggs_client/model/multi_datastream.py +61 -0
  23. sta_dggs_client-0.1.0/sta_dggs_client/model/observation.py +53 -0
  24. sta_dggs_client-0.1.0/sta_dggs_client/query/__init__.py +14 -0
  25. sta_dggs_client-0.1.0/sta_dggs_client/query/query.py +83 -0
  26. sta_dggs_client-0.1.0/sta_dggs_client/service/__init__.py +17 -0
  27. sta_dggs_client-0.1.0/sta_dggs_client/service/compose.py +226 -0
  28. sta_dggs_client-0.1.0/sta_dggs_client/service/stadggsservice.py +134 -0
  29. sta_dggs_client-0.1.0/sta_dggs_client/utils.py +46 -0
  30. sta_dggs_client-0.1.0/sta_dggs_client.egg-info/PKG-INFO +90 -0
  31. sta_dggs_client-0.1.0/sta_dggs_client.egg-info/SOURCES.txt +35 -0
  32. sta_dggs_client-0.1.0/sta_dggs_client.egg-info/dependency_links.txt +1 -0
  33. sta_dggs_client-0.1.0/sta_dggs_client.egg-info/requires.txt +8 -0
  34. sta_dggs_client-0.1.0/sta_dggs_client.egg-info/top_level.txt +1 -0
  35. sta_dggs_client-0.1.0/tests/test_cell.py +104 -0
  36. sta_dggs_client-0.1.0/tests/test_compose.py +170 -0
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: sta-dggs-client
3
+ Version: 0.1.0
4
+ Summary: A client library for the OGC SensorThings DGGS (Cell) extension
5
+ Home-page: https://github.com/securedimensions/STA-DGGS-Python-Client
6
+ Author: Andreas Matheus
7
+ Author-email: andreas.matheus@secure-dimensions.de
8
+ License: LGPL3
9
+ Keywords: ogc,sta-dggs,sensorthingsapi,DGGS,IoT
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: demjson3>=3.0.5
13
+ Requires-Dist: furl>=2.1.3
14
+ Requires-Dist: geojson>=2.5.0
15
+ Requires-Dist: jsonpickle>=2.0.0
16
+ Requires-Dist: requests>=2.26.0
17
+ Requires-Dist: jsonpatch
18
+ Requires-Dist: python-dateutil
19
+ Requires-Dist: sd-frost-sta-client>=1.1.47
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: license-file
28
+ Dynamic: requires-dist
29
+ Dynamic: summary
30
+
31
+ # OGC STA-DGGS (SensorThings Cell) Python Client
32
+
33
+ This STA-DGGS Python Client implements the SensorThings Discrete Global Grid System extension (entity type `Cell`). The aim is to isolate Cell from STAplus and STA so it can be used on its own or stacked with the [STAplus Python Client](https://github.com/securedimensions/STAplus-Python-Client).
34
+
35
+ This implementation is an extension to the [STA Python Client](https://github.com/securedimensions/STA-Python-Client).
36
+
37
+ ## Python Version
38
+ This library requires Python 3.11 or better to support parsing ISO datetime values (`datetime.datetime.fromisoformat`).
39
+
40
+ ## Features
41
+ * Support for the STA-DGGS `Cell` entity
42
+ * Cell attributes: `zoneId`, `zoneLevel`, `system`, `boundary`, `encodingType`, `properties`
43
+ * Navigations: Datastreams, MultiDatastreams, Observations, Parent, Children
44
+ * Reverse `Cell` navigation on Datastream, MultiDatastream, and Observation
45
+ * CRUD operations and queries
46
+ * `compose()` with STAplus for the combined STAplus + DGGS data model
47
+
48
+ ## Installation via PyPi
49
+ Installation via pip: `pip install sta-dggs-client`
50
+
51
+ ## STA-DGGS only
52
+
53
+ ```python
54
+ import sta_dggs_client as dggs
55
+
56
+ url = "<your domain>/FROST-Server/v1.1"
57
+ service = dggs.STADGGSService(url)
58
+
59
+ cell = dggs.Cell(zone_id='u281t', zone_level=5, system='H3')
60
+ service.create(cell)
61
+ ```
62
+
63
+ ## Combined with STAplus
64
+
65
+ A client that needs both STAplus (Party, License, Campaign, …) and Cell uses `compose()`. That returns one service whose Datastream, MultiDatastream, and Observation classes carry both models. `compose()` requires `staplus-client` to be installed. STA-DGGS itself does not depend on STAplus.
66
+
67
+ ```python
68
+ import staplus_client as plus
69
+ import sta_dggs_client as dggs
70
+ service = dggs.compose(url, auth_handler=auth)
71
+ ds = plus.Datastream(name='Temperature', description='temp',
72
+ party=party, cell=cell)
73
+ mds = plus.MultiDatastream(name='Air quality', description='multi',
74
+ party=party, cell=cell)
75
+ obs = plus.Observation(result=21.5, cell=cell)
76
+ ```
77
+
78
+ `compose()` rebinds `plus.Datastream` (and MultiDatastream, Observation) so existing STAplus code keeps working, including `datastream.cell = dggs.Cell(zone_id)`. `compose()` takes the same arguments as `SensorThingsService` in STA-Python-Client: `url`, `auth_handler`, and `proxies`. You can also pass an existing `STAplusService` instance:
79
+
80
+ ```python
81
+ service = dggs.compose(plus.STAplusService(url, auth_handler=auth))
82
+ ```
83
+
84
+ ## Limitations
85
+ `Cell/boundary` should be JSON-serializable (typically a GeoJSON Geometry). `encodingType`, when set, should be one of:
86
+
87
+ * `application/geo+json`
88
+ * `application/vnd.geo+json`
89
+ * `application/vnd.ogc.fg+json`
90
+ * `application/wkt`
@@ -0,0 +1,60 @@
1
+ # OGC STA-DGGS (SensorThings Cell) Python Client
2
+
3
+ This STA-DGGS Python Client implements the SensorThings Discrete Global Grid System extension (entity type `Cell`). The aim is to isolate Cell from STAplus and STA so it can be used on its own or stacked with the [STAplus Python Client](https://github.com/securedimensions/STAplus-Python-Client).
4
+
5
+ This implementation is an extension to the [STA Python Client](https://github.com/securedimensions/STA-Python-Client).
6
+
7
+ ## Python Version
8
+ This library requires Python 3.11 or better to support parsing ISO datetime values (`datetime.datetime.fromisoformat`).
9
+
10
+ ## Features
11
+ * Support for the STA-DGGS `Cell` entity
12
+ * Cell attributes: `zoneId`, `zoneLevel`, `system`, `boundary`, `encodingType`, `properties`
13
+ * Navigations: Datastreams, MultiDatastreams, Observations, Parent, Children
14
+ * Reverse `Cell` navigation on Datastream, MultiDatastream, and Observation
15
+ * CRUD operations and queries
16
+ * `compose()` with STAplus for the combined STAplus + DGGS data model
17
+
18
+ ## Installation via PyPi
19
+ Installation via pip: `pip install sta-dggs-client`
20
+
21
+ ## STA-DGGS only
22
+
23
+ ```python
24
+ import sta_dggs_client as dggs
25
+
26
+ url = "<your domain>/FROST-Server/v1.1"
27
+ service = dggs.STADGGSService(url)
28
+
29
+ cell = dggs.Cell(zone_id='u281t', zone_level=5, system='H3')
30
+ service.create(cell)
31
+ ```
32
+
33
+ ## Combined with STAplus
34
+
35
+ A client that needs both STAplus (Party, License, Campaign, …) and Cell uses `compose()`. That returns one service whose Datastream, MultiDatastream, and Observation classes carry both models. `compose()` requires `staplus-client` to be installed. STA-DGGS itself does not depend on STAplus.
36
+
37
+ ```python
38
+ import staplus_client as plus
39
+ import sta_dggs_client as dggs
40
+ service = dggs.compose(url, auth_handler=auth)
41
+ ds = plus.Datastream(name='Temperature', description='temp',
42
+ party=party, cell=cell)
43
+ mds = plus.MultiDatastream(name='Air quality', description='multi',
44
+ party=party, cell=cell)
45
+ obs = plus.Observation(result=21.5, cell=cell)
46
+ ```
47
+
48
+ `compose()` rebinds `plus.Datastream` (and MultiDatastream, Observation) so existing STAplus code keeps working, including `datastream.cell = dggs.Cell(zone_id)`. `compose()` takes the same arguments as `SensorThingsService` in STA-Python-Client: `url`, `auth_handler`, and `proxies`. You can also pass an existing `STAplusService` instance:
49
+
50
+ ```python
51
+ service = dggs.compose(plus.STAplusService(url, auth_handler=auth))
52
+ ```
53
+
54
+ ## Limitations
55
+ `Cell/boundary` should be JSON-serializable (typically a GeoJSON Geometry). `encodingType`, when set, should be one of:
56
+
57
+ * `application/geo+json`
58
+ * `application/vnd.geo+json`
59
+ * `application/vnd.ogc.fg+json`
60
+ * `application/wkt`
@@ -0,0 +1,10 @@
1
+ [bdist_wheel]
2
+ universal = 1
3
+
4
+ [metadata]
5
+ license_files = LICENSE
6
+
7
+ [egg_info]
8
+ tag_build =
9
+ tag_date = 0
10
+
@@ -0,0 +1,27 @@
1
+ import os
2
+ from setuptools import setup, find_packages
3
+
4
+ here = os.path.abspath(os.path.dirname(__file__))
5
+ info = {}
6
+ with open(os.path.join(here, 'sta_dggs_client', '__version__.py')) as f:
7
+ exec(f.read(), info)
8
+
9
+ with open("README.md", "r", encoding="utf-8") as fh:
10
+ long_description = fh.read()
11
+
12
+ setup(
13
+ name=info['__title__'],
14
+ version=info['__version__'],
15
+ description=info['__description__'],
16
+ long_description=long_description,
17
+ long_description_content_type='text/markdown',
18
+ author=info['__author__'],
19
+ author_email=info['__contact__'],
20
+ license=info['__license__'],
21
+ url=info['__url__'],
22
+ packages=find_packages(exclude="tests"),
23
+ install_requires=['demjson3>=3.0.5', 'furl>=2.1.3', 'geojson>=2.5.0', 'jsonpickle>=2.0.0',
24
+ 'requests>=2.26.0', 'jsonpatch', 'python-dateutil',
25
+ 'sd-frost-sta-client>=1.1.47'],
26
+ keywords=['ogc', 'sta-dggs', 'sensorthingsapi', 'DGGS', 'IoT']
27
+ )
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ from sta_dggs_client import model
17
+ from sta_dggs_client import dao
18
+ from sta_dggs_client import service
19
+ from sta_dggs_client import query
20
+
21
+ from sta_dggs_client.model.ext.datatypes import (
22
+ ENCODING_TYPES,
23
+ ENCODING_TYPE_GEOJSON,
24
+ ENCODING_TYPE_GEOJSON_VND,
25
+ ENCODING_TYPE_JSON_FG,
26
+ ENCODING_TYPE_WKT,
27
+ )
28
+ from sta_dggs_client.model.cell import Cell
29
+ from sta_dggs_client.model.datastream import Datastream
30
+ from sta_dggs_client.model.multi_datastream import MultiDatastream
31
+ from sta_dggs_client.model.observation import Observation
32
+ from sta_dggs_client.model.ext.entity_type import EntityTypes
33
+ from sta_dggs_client.service.stadggsservice import STADGGSService
34
+ from sta_dggs_client.service.compose import compose
35
+
36
+ import jsonpickle
37
+ import demjson3
38
+
39
+ jsonpickle.load_backend('demjson3', 'encode', 'decode', 'JSONDecodeError')
40
+ jsonpickle.set_preferred_backend('demjson3')
41
+ jsonpickle.set_decoder_options("demjson3", decode_float=float)
42
+
43
+ from .__version__ import (__title__, __version__, __license__, __author__, __contact__, __url__,
44
+ __description__, __copyright__)
@@ -0,0 +1,8 @@
1
+ __title__ = 'sta-dggs-client'
2
+ __version__ = '0.1.0'
3
+ __license__ = 'LGPL3'
4
+ __author__ = 'Andreas Matheus'
5
+ __copyright__ = 'Secure Dimensions'
6
+ __contact__ = 'andreas.matheus@secure-dimensions.de'
7
+ __url__ = 'https://github.com/securedimensions/STA-DGGS-Python-Client'
8
+ __description__ = 'A client library for the OGC SensorThings DGGS (Cell) extension'
@@ -0,0 +1,16 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ __all__ = ['cell', 'datastream', 'multi_datastream', 'observation']
@@ -0,0 +1,71 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ import sta_dggs_client.query.query
17
+ import sta_dggs_client.utils
18
+
19
+ import logging
20
+ import requests
21
+ from furl import furl
22
+
23
+ from frost_sta_client.utils import extract_value
24
+ from frost_sta_client.dao.base import BaseDao as STABaseDao
25
+ from frost_sta_client.service.sensorthingsservice import SensorThingsService
26
+
27
+
28
+ class BaseDao(STABaseDao):
29
+ """
30
+ The STA-DGGS extension
31
+ """
32
+ APPLICATION_JSON_PATCH = {'Content-type': 'application/json-patch+json'}
33
+
34
+ def __init__(self, service, entitytype):
35
+ super().__init__(service, entitytype)
36
+
37
+ @property
38
+ def service(self):
39
+ return self._service
40
+
41
+ @service.setter
42
+ def service(self, value):
43
+ if value is None or isinstance(value, SensorThingsService):
44
+ self._service = value
45
+ return
46
+ raise ValueError('service should be of type SensorThingsService')
47
+
48
+ def create(self, entity):
49
+ url = furl(self.service.url)
50
+ url.path.add(self.entitytype_plural)
51
+ logging.debug('Posting to ' + str(url.url))
52
+ json_dict = sta_dggs_client.utils.transform_entity_to_json_dict(entity)
53
+ try:
54
+ response = self.service.execute('post', url, json=json_dict)
55
+ except requests.exceptions.HTTPError as e:
56
+ error_json = e.response.json()
57
+ error_message = error_json['message']
58
+ logging.error("Creating {} failed with status-code {}, {}".format(type(entity).__name__,
59
+ e.response.status_code,
60
+ error_message))
61
+ raise e
62
+ entity.id = extract_value(response.headers['location'])
63
+ entity.service = self.service
64
+ id = "('" + entity.id + "')" if type(entity.id) == str else '(' + str(entity.id) + ')'
65
+ entity.self_link = url.url + id
66
+ logging.debug('Received response: ' + str(response.status_code))
67
+ return entity.id
68
+
69
+ def query(self):
70
+ return sta_dggs_client.query.query.Query(self.service, self.entitytype, self.entitytype_plural,
71
+ self.entity_class, self.parent)
@@ -0,0 +1,59 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ from sta_dggs_client.dao import base
17
+ from sta_dggs_client.model.ext.entity_type import EntityTypes
18
+ from sta_dggs_client.query.query import Query
19
+
20
+
21
+ class CellDao(base.BaseDao):
22
+ def __init__(self, service):
23
+ """
24
+ A data access object for operations with the Cell entity
25
+ """
26
+ base.BaseDao.__init__(self, service, EntityTypes["Cell"])
27
+
28
+
29
+ class ParentDao(CellDao):
30
+ def __init__(self, service):
31
+ """
32
+ A data access object for the 0..1 Parent navigation of a Cell
33
+ """
34
+ super().__init__(service)
35
+ entitytype = {
36
+ 'singular': 'Parent',
37
+ 'plural': 'Cells',
38
+ 'class': 'sta_dggs_client.model.cell.Cell',
39
+ 'relations_list': ['Children']
40
+ }
41
+ self.entitytype = entitytype["singular"]
42
+ self.entitytype_plural = entitytype["plural"]
43
+ self.entity_class = entitytype["class"]
44
+
45
+
46
+ class ChildrenDao(CellDao):
47
+ def __init__(self, service):
48
+ """
49
+ A data access object for the 0..* Children navigation of a Cell
50
+ """
51
+ base.BaseDao.__init__(self, service, {
52
+ 'singular': 'Cell',
53
+ 'plural': 'Children',
54
+ 'class': 'sta_dggs_client.model.cell.Cell',
55
+ 'relations_list': ['Parent']
56
+ })
57
+
58
+ def query(self):
59
+ return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
@@ -0,0 +1,37 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ from frost_sta_client.dao.datastream import DatastreamDao as STADatastreamDao
17
+ from sta_dggs_client.dao.base import BaseDao as STADGGSBaseDao
18
+ from sta_dggs_client.query.query import Query
19
+ from sta_dggs_client.model.ext.entity_type import EntityTypes
20
+
21
+
22
+ class DatastreamDao(STADatastreamDao):
23
+ def __init__(self, service):
24
+ """
25
+ A data access object for operations with the Datastream entity
26
+ """
27
+ super().__init__(service)
28
+ entitytype = EntityTypes["Datastream"]
29
+ self.entitytype = entitytype["singular"]
30
+ self.entitytype_plural = entitytype["plural"]
31
+ self.entity_class = entitytype["class"]
32
+
33
+ def query(self):
34
+ return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
35
+
36
+ def create(self, entity):
37
+ return STADGGSBaseDao.create(self, entity)
@@ -0,0 +1,37 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ from frost_sta_client.dao.multi_datastream import MultiDatastreamDao as STAMultiDatastreamDao
17
+ from sta_dggs_client.dao.base import BaseDao as STADGGSBaseDao
18
+ from sta_dggs_client.query.query import Query
19
+ from sta_dggs_client.model.ext.entity_type import EntityTypes
20
+
21
+
22
+ class MultiDatastreamDao(STAMultiDatastreamDao):
23
+ def __init__(self, service):
24
+ """
25
+ A data access object for operations with the MultiDatastream entity
26
+ """
27
+ super().__init__(service)
28
+ entitytype = EntityTypes["MultiDatastream"]
29
+ self.entitytype = entitytype["singular"]
30
+ self.entitytype_plural = entitytype["plural"]
31
+ self.entity_class = entitytype["class"]
32
+
33
+ def query(self):
34
+ return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
35
+
36
+ def create(self, entity):
37
+ return STADGGSBaseDao.create(self, entity)
@@ -0,0 +1,37 @@
1
+ # Copyright (C) 2026 Secure Dimensions GmbH, Munich, Germany.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ from frost_sta_client.dao.observation import ObservationDao as STAObservationDao
17
+ from sta_dggs_client.dao.base import BaseDao as STADGGSBaseDao
18
+ from sta_dggs_client.query.query import Query
19
+ from sta_dggs_client.model.ext.entity_type import EntityTypes
20
+
21
+
22
+ class ObservationDao(STAObservationDao):
23
+ def __init__(self, service):
24
+ """
25
+ A data access object for operations with the Observation entity
26
+ """
27
+ super().__init__(service)
28
+ entitytype = EntityTypes["Observation"]
29
+ self.entitytype = entitytype["singular"]
30
+ self.entitytype_plural = entitytype["plural"]
31
+ self.entity_class = entitytype["class"]
32
+
33
+ def query(self):
34
+ return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
35
+
36
+ def create(self, entity):
37
+ return STADGGSBaseDao.create(self, entity)