python-eigen-ingenuity 0.5.3b1__py3-none-any.whl → 0.5.4__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.
- eigeningenuity/__init__.py +1 -1
- eigeningenuity/core/__init__.py +8 -2
- eigeningenuity/historian.py +2 -2
- eigeningenuity/historianmulti.py +74 -2
- eigeningenuity/util.py +22 -6
- {python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/METADATA +239 -104
- {python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/RECORD +10 -10
- {python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/WHEEL +1 -1
- {python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/entry_points.txt +0 -0
- {python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/top_level.txt +0 -0
eigeningenuity/__init__.py
CHANGED
|
@@ -25,5 +25,5 @@ from eigeningenuity.smartdash import get_smartdash
|
|
|
25
25
|
from eigeningenuity.sql import get_sql
|
|
26
26
|
from eigeningenuity.settings import set_azure_client_id, set_azure_tenant_id, disable_azure_auth, disable_auth_token_cache, clear_auth_token_cache, set_api_token
|
|
27
27
|
|
|
28
|
-
__all__ = ["get_historian", "get_historian_multi", "get_assetmodel", "get_elastic", "get_sql", "get_eventlog", "get_smartdash", "list_historians", "
|
|
28
|
+
__all__ = ["get_historian", "get_historian_multi", "get_assetmodel", "get_elastic", "get_sql", "get_eventlog", "get_smartdash", "list_historians", "EigenServer", "set_azure_client_id", "set_azure_tenant_id", "disable_azure_auth", "disable_auth_token_cache", "clear_auth_token_cache", "set_api_token"]
|
|
29
29
|
__version__ = pkg_resources.require("python-eigen-ingenuity")[0].version
|
eigeningenuity/core/__init__.py
CHANGED
|
@@ -103,7 +103,13 @@ class EigenServer (object):
|
|
|
103
103
|
"""
|
|
104
104
|
return _do_eigen_json_request(self.__baseurl + "eigenpluscore-servlet/prodseminfo", cmd = "LISTFACTORYTYPES",auth=self.auth, _cachetime = 10)
|
|
105
105
|
|
|
106
|
-
def listDataSources(self
|
|
106
|
+
def listDataSources(self):
|
|
107
|
+
return _do_eigen_json_request(self.__baseurl + "historian/list")
|
|
108
|
+
|
|
109
|
+
def listWritableDataSources(self):
|
|
110
|
+
return _do_eigen_json_request(self.__baseurl + "historian/listwritable")
|
|
111
|
+
|
|
112
|
+
def _listDataSources_legacy(self, type):
|
|
107
113
|
"""List the instances for a specified Eigen Ingenuity Factory Type
|
|
108
114
|
Returns None if there are no instances
|
|
109
115
|
"""
|
|
@@ -212,7 +218,7 @@ def list_data_source_types():
|
|
|
212
218
|
return get_default_server().listDataSourceTypes()
|
|
213
219
|
|
|
214
220
|
def list_data_sources(type):
|
|
215
|
-
return get_default_server().
|
|
221
|
+
return get_default_server()._listDataSources_legacy(type)
|
|
216
222
|
|
|
217
223
|
def get_default_data_source(type):
|
|
218
224
|
return get_default_server().getDefaultDataSource(type)
|
eigeningenuity/historian.py
CHANGED
|
@@ -554,7 +554,7 @@ class JsonBridgeHistorian (object):
|
|
|
554
554
|
except KeyError:
|
|
555
555
|
raise KeyError("Could not find tag(s): " + str(proto))
|
|
556
556
|
|
|
557
|
-
def writePoints(self, tag:str, points:
|
|
557
|
+
def writePoints(self, tag:str, points:list) -> bool:
|
|
558
558
|
"""
|
|
559
559
|
Writes point data to a single existing tag.
|
|
560
560
|
|
|
@@ -765,7 +765,7 @@ def list_historians(eigenserver=None) -> list:
|
|
|
765
765
|
if eigenserver is None:
|
|
766
766
|
eigenserver = get_default_server()
|
|
767
767
|
|
|
768
|
-
return eigenserver.
|
|
768
|
+
return eigenserver._listDataSources_legacy("historian")
|
|
769
769
|
|
|
770
770
|
|
|
771
771
|
def get_default_historian_name(eigenserver=None) -> str:
|
eigeningenuity/historianmulti.py
CHANGED
|
@@ -45,6 +45,9 @@ class HistorianMulti (object):
|
|
|
45
45
|
self.baseurl = baseurl
|
|
46
46
|
self.serverurl = baseurl + "multi/"
|
|
47
47
|
self.writeurl = baseurl + "write/points"
|
|
48
|
+
self.listurl = baseurl + "list"
|
|
49
|
+
self.searchurl = baseurl + "search"
|
|
50
|
+
|
|
48
51
|
self.auth = auth
|
|
49
52
|
self.historian = ""
|
|
50
53
|
if historian:
|
|
@@ -280,9 +283,78 @@ class HistorianMulti (object):
|
|
|
280
283
|
items = merge_tags_from_response(response["results"])
|
|
281
284
|
|
|
282
285
|
return format_output(output,items,tags,timestamps)
|
|
286
|
+
|
|
287
|
+
def listDataTags(self, historian:str=None, limit:int=100, match:str=""):
|
|
288
|
+
"""List all tags in a historian, or those matching a wildcard
|
|
289
|
+
|
|
290
|
+
Args:
|
|
291
|
+
historian: Name of the historian containing tags of interest
|
|
292
|
+
limit: Max number of records to return
|
|
293
|
+
match: A string that tags must match to be returned (Accepts * as wildcard character)
|
|
294
|
+
|
|
295
|
+
Returns:
|
|
296
|
+
A list of tag names
|
|
297
|
+
|
|
298
|
+
Raises:
|
|
299
|
+
URLError: When no Ingenuity instance could be found at given EigenServer, or no internet connection is available
|
|
300
|
+
RemoteServerException: When the provided historian could not be found, or the API response contains an error
|
|
301
|
+
RunTimeError/HTTPError: No response from the API
|
|
302
|
+
"""
|
|
303
|
+
metadata = self.getMetaData(historian, limit, match)
|
|
304
|
+
|
|
305
|
+
tags = [tag["tagName"] for tag in metadata]
|
|
306
|
+
|
|
307
|
+
return tags
|
|
308
|
+
|
|
309
|
+
def getMetaData(self, historian:str=None, limit:int=100, match:str=""):
|
|
310
|
+
"""Get Metadata for all tags in a historian, or those matching a wildcard
|
|
311
|
+
|
|
312
|
+
Args:
|
|
313
|
+
historian: Name of the historian containing tags of interest
|
|
314
|
+
limit: Max number of records to return
|
|
315
|
+
match: A string that tags must match to be returned (Accepts * as wildcard character)
|
|
316
|
+
|
|
317
|
+
Returns:
|
|
318
|
+
A list of dicts with metadata fields for each tag
|
|
319
|
+
|
|
320
|
+
Raises:
|
|
321
|
+
URLError: When no Ingenuity instance could be found at given EigenServer, or no internet connection is available
|
|
322
|
+
RemoteServerException: When the provided historian could not be found, or the API response contains an error
|
|
323
|
+
RunTimeError/HTTPError: No response from the API
|
|
324
|
+
"""
|
|
325
|
+
if historian is None:
|
|
326
|
+
historian = self.historian
|
|
327
|
+
|
|
328
|
+
resp = _do_historian_multi_request(self.searchurl + f'?historian={historian}&limit={limit}&search={match}',{},self.auth,get_request=True)
|
|
329
|
+
metadata = resp["tags"]
|
|
330
|
+
|
|
331
|
+
return metadata
|
|
332
|
+
|
|
333
|
+
def listHistorians(self, historian:str=None, limit:int=100, match:str=""):
|
|
334
|
+
"""Get Metadata for all tags in a historian, or those matching a wildcard
|
|
335
|
+
|
|
336
|
+
Args:
|
|
337
|
+
historian: Name of the historian containing tags of interest
|
|
338
|
+
limit: Max number of records to return
|
|
339
|
+
match: A string that tags must match to be returned (Accepts * as wildcard character)
|
|
340
|
+
|
|
341
|
+
Returns:
|
|
342
|
+
A list of dicts with metadata fields for each tag
|
|
343
|
+
|
|
344
|
+
Raises:
|
|
345
|
+
URLError: When no Ingenuity instance could be found at given EigenServer, or no internet connection is available
|
|
346
|
+
RemoteServerException: When the provided historian could not be found, or the API response contains an error
|
|
347
|
+
RunTimeError/HTTPError: No response from the API
|
|
348
|
+
"""
|
|
349
|
+
if historian is None:
|
|
350
|
+
historian = self.historian
|
|
351
|
+
|
|
352
|
+
resp = _do_historian_multi_request(self.searchurl + f'?historian={historian}&limit={limit}&search={match}',{},self.auth,get_request=True)
|
|
353
|
+
metadata = resp["tags"]
|
|
283
354
|
|
|
355
|
+
return metadata
|
|
284
356
|
|
|
285
|
-
def
|
|
357
|
+
def writePoints(self, tag:str, points: Union[dict, list]):
|
|
286
358
|
"""Write one or more points to a single tag
|
|
287
359
|
|
|
288
360
|
Args:
|
|
@@ -323,7 +395,7 @@ class HistorianMulti (object):
|
|
|
323
395
|
return ret
|
|
324
396
|
|
|
325
397
|
|
|
326
|
-
def
|
|
398
|
+
def writePointsBatch(self, data:Union[dict,list]):
|
|
327
399
|
"""Write one or more points to multiple tags
|
|
328
400
|
|
|
329
401
|
Args:
|
eigeningenuity/util.py
CHANGED
|
@@ -490,7 +490,7 @@ def update_keys(my_dict, historian):
|
|
|
490
490
|
for key, value in my_dict.items()
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
def _do_historian_multi_request(url,body,auth,write_request=False):
|
|
493
|
+
def _do_historian_multi_request(url,body,auth,write_request=False,get_request=False):
|
|
494
494
|
|
|
495
495
|
headers = {}
|
|
496
496
|
|
|
@@ -500,13 +500,29 @@ def _do_historian_multi_request(url,body,auth,write_request=False):
|
|
|
500
500
|
if settings._api_token_value_:
|
|
501
501
|
headers['X-Api-Key'] = settings._api_token_value_
|
|
502
502
|
|
|
503
|
-
|
|
503
|
+
|
|
504
|
+
if get_request:
|
|
505
|
+
resp = requests.get(url, verify=False, headers=headers).json()
|
|
506
|
+
|
|
507
|
+
else:
|
|
508
|
+
resp = requests.post(url, json=body, verify=False, headers=headers).json()
|
|
504
509
|
|
|
505
|
-
|
|
506
|
-
|
|
510
|
+
if write_request:
|
|
511
|
+
return resp['message']
|
|
507
512
|
|
|
508
513
|
return resp
|
|
509
514
|
|
|
515
|
+
def _reformat_multi_response(original_dict):
|
|
516
|
+
reformatted_dict = {}
|
|
517
|
+
|
|
518
|
+
for key, value in original_dict.items():
|
|
519
|
+
# Extract the list of data points from either 'dataPoints' or 'dataPoint' key
|
|
520
|
+
data_points = value.get('dataPoints') or value.get('dataPoint')
|
|
521
|
+
# Assign the data points list directly to the top-level key
|
|
522
|
+
reformatted_dict[key] = data_points
|
|
523
|
+
|
|
524
|
+
return reformatted_dict
|
|
525
|
+
|
|
510
526
|
def format_output(output,response,tags,timestamps=False):
|
|
511
527
|
if not timestamps:
|
|
512
528
|
items = response['results']
|
|
@@ -517,9 +533,9 @@ def format_output(output,response,tags,timestamps=False):
|
|
|
517
533
|
return response
|
|
518
534
|
elif output == "json":
|
|
519
535
|
if len(tags) == 1 and (not timestamps or len(timestamps) == 1):
|
|
520
|
-
return items[tags[0]]
|
|
536
|
+
return _reformat_multi_response(items[tags[0]])
|
|
521
537
|
else:
|
|
522
|
-
return items
|
|
538
|
+
return _reformat_multi_response(items)
|
|
523
539
|
elif output == "string":
|
|
524
540
|
return json.dumps(items,indent=4)
|
|
525
541
|
elif output == "df":
|
{python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-eigen-ingenuity
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: A python library used to query data from the Eigen Ingenuity system
|
|
5
5
|
Home-page: https://www.eigen.co/
|
|
6
6
|
Author: Murray Callander
|
|
@@ -26,26 +26,38 @@ CONTENTS <!-- omit in toc -->
|
|
|
26
26
|
- [Eigen Ingenuity](#eigen-ingenuity)
|
|
27
27
|
- [Installation](#installation)
|
|
28
28
|
- [Getting Started](#getting-started)
|
|
29
|
-
- [Historian](#historian)
|
|
29
|
+
- [Historian Multi](#historian-multi)
|
|
30
30
|
- [Data Format](#data-format)
|
|
31
|
-
- [Query Multiple
|
|
31
|
+
- [Query Multiple Tags](#query-multiple-tags)
|
|
32
32
|
- [Functions](#functions)
|
|
33
33
|
- [General Functions:](#general-functions)
|
|
34
34
|
- [List Historians](#list-historians)
|
|
35
|
-
- [Get Default Historian](#get-default-historian)
|
|
36
35
|
- [Read Functions](#read-functions)
|
|
37
36
|
- [Get Current Data Points](#get-current-data-points)
|
|
38
|
-
- [Get Number of Points](#get-number-of-points)
|
|
39
37
|
- [Get Interpolated Points in a Time Range](#get-interpolated-points-in-a-time-range)
|
|
40
38
|
- [Get Values at Given Times](#get-values-at-given-times)
|
|
41
39
|
- [Get Raw Points in a Time Range](#get-raw-points-in-a-time-range)
|
|
42
|
-
- [Get
|
|
43
|
-
- [Get Aggregates on Intervals over a Time Range](#get-aggregates-on-intervals-over-a-time-range)
|
|
40
|
+
- [Get Closest Raw Point](#get-closest-raw-point)
|
|
44
41
|
- [List Data Tags Matching Wildcard](#list-data-tags-matching-wildcard)
|
|
45
42
|
- [Get Tag Metadata](#get-tag-metadata)
|
|
46
43
|
- [Write Functions](#write-functions)
|
|
47
|
-
- [
|
|
48
|
-
- [Write Data Points to
|
|
44
|
+
- [Write Data Points to Single Tag](#write-data-points-to-single-tag)
|
|
45
|
+
- [Write Data Points to Multiple Tags](#write-data-points-to-multiple-tags)
|
|
46
|
+
- [Historian (Legacy)](#historian-legacy)
|
|
47
|
+
- [Functions (Legacy)](#functions-legacy)
|
|
48
|
+
- [General Functions (Legacy):](#general-functions-legacy)
|
|
49
|
+
- [List Historians (Legacy)](#list-historians-legacy)
|
|
50
|
+
- [Get Default Historian (Legacy)](#get-default-historian-legacy)
|
|
51
|
+
- [Read Functions (Legacy)](#read-functions-legacy)
|
|
52
|
+
- [List Data Tags Matching Wildcard (Legacy)](#list-data-tags-matching-wildcard-legacy)
|
|
53
|
+
- [Get Tag Metadata (Legacy)](#get-tag-metadata-legacy)
|
|
54
|
+
- [Get Aggregates for a Time Range (Legacy)](#get-aggregates-for-a-time-range-legacy)
|
|
55
|
+
- [Get Aggregates on Intervals over a Time Range (Legacy)](#get-aggregates-on-intervals-over-a-time-range-legacy)
|
|
56
|
+
- [Get Number of Points (Legacy)](#get-number-of-points-legacy)
|
|
57
|
+
- [Write Functions (Legacy)](#write-functions-legacy)
|
|
58
|
+
- [Create Or Update Data Tag (Legacy)](#create-or-update-data-tag-legacy)
|
|
59
|
+
- [Write Points to Single Tag (Legacy)](#write-points-to-single-tag-legacy)
|
|
60
|
+
- [Write Points to Multiple Tags (Legacy)](#write-points-to-multiple-tags-legacy)
|
|
49
61
|
- [Asset Model](#asset-model)
|
|
50
62
|
- [Execute a Raw Cypher Query](#execute-a-raw-cypher-query)
|
|
51
63
|
- [Asset Model Builder](#asset-model-builder)
|
|
@@ -109,41 +121,30 @@ For example, for a historian with Ingenuity instance "https://demo.eigen.co/" an
|
|
|
109
121
|
|
|
110
122
|
```
|
|
111
123
|
server = eigen.EigenServer("https://demo.eigen.co/")
|
|
112
|
-
demo = eigen.get_historian("Demo-influxdb",server)
|
|
124
|
+
demo = eigen.get_historian("Demo-influxdb",server) (or demo = eigen.get_historian_multi(eigenserver=server))
|
|
113
125
|
```
|
|
114
126
|
Alternatively, it is possible to set the Ingenuity instance as the environmental variable "EIGENSERVER",
|
|
115
127
|
```
|
|
116
128
|
os.environ["EIGENSERVER"] = "https://demo.eigen.co/"
|
|
117
|
-
demo = get_historian("Demo-influxdb")
|
|
129
|
+
demo = get_historian("Demo-influxdb") (or demo = eigen.get_historian_multi())
|
|
118
130
|
```
|
|
119
131
|
|
|
120
|
-
If the datasource of interest is the default datasource for the ingenuity instance, it can also be omitted:
|
|
121
132
|
|
|
122
|
-
|
|
123
|
-
os.environ["EIGENSERVER"] = "https://demo.eigen.co/"
|
|
124
|
-
demo = get_historian()
|
|
125
|
-
```
|
|
133
|
+
With the datasource set, the historian data can be queried with the functions detailed in the below section,
|
|
126
134
|
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
demo.getInterpolatedRange(tag,start,end,points)
|
|
130
|
-
demo.getCurrentDataPoints(tag)
|
|
131
|
-
demo.listDataTags()
|
|
132
|
-
```
|
|
133
|
-
Where:
|
|
134
|
-
- tag is the name of the tag to query
|
|
135
|
-
- start is the epoch timestamp (ms) of the beginning of the query window
|
|
136
|
-
- end is the epoch timestamp (ms) of the end of the query window
|
|
137
|
-
- points is the number of points to be returned
|
|
135
|
+
## Historian Multi<a id="historian"></a>
|
|
138
136
|
|
|
139
|
-
Each function will return an list, each element consisting of list of a value, timestamp and status, corresponding to a single point of data
|
|
140
137
|
|
|
141
|
-
|
|
138
|
+
#### Data Format<a id="data-format"></a>
|
|
142
139
|
|
|
143
|
-
|
|
140
|
+
The historian multi method, as the name implies allows querying from multiple historians in a single request, however a default historian can be configured, which will allow the user to pass tag names without historian, which will be assumed to belong to the default
|
|
144
141
|
|
|
142
|
+
```
|
|
143
|
+
from eigeningenuity import EigenServer, get_historian_multi
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
ei = EigenServer("demo.eigen.co")
|
|
146
|
+
datasource = get_historian_multi(default_historian="Demo-influxdb", eigenserver=ei)
|
|
147
|
+
```
|
|
147
148
|
|
|
148
149
|
|
|
149
150
|
Once the server and datasource have been configured, the historian data can be queried through functions we define in
|
|
@@ -165,9 +166,10 @@ Functions have multiple options on how to return the data, that can be specified
|
|
|
165
166
|
|
|
166
167
|
##### Example <!-- omit in toc -->
|
|
167
168
|
|
|
169
|
+
For a query like
|
|
168
170
|
|
|
169
171
|
```
|
|
170
|
-
x =
|
|
172
|
+
x = datasource.getInterpolatedRange("DEMO_02TI301.PV","1 hour ago","now",3)
|
|
171
173
|
```
|
|
172
174
|
- ##### Raw:
|
|
173
175
|
|
|
@@ -187,23 +189,15 @@ x = influx.getInterpolatedRange("DEMO_02TI301.PV","1 hour ago","now",3)
|
|
|
187
189
|
2023-11-28 10:53:39.201 36.0
|
|
188
190
|
2023-11-28 10:23:39.201 33.0
|
|
189
191
|
```
|
|
190
|
-
- ##### CSV
|
|
191
|
-
```
|
|
192
|
-
DEMO_02TI301.PV,37.1718,1701167341282,OK
|
|
193
|
-
DEMO_02TI301.PV,35.5,1701169141282,OK
|
|
194
|
-
DEMO_02TI301.PV,37.0,1701170941283,OK
|
|
195
|
-
```
|
|
196
192
|
|
|
197
|
-
The CSV output type allows for 2 additional optional parameters:
|
|
198
193
|
|
|
199
|
-
|
|
200
|
-
- filepath: Specify a directory to write the csv files to
|
|
194
|
+
|
|
201
195
|
|
|
202
|
-
#### Query Multiple
|
|
196
|
+
#### Query Multiple Tags<a id="query-multiple-tags"></a>
|
|
203
197
|
|
|
204
198
|
|
|
205
|
-
if multiple tags are queried in a single request, the data will be returned as a dictionary, with the tag IDs as its keys
|
|
206
|
-
|
|
199
|
+
if multiple tags are queried in a single request, the data will be returned as a dictionary, with the tag IDs as its keys.
|
|
200
|
+
The individual dictionary entries will retain the same format returned when querying a single tag
|
|
207
201
|
____
|
|
208
202
|
|
|
209
203
|
## Functions<a id="functions"></a>
|
|
@@ -217,7 +211,9 @@ Simple Functions to check server defaults
|
|
|
217
211
|
|
|
218
212
|
Find all historians on the instance
|
|
219
213
|
```
|
|
220
|
-
from eigeningenuity import list_historians
|
|
214
|
+
from eigeningenuity import EigenServer, list_historians
|
|
215
|
+
|
|
216
|
+
eigenserver = EigenServer("demo.eigen.co")
|
|
221
217
|
list_historians(eigenserver)
|
|
222
218
|
```
|
|
223
219
|
Where:
|
|
@@ -225,13 +221,6 @@ Where:
|
|
|
225
221
|
|
|
226
222
|
Returns a list of strings
|
|
227
223
|
|
|
228
|
-
#### Get Default Historian<a id="get-default-historian"></a>
|
|
229
|
-
###### Method: get_default_historian_name <!-- omit in toc -->
|
|
230
|
-
Find the name of the default historian of the instance, if one exists
|
|
231
|
-
```
|
|
232
|
-
from eigeningenuity import get_default_historian_name
|
|
233
|
-
get_default_historian_name(eigenserver)
|
|
234
|
-
```
|
|
235
224
|
Where:
|
|
236
225
|
- (Optional) eigenserver is the ingenuity instance of interest (If omitted will look for environmental variable EIGENSERVER)
|
|
237
226
|
|
|
@@ -256,22 +245,6 @@ Where:
|
|
|
256
245
|
|
|
257
246
|
Returns one datapoint object per tag
|
|
258
247
|
|
|
259
|
-
#### Get Number of Points<a id="get-number-of-points"></a>
|
|
260
|
-
###### Method: countPoints <!-- omit in toc -->
|
|
261
|
-
|
|
262
|
-
Find the number of datapoints in the given time frame
|
|
263
|
-
```
|
|
264
|
-
demo.countPoints(tag, start, end, output)
|
|
265
|
-
```
|
|
266
|
-
Where:
|
|
267
|
-
- tags is a list of IDs of tags to query
|
|
268
|
-
- start is the datetime object (or epoch timestamp in ms) of the beginning of the query window
|
|
269
|
-
- end is the datetime object (or epoch timestamp in ms) of the end of the query window
|
|
270
|
-
- output (optional) [See DATA FORMAT section](#data-format)
|
|
271
|
-
- multi-csv (optional) [See DATA FORMAT section](#data-format)
|
|
272
|
-
- filepath (optional) [See DATA FORMAT section](#data-format)
|
|
273
|
-
|
|
274
|
-
Returns one integer per tag
|
|
275
248
|
|
|
276
249
|
#### Get Interpolated Points in a Time Range<a id="get-interpolated-points-in-a-time-range"></a>
|
|
277
250
|
###### Method: getInterpolatedRange <!-- omit in toc -->
|
|
@@ -286,8 +259,7 @@ Where:
|
|
|
286
259
|
- end is the datetime object (or epoch timestamp in ms) of the end of the query window
|
|
287
260
|
- count is the total number of points to be returned
|
|
288
261
|
- output (optional) [See DATA FORMAT section](#data-format)
|
|
289
|
-
|
|
290
|
-
- filepath (optional) [See DATA FORMAT section](#data-format)
|
|
262
|
+
|
|
291
263
|
|
|
292
264
|
Returns a list of count-many datapoints per tag
|
|
293
265
|
|
|
@@ -302,8 +274,7 @@ Where:
|
|
|
302
274
|
- tags is a list of IDs of the tags to query
|
|
303
275
|
- timestamps is a list of timestamps at which to query data
|
|
304
276
|
- output (optional) [See DATA FORMAT section](#data-format)
|
|
305
|
-
|
|
306
|
-
- filepath (optional) [See DATA FORMAT section](#data-format)
|
|
277
|
+
|
|
307
278
|
|
|
308
279
|
Returns a list of datapoints (one at each timestamp) per tag
|
|
309
280
|
|
|
@@ -321,12 +292,165 @@ Where:
|
|
|
321
292
|
- end is the datetime object (or epoch timestamp in ms) of the end of the query window
|
|
322
293
|
- (Optional) count is the maximum number of raw datapoints to return. (default is 1000)
|
|
323
294
|
- output (optional) [See DATA FORMAT section](#data-format)
|
|
324
|
-
|
|
325
|
-
- filepath (optional) [See DATA FORMAT section](#data-format)
|
|
295
|
+
|
|
326
296
|
|
|
327
297
|
Returns a list of count-many datapoints per tag
|
|
328
298
|
|
|
329
|
-
#### Get
|
|
299
|
+
#### Get Closest Raw Point<a id="get-raw-points-in-a-time-range"></a>
|
|
300
|
+
###### Method: getClosestRawPoint <!-- omit in toc -->
|
|
301
|
+
|
|
302
|
+
Find the nearest raw point before or after a provided timestamp
|
|
303
|
+
```
|
|
304
|
+
demo.getClosestRawPoint(tags, timestamps, before_or_after, output)
|
|
305
|
+
```
|
|
306
|
+
Where:
|
|
307
|
+
- tags is a list of IDs of the tags to query
|
|
308
|
+
- timestamps is a list of timestamps of accepted formats ([See DATA FORMAT section](#data-format))
|
|
309
|
+
- (Optional) before_or_after is the position of the raw point relative to provided timestamp. Accepts ("BEFORE","AFTER","BEFORE_OR_AT","AFTER_OR_AT"). Defaults to "AFTER_OR_AT"
|
|
310
|
+
- output (optional) ([See DATA FORMAT section](#data-format))
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
Returns a list of count-many datapoints per tag
|
|
314
|
+
|
|
315
|
+
#### List Data Tags Matching Wildcard<a id="list-data-tags-matching-wildcard"></a>
|
|
316
|
+
###### Method: listDataTags <!-- omit in toc -->
|
|
317
|
+
|
|
318
|
+
Find all tags in datasource, or all tags in datasource that match a search parameter
|
|
319
|
+
```
|
|
320
|
+
demo.listDataTags(datasource, match,limit)
|
|
321
|
+
```
|
|
322
|
+
Where:
|
|
323
|
+
- (optional) match is the regex wildcard to match tags to (i.e. DEMO* will match all tags beginning with DEMO, \*DEMO* will match all tags containing DEMO anywhere. Default returns every tag
|
|
324
|
+
- (optional) limit is the max number of tags to return. Defults to 100.
|
|
325
|
+
- (optional) datasource is the historian to search for the tags within. Defaults to the default configured when instantiating historian multi
|
|
326
|
+
|
|
327
|
+
Returns a list of strings
|
|
328
|
+
|
|
329
|
+
#### Get Tag Metadata<a id="get-tag-metadata"></a>
|
|
330
|
+
###### Method: getMetaData <!-- omit in toc -->
|
|
331
|
+
|
|
332
|
+
Find units, unitMultiplier and description of each tag
|
|
333
|
+
```
|
|
334
|
+
demo.getMetaData(datasource, match,limit)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Where:
|
|
338
|
+
- (optional) match is the regex wildcard to match tags to (i.e. DEMO* will match all tags beginning with DEMO, \*DEMO* will match all tags containing DEMO anywhere. Default returns every tag
|
|
339
|
+
- (optional) limit is the max number of tags to return. Defaults to 100.
|
|
340
|
+
- (optional) datasource is the historian to search for the tags within. Defaults to the default configured when instantiating historian multi
|
|
341
|
+
|
|
342
|
+
Returns a list of dicts, each dict containing all metadata for a single tag
|
|
343
|
+
|
|
344
|
+
### Write Functions<a id="write-functions"></a>
|
|
345
|
+
The following functions are intended for users to update/create historian tags using data processed/loaded in python. They can only be run against Eigen's internal influx historians, not production systems. <!-- omit in toc -->
|
|
346
|
+
|
|
347
|
+
#### Write Data Points to Single Tag<a id="write-data-points-to-single-tag"></a>
|
|
348
|
+
###### Method: writePoints <!-- omit in toc -->
|
|
349
|
+
|
|
350
|
+
Writes sets of datapoints to the historian
|
|
351
|
+
```
|
|
352
|
+
from eigeningenuity.historianmulti import createPoint
|
|
353
|
+
|
|
354
|
+
dataPoints = []
|
|
355
|
+
point = createPoint(value, timestamp, "OK") (or point = {"value": value, "timestamp": timestamp, "status": "OK"})
|
|
356
|
+
|
|
357
|
+
dataPointList.append(dataPoint)
|
|
358
|
+
|
|
359
|
+
demo.writePoints(tag,dataPointList)
|
|
360
|
+
```
|
|
361
|
+
Where:
|
|
362
|
+
- value if the value of the datapoint at the timestamp
|
|
363
|
+
- timestamp is the datetime object (or epoch timestamp in ms) of the point
|
|
364
|
+
- "OK" is the status we give to a point that contains non-null data
|
|
365
|
+
|
|
366
|
+
Returns a boolean representing success/failure to write data
|
|
367
|
+
|
|
368
|
+
#### Write Data Points to Multiple Tags<a id="write-data-points-to-multiple-tags"></a>
|
|
369
|
+
###### Method: writePointsBatch <!-- omit in toc -->
|
|
370
|
+
|
|
371
|
+
Writes sets of datapoints to the historian
|
|
372
|
+
```
|
|
373
|
+
from eigeningenuity.historianmulti import createPoint
|
|
374
|
+
|
|
375
|
+
dataPoints = {}
|
|
376
|
+
point = createPoint(value, timestamp, "OK") (or point = {"value": value, "timestamp": timestamp, "status": "OK"})
|
|
377
|
+
dataPoints[tagName] = point
|
|
378
|
+
|
|
379
|
+
demo.writePoints(dataPoints)
|
|
380
|
+
```
|
|
381
|
+
Where:
|
|
382
|
+
- value if the value of the datapoint at the timestamp
|
|
383
|
+
- timestamp is the datetime object (or epoch timestamp in ms) of the point
|
|
384
|
+
- "OK" is the status we give to a point that contains non-null data
|
|
385
|
+
|
|
386
|
+
Returns a boolean representing success/failure to write data
|
|
387
|
+
|
|
388
|
+
# Historian (Legacy)<a id="historian-legacy"></a>
|
|
389
|
+
|
|
390
|
+
### Functions (Legacy)<a id="functions-legacy"></a>
|
|
391
|
+
|
|
392
|
+
### General Functions (Legacy):<a id="general-functions-legacy"></a>
|
|
393
|
+
|
|
394
|
+
Simple Functions to check server defaults
|
|
395
|
+
|
|
396
|
+
#### List Historians (Legacy)<a id="list-historians-legacy"></a>
|
|
397
|
+
###### Method: list_historians <!-- omit in toc -->
|
|
398
|
+
|
|
399
|
+
Find all historians on the instance
|
|
400
|
+
```
|
|
401
|
+
from eigeningenuity import list_historians
|
|
402
|
+
list_historians(eigenserver)
|
|
403
|
+
```
|
|
404
|
+
Where:
|
|
405
|
+
- (Optional) eigenserver is the ingenuity instance of interest (If omitted will look for environmental variable EIGENSERVER)
|
|
406
|
+
|
|
407
|
+
Returns a list of strings
|
|
408
|
+
|
|
409
|
+
#### Get Default Historian (Legacy)<a id="get-default-historian-legacy"></a>
|
|
410
|
+
###### Method: get_default_historian_name <!-- omit in toc -->
|
|
411
|
+
Find the name of the default historian of the instance, if one exists
|
|
412
|
+
```
|
|
413
|
+
from eigeningenuity import get_default_historian_name
|
|
414
|
+
get_default_historian_name(eigenserver)
|
|
415
|
+
```
|
|
416
|
+
Where:
|
|
417
|
+
- (Optional) eigenserver is the ingenuity instance of interest (If omitted will look for environmental variable EIGENSERVER)
|
|
418
|
+
|
|
419
|
+
Returns a string, or None
|
|
420
|
+
|
|
421
|
+
### Read Functions (Legacy)<a id="read-functions-legacy"></a>
|
|
422
|
+
|
|
423
|
+
##### The following functions are designed to help the user pull and process data from historians into a python environment <!-- omit in toc -->
|
|
424
|
+
|
|
425
|
+
The legacy method has all the same methods as above with the same parameters with the exception and additions of the following
|
|
426
|
+
|
|
427
|
+
#### List Data Tags Matching Wildcard (Legacy)<a id="list-data-tags-matching-wildcard-legacy"></a>
|
|
428
|
+
###### Method: listDataTags <!-- omit in toc -->
|
|
429
|
+
|
|
430
|
+
Find all tags in datasource, or all tags in datasource that match a search parameter
|
|
431
|
+
```
|
|
432
|
+
demo.listDataTags(match)
|
|
433
|
+
```
|
|
434
|
+
Where:
|
|
435
|
+
- (optional) match is the regex wildcard to match tags to (i.e. DEMO* will match all tags beginning with DEMO, \*DEMO* will match
|
|
436
|
+
all tags containing DEMO, and *DEMO will match all tags ending with DEMO) (Leave blank to return all tags in historian)
|
|
437
|
+
|
|
438
|
+
Returns a list of strings
|
|
439
|
+
|
|
440
|
+
#### Get Tag Metadata (Legacy)<a id="get-tag-metadata-legacy"></a>
|
|
441
|
+
###### Method: getMetaData <!-- omit in toc -->
|
|
442
|
+
|
|
443
|
+
Find units, unitMultiplier and description of each tag
|
|
444
|
+
```
|
|
445
|
+
demo.getMetaData(tags, output)
|
|
446
|
+
```
|
|
447
|
+
Where:
|
|
448
|
+
- tags is a list of IDs of tags to query
|
|
449
|
+
- output (optional) Does Not Accept CSV. Otherwise, [See DATA FORMAT section](#data-format)
|
|
450
|
+
|
|
451
|
+
Returns a dict with keys [units, unitMultiplier, description] per tag
|
|
452
|
+
|
|
453
|
+
#### Get Aggregates for a Time Range (Legacy)<a id="get-aggregates-for-a-time-range-legacy"></a>
|
|
330
454
|
###### Method: getAggregates <!-- omit in toc -->
|
|
331
455
|
|
|
332
456
|
Finds a set of aggregate values for tags over a timeframe
|
|
@@ -346,7 +470,7 @@ Where:
|
|
|
346
470
|
|
|
347
471
|
Returns a list of count-many Aggregate Data Sets per tag
|
|
348
472
|
|
|
349
|
-
#### Get Aggregates on Intervals over a Time Range<a id="get-aggregates-on-intervals-over-a-time-range"></a>
|
|
473
|
+
#### Get Aggregates on Intervals over a Time Range (Legacy)<a id="get-aggregates-on-intervals-over-a-time-range-legacy"></a>
|
|
350
474
|
###### Method: getAggregateInterval <!-- omit in toc -->
|
|
351
475
|
|
|
352
476
|
A variation of getAggregates which finds aggregates on fixed length intervals dividing the overall window
|
|
@@ -367,36 +491,27 @@ being 1 second, 1 minute, 1 hour etc. Default is whole time window.
|
|
|
367
491
|
|
|
368
492
|
Returns a list of Aggregate Data Sets (One per interval) per tag
|
|
369
493
|
|
|
370
|
-
#### List Data Tags Matching Wildcard<a id="list-data-tags-matching-wildcard"></a>
|
|
371
|
-
###### Method: listDataTags <!-- omit in toc -->
|
|
372
494
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
demo.listDataTags(match)
|
|
376
|
-
```
|
|
377
|
-
Where:
|
|
378
|
-
- (optional) match is the regex wildcard to match tags to (i.e. DEMO* will match all tags beginning with DEMO, \*DEMO* will match
|
|
379
|
-
all tags containing DEMO, and *DEMO will match all tags ending with DEMO) (Leave blank to return all tags in historian)
|
|
380
|
-
|
|
381
|
-
Returns a list of strings
|
|
382
|
-
|
|
383
|
-
#### Get Tag Metadata<a id="get-tag-metadata"></a>
|
|
384
|
-
###### Method: getMetaData <!-- omit in toc -->
|
|
495
|
+
#### Get Number of Points (Legacy)<a id="get-number-of-points-legacy"></a>
|
|
496
|
+
###### Method: countPoints <!-- omit in toc -->
|
|
385
497
|
|
|
386
|
-
Find
|
|
498
|
+
Find the number of datapoints in the given time frame
|
|
387
499
|
```
|
|
388
|
-
demo.
|
|
500
|
+
demo.countPoints(tag, start, end, output)
|
|
389
501
|
```
|
|
390
502
|
Where:
|
|
391
503
|
- tags is a list of IDs of tags to query
|
|
392
|
-
-
|
|
504
|
+
- start is the datetime object (or epoch timestamp in ms) of the beginning of the query window
|
|
505
|
+
- end is the datetime object (or epoch timestamp in ms) of the end of the query window
|
|
506
|
+
- output (optional) [See DATA FORMAT section](#data-format)
|
|
393
507
|
|
|
394
|
-
|
|
508
|
+
|
|
509
|
+
Returns one integer per tag
|
|
395
510
|
|
|
396
|
-
### Write Functions<a id="write-functions"></a>
|
|
511
|
+
### Write Functions (Legacy)<a id="write-functions-legacy"></a>
|
|
397
512
|
The following functions are intended for users to update/create historian tags using data processed/loaded in python. They can only be run against Eigen's internal influx historians, not production systems. <!-- omit in toc -->
|
|
398
513
|
|
|
399
|
-
#### Create Or Update Data Tag<a id="create-or-update-data-tag"></a>
|
|
514
|
+
#### Create Or Update Data Tag (Legacy)<a id="create-or-update-data-tag-lagacy"></a>
|
|
400
515
|
###### Method: createDataTag <!-- omit in toc -->
|
|
401
516
|
|
|
402
517
|
Creates a datatag with a specified ID, Unit type/label, and Description. You can use an existing tag name to update the metadata
|
|
@@ -410,20 +525,38 @@ Where:
|
|
|
410
525
|
|
|
411
526
|
Returns a boolean representing success/failure to create tag
|
|
412
527
|
|
|
413
|
-
#### Write
|
|
414
|
-
###### Method:
|
|
528
|
+
#### Write Points to Single Tag (Legacy)<a id="write-points-to-single-tag-legacy"></a>
|
|
529
|
+
###### Method: writePoints <!-- omit in toc -->
|
|
415
530
|
|
|
416
531
|
Writes sets of datapoints to the historian
|
|
417
532
|
```
|
|
418
|
-
from eigeningenuity.historian import
|
|
533
|
+
from eigeningenuity.historian import createPoint
|
|
419
534
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
dataPoint = {tagName: point}
|
|
535
|
+
dataPointList = []
|
|
536
|
+
dataPoint = createPoint(value, timestamp, "OK") (or point = {"value": value, "timestamp": timestamp, "status": "OK"})
|
|
423
537
|
|
|
424
538
|
dataPointList.append(dataPoint)
|
|
425
539
|
|
|
426
|
-
demo.
|
|
540
|
+
demo.writePoints(tag,dataPointList)
|
|
541
|
+
```
|
|
542
|
+
Where:
|
|
543
|
+
- value if the value of the datapoint at the timestamp
|
|
544
|
+
- timestamp is the datetime object (or epoch timestamp in ms) of the point
|
|
545
|
+
- "OK" is the status we give to a point that contains non-null data
|
|
546
|
+
|
|
547
|
+
Returns a boolean representing success/failure to write data
|
|
548
|
+
|
|
549
|
+
#### Write Points to Multiple Tags (Legacy)<a id="write-data-points-to-tags-legacy"></a>
|
|
550
|
+
###### Method: batchJsonImport <!-- omit in toc -->
|
|
551
|
+
Writes sets of datapoints to the historian
|
|
552
|
+
```
|
|
553
|
+
from eigeningenuity.historian import createPoint
|
|
554
|
+
|
|
555
|
+
dataPoints = {}
|
|
556
|
+
point = createPoint(value, timestamp, "OK") (or point = {"value": value, "timestamp": timestamp, "status": "OK"})
|
|
557
|
+
dataPoints[tagName] = point
|
|
558
|
+
|
|
559
|
+
demo.batchJsonImport(dataPoints)
|
|
427
560
|
```
|
|
428
561
|
Where:
|
|
429
562
|
- value if the value of the datapoint at the timestamp
|
|
@@ -718,8 +851,10 @@ assetmodelbuilder/
|
|
|
718
851
|
|
|
719
852
|
# Coming soon<a id="coming-soon"></a>
|
|
720
853
|
### Eigen Ingenuity <!-- omit in toc -->
|
|
721
|
-
- Integration of a new historian api that allows for cross-datasource requests, with more request options/methods.
|
|
722
854
|
- Improvements to Azure Authentication functionality, and client integration
|
|
855
|
+
- Implementation of CSV output for Historian Multi
|
|
856
|
+
- Implementation of GetAggregates for Historian Multi
|
|
857
|
+
|
|
723
858
|
|
|
724
859
|
### Asset Model Builder <!-- omit in toc -->
|
|
725
860
|
- Options for special processing. For example, an option to over-write existing nodes, rather than just update them
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
eigeningenuity/__init__.py,sha256=
|
|
1
|
+
eigeningenuity/__init__.py,sha256=IeIiIeD8tNObLjTQjsnEMaTFip9IVkR80F3pMLDMhtY,1470
|
|
2
2
|
eigeningenuity/assetmodel.py,sha256=gpimrnPOhrUCRPmi223eeZ9d5jlYP5JkMQQNJElZuX4,16785
|
|
3
3
|
eigeningenuity/auth.py,sha256=SPD5HXycsG5SBb2yf1pR5vee6gwG_UkWLkzmP02sWlY,6565
|
|
4
4
|
eigeningenuity/elastic.py,sha256=WG4nlsJXNs_-m76jtj46UfgvLgWLvn6d6QW2dk7LBI4,6648
|
|
5
5
|
eigeningenuity/events.py,sha256=wUc1TkT7047gduNuNfzkSO5tK13ErJdeI2K5cPXhNCY,3336
|
|
6
|
-
eigeningenuity/historian.py,sha256=
|
|
7
|
-
eigeningenuity/historianmulti.py,sha256=
|
|
6
|
+
eigeningenuity/historian.py,sha256=sWHOCYPPRV9nbIkLsSiJeJLpuX3CtrAFlU2l1CLn0B4,36337
|
|
7
|
+
eigeningenuity/historianmulti.py,sha256=8_N6meXvTudnDdiHCc_Blgu1kvA5jApZgJlbVZJ93BE,20772
|
|
8
8
|
eigeningenuity/settings.py,sha256=ImYplpNINf1dYaUdarZaxvwf3zHSjE1CG7bOEUqnLT0,2794
|
|
9
9
|
eigeningenuity/smartdash.py,sha256=spzoRXO4tu7cDAd4cwbyxo9RBnYvjbJoXQq8zbXkMEw,3009
|
|
10
10
|
eigeningenuity/sql.py,sha256=y-IMu1fdZjMGFcg7ue7Ubhr0-BDTiUW01x8I7tSR700,5059
|
|
11
|
-
eigeningenuity/util.py,sha256=
|
|
12
|
-
eigeningenuity/core/__init__.py,sha256=
|
|
11
|
+
eigeningenuity/util.py,sha256=AEbi-aOyyqkszSLRX7QBEXA2t7gyJKy14BKR8fu3PtE,18074
|
|
12
|
+
eigeningenuity/core/__init__.py,sha256=wIFyRpfPzwi5_ALu0icdE3lxlMZgUrZ7y4o69XpVusw,8685
|
|
13
13
|
modelbuilder/__init__.py,sha256=HSsHItu5BbGQiHYTG00QPMNDbC3RkRUaaN50YpksIUA,171
|
|
14
14
|
modelbuilder/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
modelbuilder/src/assetmodelbuilder.py,sha256=On0ndiJQQQ52vv-mo8pO2nsG5yMAk933kuBf4S8WQYg,8080
|
|
@@ -38,8 +38,8 @@ modelbuilder/src/queries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
38
38
|
modelbuilder/src/queries/cypherbuilder.py,sha256=XHChyxnTyJegfVhN949UU0T3t3Lf1CKgN0yCN8Cx8cM,10384
|
|
39
39
|
modelbuilder/src/queries/query.py,sha256=gN69uwsf-0F6_dGx9cxLGuM17960_FV58pyimJ9usxY,2472
|
|
40
40
|
modelbuilder/src/queries/typedefs.py,sha256=8uAnLfE_EyAfrdMZuotfu_YHqORXhWfgPG3Yltvyr5A,6129
|
|
41
|
-
python_eigen_ingenuity-0.5.
|
|
42
|
-
python_eigen_ingenuity-0.5.
|
|
43
|
-
python_eigen_ingenuity-0.5.
|
|
44
|
-
python_eigen_ingenuity-0.5.
|
|
45
|
-
python_eigen_ingenuity-0.5.
|
|
41
|
+
python_eigen_ingenuity-0.5.4.dist-info/METADATA,sha256=5M7kvAHq9O1c_HLs2GTAuA8ZEG2xFewIRnv1qKYdfCc,37796
|
|
42
|
+
python_eigen_ingenuity-0.5.4.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
|
|
43
|
+
python_eigen_ingenuity-0.5.4.dist-info/entry_points.txt,sha256=G3LjFQX5xKaN4mqtqCL8uaC-gRbP5T5x9r0gBTJTXXA,70
|
|
44
|
+
python_eigen_ingenuity-0.5.4.dist-info/top_level.txt,sha256=lFiZ43CY_1bmdtRidIXbA6rrY2d92Rs-9tH8pcgI-XU,28
|
|
45
|
+
python_eigen_ingenuity-0.5.4.dist-info/RECORD,,
|
{python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.5.3b1.dist-info → python_eigen_ingenuity-0.5.4.dist-info}/top_level.txt
RENAMED
|
File without changes
|