python-eigen-ingenuity 0.4.38b1__tar.gz → 0.4.39b1__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.
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/PKG-INFO +1 -1
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/historianmulti.py +55 -12
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/util.py +12 -1
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/PKG-INFO +1 -1
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/MANIFEST.in +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/README.md +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/assetmodel.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/auth.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/core/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/elastic.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/events.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/historian.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/settings.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/smartdash.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/sql.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/assetmodelbuilder.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/assetmodelcsvwriter.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/assetmodelutilities.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/configmanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/connectors/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/connectors/boltconnector.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/connectors/dbconnectors.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/connectors/genericconnector.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/connectors/httpsconnector.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/csvcontentsmanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/csvwriter.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/fileanalyser.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/filemanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/messages.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/cypherfileprocessor.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/labelmanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/nodefileprocessor.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/propertymanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/relationshipfileprocessor.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/processors/relationshipmanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/queries/__init__.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/queries/cypherbuilder.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/queries/query.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/queries/typedefs.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/versionmanager.py +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/pyproject.toml +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/SOURCES.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/dependency_links.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/entry_points.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/requires.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/python_eigen_ingenuity.egg-info/top_level.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/requirements.txt +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/setup.cfg +0 -0
- {python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/setup.py +0 -0
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/historianmulti.py
RENAMED
|
@@ -79,19 +79,8 @@ class HistorianMulti (object):
|
|
|
79
79
|
|
|
80
80
|
response = _do_historian_multi_request(self.serverurl,body,self.auth)
|
|
81
81
|
|
|
82
|
+
return format_output(output,response,tags)
|
|
82
83
|
|
|
83
|
-
if output == "raw":
|
|
84
|
-
return response
|
|
85
|
-
elif output == "json":
|
|
86
|
-
if len(tags) == 1:
|
|
87
|
-
return items[tags[0]]
|
|
88
|
-
else:
|
|
89
|
-
return items
|
|
90
|
-
elif output == "string":
|
|
91
|
-
return json.dumps(items)
|
|
92
|
-
elif output == "df":
|
|
93
|
-
return multi_response_to_df(items)
|
|
94
|
-
return None
|
|
95
84
|
|
|
96
85
|
|
|
97
86
|
def getInterpolatedPoints(self, tags: Union[str, list], timestamps: Union[list, int, float, str, datetime],
|
|
@@ -234,6 +223,60 @@ class HistorianMulti (object):
|
|
|
234
223
|
|
|
235
224
|
return format_output(output,response,tags)
|
|
236
225
|
|
|
226
|
+
def getClosestRawPoint(self, tags: Union[str, list], timestamps: Union[int, float, str, datetime, list],
|
|
227
|
+
before_or_after:str="AFTER_OR_AT", output: str = "json"):
|
|
228
|
+
"""Return up to a specified number of raw datapoints between a start and end timestamp for one or more datatags
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
tags: A datatag, or list of datatags
|
|
232
|
+
start: Start of the time range. Accepts epoch milliseconds, python datetime objects, or strings of format dd-mm-YYYYTHH:MM:DD
|
|
233
|
+
end: End of the time range. Accepts epoch milliseconds, python datetime objects, or strings of format dd-mm-YYYYTHH:MM:DD
|
|
234
|
+
maxPoints (Optional): Max number of points to return. The query will return raw points in sequence from the first raw point in the timespan, until the end, or the point limit is reached. Defaults to 1000
|
|
235
|
+
output (Optional): The format in which to return the data. Accepts one of: "raw" - The raw json returned by the API, "json" - A processed version of the json response, "df" - A formatted pandas dataframe object. Defaults to "json".
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
Timestamps, values and statuses for each datapoint returned, the format is dependent on the output parameter
|
|
239
|
+
|
|
240
|
+
Raises:
|
|
241
|
+
ValueError: When invalid Output Type is given
|
|
242
|
+
URLError: When no Ingenuity instance could be found at given EigenServer, or no internet connection is available
|
|
243
|
+
RemoteServerException: When the provided historian could not be found, or the API response contains an error
|
|
244
|
+
RunTimeError/HTTPError: No response from the API
|
|
245
|
+
"""
|
|
246
|
+
before_or_after = before_or_after.upper()
|
|
247
|
+
|
|
248
|
+
if before_or_after.upper() not in ["BEFORE", "BEFORE_OR_AT", "AFTER", "AFTER_OR_AT"]:
|
|
249
|
+
raise EigenException('before_or_after must be one of ["BEFORE", "BEFORE_OR_AT", "AFTER", "AFTER_OR_AT"]')
|
|
250
|
+
|
|
251
|
+
body = {
|
|
252
|
+
"requests": {}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
tags = force_list(tags)
|
|
256
|
+
timestamps = force_list(timestamps)
|
|
257
|
+
timestamps = [time_to_epoch_millis(timestamp) for timestamp in timestamps]
|
|
258
|
+
|
|
259
|
+
for tag in tags:
|
|
260
|
+
if "/" not in tag:
|
|
261
|
+
tag = self.historian + tag
|
|
262
|
+
for index, timestamp in enumerate(timestamps):
|
|
263
|
+
request = {
|
|
264
|
+
"type": f"POINT_{before_or_after.upper()}",
|
|
265
|
+
"tag": tag,
|
|
266
|
+
"details": {
|
|
267
|
+
"at": time_to_epoch_millis(timestamp),
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
body["requests"][tag.split("/")[1] + "-" + str(index)] = request
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
response = _do_historian_multi_request(self.serverurl,body,self.auth)
|
|
275
|
+
items = merge_tags_from_response(response["results"])
|
|
276
|
+
|
|
277
|
+
return format_output(output,items,tags,timestamps)
|
|
278
|
+
|
|
279
|
+
|
|
237
280
|
def writeToTag(self, tag:str, points: Union[dict, list]):
|
|
238
281
|
"""Write one or more points to a single tag
|
|
239
282
|
|
|
@@ -442,6 +442,13 @@ def process_datapoint(data_dict,key,datapoint):
|
|
|
442
442
|
|
|
443
443
|
return data_dict
|
|
444
444
|
|
|
445
|
+
# Function to convert timestamp to a consistent format
|
|
446
|
+
def convert_df_timestamp_header(timestamp):
|
|
447
|
+
# Convert to datetime object and then format as string
|
|
448
|
+
dt = datetime.fromisoformat(timestamp)
|
|
449
|
+
return dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
450
|
+
|
|
451
|
+
|
|
445
452
|
def multi_response_to_df(api_response):
|
|
446
453
|
data_dict = {}
|
|
447
454
|
|
|
@@ -456,7 +463,9 @@ def multi_response_to_df(api_response):
|
|
|
456
463
|
data_dict = process_datapoint(data_dict,key,datapoint)
|
|
457
464
|
|
|
458
465
|
# Create DataFrame
|
|
459
|
-
df = pd.DataFrame(data_dict
|
|
466
|
+
df = pd.DataFrame(data_dict)
|
|
467
|
+
df.columns = [convert_df_timestamp_header(col) for col in df.columns]
|
|
468
|
+
df = df.T # Transpose the DataFrame
|
|
460
469
|
|
|
461
470
|
# Convert timestamp index to datetime format
|
|
462
471
|
df.index = pd.to_datetime(df.index)
|
|
@@ -506,6 +515,8 @@ def _do_historian_multi_request(url,body,auth,write_request=False):
|
|
|
506
515
|
def format_output(output,response,tags,timestamps=False):
|
|
507
516
|
if not timestamps:
|
|
508
517
|
items = response['results']
|
|
518
|
+
else:
|
|
519
|
+
items = response
|
|
509
520
|
|
|
510
521
|
if output == "raw":
|
|
511
522
|
return response
|
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/__init__.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/assetmodel.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/core/__init__.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/elastic.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/events.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/historian.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/settings.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/eigeningenuity/smartdash.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/__init__.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/__init__.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
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/csvwriter.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/fileanalyser.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/filemanager.py
RENAMED
|
File without changes
|
{python_eigen_ingenuity-0.4.38b1 → python_eigen_ingenuity-0.4.39b1}/modelbuilder/src/messages.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
|
|
File without changes
|
|
File without changes
|