1+ """
2+ This module contains the asynchronous API to interface with Obelisk CORE.
3+ These methods all return a :any:`Coroutine`.
4+
5+ Relevant entrance points are :class:`Core`.
6+
7+ This API vaguely resembles that of clients to previous Obelisk versions,
8+ but also significantly diverts from it where the underlying Obelisk CORE API does so.
9+ """
110from obelisk .asynchronous .base import BaseClient
211from obelisk .exceptions import ObeliskError
312
1120
1221
1322DataType = Literal ['number' , 'number[]' , 'json' , 'bool' , 'string' ]
23+ """The possible types of data Obelisk can accept"""
1424
1525
1626Aggregator = Literal ['last' , 'min' , 'mean' , 'max' , 'count' , 'stddev' ]
27+ """Type of aggregation Obelisk can process"""
1728
1829
19- # https://obelisk.pages.ilabt.imec.be/obelisk-core/query.html#available-data-point-fields
2030FieldName = str # TODO: validate field names?
31+ """https://obelisk.pages.ilabt.imec.be/obelisk-core/query.html#available-data-point-fields"""
2132
2233
2334Datapoint = Dict [str , Any ]
35+ """Datapoints resulting from queries are modeled as simple dicts, as fields can come and go depending on query."""
2436
2537
2638class ObeliskPosition (BaseModel ):
39+ """
40+ Format for coordinates as expected by Obelisk.
41+ """
42+
2743 lat : float
44+ """Latitude"""
2845 lng : float
46+ """Longitude"""
2947 elevation : float
3048
3149
32- class IncomingDataPoint (BaseModel ):
50+ class IncomingDatapoint (BaseModel ):
51+ """A datapoint to be submitted to Obelisk. These are validated quite extensively, but not fully."""
3352 timestamp : Optional [AwareDatetime ] = None
3453 metric : str
3554 value : Any
@@ -142,7 +161,7 @@ class Core(BaseClient):
142161 async def send (
143162 self ,
144163 dataset : str ,
145- data : List [IncomingDataPoint ],
164+ data : List [IncomingDatapoint ],
146165 ) -> httpx .Response :
147166 """
148167 Publishes data to Obelisk
@@ -151,7 +170,7 @@ async def send(
151170 ----------
152171 dataset : str
153172 ID for the dataset to publish to
154- data : List[IncomingDataPoint ]
173+ data : List[IncomingDatapoint ]
155174 List of Obelisk-acceptable datapoints.
156175 Exact format varies between Classic or HFS,
157176 caller is responsible for formatting.
@@ -228,3 +247,4 @@ async def query_time_chunked(
228247 yield await self .query (
229248 chunk
230249 )
250+
0 commit comments