SIENTIAPDE-1478
Enhance README and Codebase with PI Web API Integration - Updated README.md to include details about PI Web API integration, including configuration and export capabilities. - Modified Activities class to incorporate PI Web API export operations and error handling. - Added new API class for handling PI Web API interactions, including writing prediction and confidence data. - Updated prediction workflows to support PI Web API output configuration. - Enhanced worker and sub-workflows to include PI Web API in task queues and export processes. - Improved documentation and error handling for PI Web API connections and configurations.
This commit is contained in:
@@ -18,10 +18,16 @@ PI_WEB_API_PREDICTION_ERROR_CONFIDENCE = 13
|
||||
|
||||
class API(SientiaMonitoring):
|
||||
"""
|
||||
PI Web API operations for writing data to PI Web API.
|
||||
PI Web API operations for writing prediction data to PI Web API.
|
||||
|
||||
This class provides Temporal activities for interacting with the PI Web API
|
||||
to write data to PI Web API.
|
||||
to write prediction and confidence values to industrial systems. It handles
|
||||
error scenarios gracefully by setting error confidence values and sending
|
||||
notifications when write operations fail.
|
||||
|
||||
The class implements comprehensive error handling for both prediction and
|
||||
confidence value writes, ensuring that partial failures are properly
|
||||
reported and handled.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -66,13 +72,24 @@ class API(SientiaMonitoring):
|
||||
@activity.defn(name='write_pi_web_api_data')
|
||||
async def write_pi_web_api_data(self, input_data: dict[str, Any]) -> dict[Any, Any]:
|
||||
"""
|
||||
Write data to PI Web API.
|
||||
Write prediction and confidence data to PI Web API.
|
||||
|
||||
This method writes prediction values and confidence scores to PI Web API
|
||||
using configured web IDs. It handles errors gracefully by setting error
|
||||
confidence values when prediction writes fail and sending notifications
|
||||
for both prediction and confidence write errors.
|
||||
|
||||
Args:
|
||||
input_data (dict[str, Any]): The input data. Containing:
|
||||
- metadata (dict[str, Any]): The metadata.
|
||||
- pi_web_api_output_config (dict[str, Any]): The PI Web API output configuration.
|
||||
- data (dict[str, Any]): The data to write.
|
||||
input_data (dict[str, Any]): The input data containing:
|
||||
- metadata (dict[str, Any]): Workflow execution metadata
|
||||
- pi_web_api_output_config (dict[str, Any]): PI Web API configuration with:
|
||||
- endpoint (str): PI Web API endpoint URL
|
||||
- prediction_tags (dict[str, str]): Mapping of tag names to web IDs for predictions
|
||||
- confidence_tags (dict[str, str]): Mapping of tag names to web IDs for confidence
|
||||
- data (dict[str, Any]): Prediction data, its a dataframe converted to dict.
|
||||
Returns:
|
||||
dict[Any, Any]: Data dictionary with potentially modified confidence values
|
||||
If prediction write fails, prediction_confidence is set to error value (13)
|
||||
"""
|
||||
metadata = input_data['metadata']
|
||||
data = DataFrame(input_data['data'])
|
||||
|
||||
Reference in New Issue
Block a user