Condition Evaluator

1. Product Description

1.1. Solution Overview

The AIDEAS Condition Evaluator (AICE) is a toolkit for determining the condition of the machine as a whole or of some of its components when it is in working conditions in the factory where it is being used. The main problem that can be solved by using this solution is the identification of deviations from normal behaviour, analysing any repetitive operation the machine (or one of its components) performs periodically. With this approach the user will be able to, for example:

  • Monitor energy consumption.

  • Identify increasing vibrations.

  • Changes in temperature patterns.

1.2. Features

This AIDEAS Condition Evaluator offers the following features::

  • Providing the capability of defining the current machine configuration, defining the different components of the machine and its associated process variables, which will help the user contextualizing the obtained results.

  • Providing the capability of importing data from external databases (e.g. MongoDB) and different data sources such as CSV or EXCEL files.

  • Providing the functionality of data validation and pre-processing to ensure that the input data feed to the model is in the correct format.

  • Providing the capability of traning models with different algorithms and different data sources. And also to save them in order to be used later.

  • Obtaining predictions and displaying the results in a friendly way. There are two operating modes: on demand or offline mode and cyclic or online mode.

  • The solution determines if the system is behaving as expected or if it is deviating from normal behaviour, giving a score, with new data using the trained models.

1.2. Prerequisites

• Technical Specifications

AICE is fed with time series data in which there are several process variables distributed in columns while every row represents a single timestamp. As condition evaluation is performed under specific cycles, tasks that repeat over time, it is needed to define where the normal behaviour and subsequent datasets to compare with are happening during machine’s normal operation. In addition to raw data, a machine configuration file is needed to give context to the evaluation performed, to know exactly in which component have an effect. The AI-CE characterizes the normal behaviour during the test cycles mentioned above using the specified method for a set of interest variables. These characterized patterns will then be used and compared to future test cycles to evaluate how the machine is performing, compared to the characterized pattern. The model files can be saved, under MinIO storage, to the backend of the solutions as a pkl file to be used with new data. Solution’s outputs are displayed in the UI and also sent to the AIMP. The backend of the AI-CE is developed using python and FLASK as the framework for the API server. The backend provides the API endpoints with which the frontend can communicate to, send requests, and obtain the results. The frontend of the solution is developed in REACT.
For deployment, docker is used since it is the most widely used containerization solution. Docker also makes it easy to deploy the packaged application into the runtime environment and is widely supported by deployment tools and technologies.
For internal storage a MinIO server is used. MinIO is a High-Performance Object Storage.

• Technical Development

This AIDEAS Solution has the following development requirements:

  • Development Language: Python and Javascript.

  • Libraries: Numpy, Pandas, Scikit-Learn, PyTorch, Flask, PyYAML, SciPy, Pickle.

  • Container and Orchestration: Docker, Kubernetes.

  • User Interface: React, PrimeReact, Redux.

  • Application Interfaces: RestAPI.

  • Database engine: MongoDB, MinIO.

• Hardware Requirements

AI-CE can run on any platform that supports Docker containers.

• Software Requirements

• External Dependencies

  • MongoDB (optional, for external data storage)

  • MinIO (for object storage)

2. Installation

2.1. Environment Preparation

Ensure that all dependencies, including Docker, Python, and npm, are installed. Clone the repository from the official GitLab project and configure the backend and frontend environments as needed.

2.2. Step-by-Step Installation Process

  • Local Installation: Requires configuring backend and frontend, installing dependencies, and launching services manually.

  • Docker Installation: Uses a docker-compose.yml file to deploy the application.

  • Kubernetes Installation: Pending implementation.

3. Initial Configuration

3.1. First Steps

• Login

Users must log in using GitLab authentication before accessing secured application features.

Login Screen

• Interface Navigation

The application will open in its home screen. The tabs navigation widget is placed in the left, and the available tabs are:

HOME

  • Dashboard → Tab in which an introduction of AIAD is displayed and from which the other tabs can be accessed too.

    Home Screen

  • Help → Tab with guidelines.

    Help Screen

COMMON

  • Machine Configuration → Tab in which the machine in which the application runs is defined.

    Machine Configuration Screen

  • Data → Tab in which data is imported and visualized in table and graph formats. These options are supported:

    • Data Files: .csv, .xls or .xlsx.

      Data Files Screen

    • Establishing a connection with a MongoDB database and accessing its collections.

      MongoDB Screen

AI-CE

  • Training → Tab in which models can be trained.

    CE Model Training Screen

  • Condition Evaluation → In this tab Condition Evaluation is set and performed and its results are visualized.

    CE Model Evaluation Screen

  • Results Overview → Given a Machine Configuration file, the results can be visualized and contextualized within the machine in which the solution is applied.

    CE Results Overview Screen 1

    CE Results Overview Screen 2

The tabs “Machine Configuration”, “Data”, “Training” and “Condition Evaluation” cannot be accessed if not logged in. The login can be done by clicking in the top-right user button. A GitLab user is needed.


Machine Configuration

In the Machine Configuration screen the following actions can be performed:

Create a new Machine Configuration from scratch

  1. Add Components, Variables (name and ID), and its relation using the widgets under “Machine Configuration” Accordion.
    Create Machine Config File 1

  2. Once everything is defined, click on “Create” to see the hierarchy tree table under “Machine Configuration Overview” accordion tab. Create Machine Config File 2

  3. If needed, modify min, max, unit or description columns of the existing variables in the hierarchy tree table. Create Machine Config File 3

  4. Click on “Export” to save it in MinIO. Create Machine Config File 4

Import an existing Machine Configuration

  1. Drag and drop it under the upload widget or click on “+ Choose”. Multiple files are supported. Import Machine Config File 1

  2. Click “Upload”. Import Machine Config File 2

  • The file will be saved in MinIO.

  • If extension is not .json or if the size exceeds the size limits an error will raise.

Visualize an existing Machine Configuration file

  1. Select a Machine Configuration file from the Machine Configuration files dropdown widget. Visualize Machine Config File 1

  2. Once selected, click on “Select File” to load it. Visualize Machine Config File 2

  3. Once loaded, the Machine Configuration hierarchy tree will be available under “Machine Configuration Overview” accordion tab. Machine’s components, process variables and its relation will also be available under “Machine Configuration” accordion tab.

Edit an existing Machine Configuration file

  1. Follow the steps described in the previous functionality. Visualize Machine Config File 1

  2. Modified the desire parameter, e.g. adding new components or process variable or modifying min, max, unit or description columns of the existing variables in the hierarchy tree table as in the create a new machine configuration functionality. If components, variables or relation between them are added click on “Create” to update the hierarchy tree table.

  3. Click on “Export” to save it in MinIO.

Delete an existing Machine Configuration file

  1. Select a Machine Configuration file from the Machine Configuration files dropdown widget. Delete Machine Config File 1

  2. Once selected, click on “Delete File” to delete it from MinIO. Delete Machine Config File 2

Reset Machine Configuration screen

  • Click on “Reset Screen” button to reset it, located in the top right corner.


Data Files

In the Data Files screen the following actions can be performed:

Import a Data File

  • Drag and drop or click “+ Choose” to upload.

Delete an existing Data File

  • Make sure ”Data Files” is selected in the top left buttons.

  • Select a data file from the data files dropdown widget.

  • Once selected, click on “Delete File” to delete it from MinIO.

Visualize Data File

  • Make sure ”Data Files” is selected in the top left buttons.

  • Select a data file from the dropdown.

    Visualize Data File 1

  • Data file will be shown in table format.

    Visualize Data File 2

Establish a connection to a MongoDB database

  • Make sure ”MongoDB” is selected in the top left buttons.

  • Parametrize the connection by defining: the IP address, the port, the username, the password and the name of the database to connect to.

    Mongo Connection 1

  • Once connected, available collections will be visible.

    Mongo Connection 2

Visualize Collection data

  • Make sure ”MongoDB” is selected in the top left buttons.

  • Once the connection is established select the desired collection from the collection selection dropdown and click on “Select Collection”. Mongo Visualization 1 Mongo Visualization 2

  • Collection data will be shown in table format under “Data Visualization Table” accordion tab. Mongo Visualization 3

  • If variables are not sorted in columns, the following information is needed:

    • First, check the checkbox below “Connect” button. Mongo Visualization 42

    • Define the name of the columns containing the variables names, the values and the index of the time series. Mongo Visualization 5

    • Click on “Select Collection” again.

    • Collection data will be shown in table format under “Data Visualization Table” accordion tab and would not be rearranged but now it is possible to plot the variables.

Visualize Data Chart

  • Independently of the selected source, once data is loaded.

  • Under “Data Visualization Chart” accordion tab, select the desire variable, up to 5, to display from the “Y axis variables” dropdown. X axis variable can be selected too by enabling “Choose X axis variable” checkbox and selecting the variable from the “X axis variable” dropdown. Chart Visualization 1

  • After clicking on “Plot” button a warning popups and after accepting it, a scatter plot will be shown.

    Chart Visualization 2 Chart Visualization 3


Training

In the Training screen the following actions can be performed:

Train a model

  1. First of all, the data source must be selected using the radio buttons on the top left side of the “Data Source Selection” section, “MongoDB” or “Data Files”. Depending on the selection, the dropdown widget will show the existing files under the specific folder inside MinIO or the available collections inside the database. To be able to select “MongoDB” radio button, the user must be connected to the database, see establish a connection to a MongoDB database above. Finally, click on “Select Data” button.

  2. Once the data is loaded the model can be parameterized, specifying the following information: Training 1

    • The approach, statistical or AI (CNNs), using “Approach” dropdown.

    • If statistical approach is selected, the metric to define the different thresholds must be defined.

    • If AI approach is selected, the algorithm and the metric to compute the residues must be defined. Training 12

    • The time variable, using “Time Variable” dropdown.

    • The test cycle ID variable, using “Cycle ID Variable” dropdown.

    • The test cycle IDs to focus the training on, using “Cycle IDs” input text.

    • The characterizing variable for the selected test cycles, using “Characterizing Variable” dropdown.

    • If the test cycle is a ramp test, meaning that a certain value needs to be reached, for example moving a spindle at a certain ratation speed. The “Ramp test cycle” checkbox has to be checked. Following information needs to be provided. Training 3

      • Only for ramp tests. The target values to reach for every test cycle ID selected, using “Select target values for the selected Cycle IDs” input text.

      • Only for ramp tests. The % of the maximum value to reach, for example warming up the spindle at 25%, 50%, 75% and 100% of the maximum spondle rotation speed, using “% for the target values” dropdown.

    • The different variables to study during the specified test cycles, using “Select Variables” dropdown.

    • To enable or disable AI explainability.

    • See an example of parameterization below: Training 4

  3. Finally, click on “Training” to start the training process.

  4. Once finished, a report will be shown in the “Training Results” section. Training 5

Visualize training results.

  • Under “Data Visualization Chart” accordion tab, select the desire variable and the desired cycle ID from the”Select Variable” and “Select Cycle ID” dropdowns respectively. Training 6

  • After clicking on “Plot” button a plot with the different identified zones will be shown. The zones are the following:.

  • Ok zone, in green → If mean2std has been selected as metric, is determined by the mean +- 2.5 times the standard deviation. If percentile95 has been selected as metric, is determined by the q1,q3 +- 1.5 times the IQR.

  • Warning zone, in yellow, → If mean2std has been selected as metric, determined by the mean +- 4.5 times the standard deviation. If percentile95 has been selected as metric, is determined by the q1,q3 +- 3 times the IQR.

  • Ko zone → If mean2std has been selected as metric, above +- 4.5 times the standard deviation. If percentile95 has been selected as metric, above +- 3 times the IQR. Training 7

Save a trained model

  • Click “Save” to store the model.

  • A model name is suggested but can be edited using the input text above “Save” button. Save Training Results

Reset Training screen

  • Click on “Reset Screen” button to reset it, located in the top right corner.

3.2. Main Workflows

Condition Evaluation

In the Condition Evaluation screen the following actions can be performed:

Import an existing model

  • Drag and drop it under the upload widget or click on “+ Choose”. Multiple files are supported.

  • Click on “Upload”.

  • The file will be saved in MinIO.

  • If extension is not .pkl or if the size exceeds the size limits an error will raise.

Delete an existing model

  • Select a model file from the model files dropdown widget.

  • Once selected, click on “Delete Model” to delete it from MinIO.

Perform condition evaluation

  1. First of all, a model has to be selected using the “Model Selection” dropdown widget. Once selected a report of the selected model will be shown in the bottom of the “Model Selection” section.

  2. Then, the data source must be selected using the radio buttons on the top left side of the “Data Source Selection” section, “MongoDB” or “Data Files”. Depending on the selection the dropdown widget will show the existing files under the specifies folder inside MinIO or the available collections. To be able to select “MongoDB” radio button, first the user must be connected to the database, see Establish a connection to a MongoDB database above. Finally, click on “Select Data” button. There are two working modes:

  • Offline or on demand mode.

    • Cyclic results are disabled.

    • Finally, click on “Obtain Results” to perform the condition evaluation.

    • A report will be shown in the “Condition Evalution Results” section. Offline Results 1 Offline Results 2

  • Online or cyclic mode.

    • Only works if a database is selected as the data source.

    • Cyclic results are enabled.

    • Finally, click on play button to perform the condition evaluation cyclically. The interval is defined in the config.yml file.

    • Results are shown cyclically. A report will be shown in the “Condition Evalution Results” section. If visualization has been parameterized, it will be updated automatically. Contextualized results in the results overview screen are also updated.

    • Click on stop button stops the operation. Online Results 1 Online Results 2 Online Results 3

Visualize the results

  • Under “Data Visualization Chart” accordion tab, select the desire variable and the desired cycle ID from the”Select Variable” and “Select Cycle ID” dropdowns respectively. X axis variable can be selected too by enabling “Choose X axis variable” checkbox and selecting the variable from the “X axis variable” dropdown. Chart Results 1

  • After clicking on “Plot” button a plot with the different identified zones will be shown. The zones are the following:

    • Ok zone, in green → If mean2std has been selected as metric, is determined by the mean +- 2.5 times the standard deviation. If percentile95 has been selected as metric, is determined by the q1,q3 +- 1.5 times the IQR.

    • Warning zone, in yellow, → If mean2std has been selected as metric, determined by the mean +- 4.5 times the standard deviation. If percentile95 has been selected as metric, is determined by the q1,q3 +- 3 times the IQR.

    • Ko zone → If mean2std has been selected as metric, above +- 4.5 times the standard deviation. If percentile95 has been selected as metric, above +- 3 times the IQR.

    • All identified test cycles inside the data are also displayed in separate lines. Chart Results 2

  • Under “Data Evolution Chart” accordion tab, the evolution of the status of the selected variable, for the selected cycle ID, is shown. The time evolution of the different zones, ok, warning and ko, is shown. Chart Results 3

  • Finally, under “Data Visualization Table Format” accordion tab, the information displayed above is shown in table format. The following information, for each identified test cycle, is shown:

    • Initial and last timestamps.

    • Percentage of test cycle ID points within each zone, ok, warning and ko.

    • Number of samples of the test cycle.

    • Raw values of the test cycle.> Chart Results 4

  • The table can be exported as .csv, .xlsx or .pdf, using the butons in the top left corner.

Reset Condition Evaluation screen

  • Click on “Reset Screen” button to reset it, located in the top right corner.

Results Overview

  • Given a Machine Configuration file, in the Results Overview screen the results can be visualized, contextualized within the machine in which the solution is applied. The different components within the different test cycles selected are visualized. If machine configuration file is not selected, results can not be contextualized, therefore nothing is displayed. Results Overview

  • If online mode is selected, contextualized results are also updated automatically. Results Overview Online

4. General Queries

4.1. Installation and Configuration Contact (If Service Provided)

For installation and configuration support, users should refer to the official GitLab project or the associated organization (IKERLAN).

4.2. Support

Company

Website

Logo

IKERLAN

https://www.ikerlan.es/

Ikerlan logo

4.3. Licensing

  • The solution is licensed under AGPLv3 or PRIVATE licensing models.

  • Pricing and licensing details are available upon request.

Subject

Value

Payment Model

Quotation under request

Price

Quotation under request

5. User Manual

5.1. Glossary of Terms

– COMPLETE –

5.2. API Documentation

By default, the backend server is served on port 5000 and allows the following API methods. These methods are accessible through the application frontend, or by sending the proper request using tools like Postman, or directly with Python code.

Resource

GET

POST

PUT

DELETE

/machineConfig/<user_id>

Supported

Supported

Supported

/machineConfig/<user_id>/upload_machineConfig

Supported

Supported

/dataFiles/<user_id>

Supported

Supported

/dataFiles/<user_id>/upload_dataFile

Supported

Supported

/dataMongo

Supported

Supported

/dataMongo/connection

Supported

/algorithmListCE

Supported

Supported

/metricsListCE

Supported

/trainingCE

Supported

/trainingCE/results

Supported

/trainingCE/saveModel

Supported

/models/<user_id>

Supported

Supported

Supported

/conditionEvaluation/model

Supported

/conditionEvaluation

Supported

/conditionEvaluation/results

Supported

/startJob

Supported

Supported

/stopJob

Supported

/jobResults

Supported

5.3 Machine Configuration

/machineConfig/<user_id>

  • GET → Get a list of the Machine Configuration file names existing under MinIO folder, which is specified in config.yml.

  • POST → Sends the selected Machine Configuration filename to the backend.

  • PUT → Sends the defined Machine Configuration to be stored as a JSON file under MinIO.

    GET response type:
    [{    
      "id": 0,
      "name": "myFileName.json"
    }, {}, {}]
    
    POST request type:
    {    
      "username": "ikerlan",
      "filename": "lookUpTable.json"
    }
    POST response type:
    {
      "machine": "myMachine",
      "components": [],
      "variables": [],
      "componentDependantVariables": []
    }
    
    PUT request type:
    {    
      "username": "ikerlan",
      "filename": "fileName.json",
      "machineTree": {} 
    }
    

/machineConfig/<user_id>/upload_machineConfig

  • POST → Stores a list of Machine Configuration files (machineConfig[]) in JSON format under MinIO.

  • DELETE → Deletes the selected Machine Configuration file under MinIO.

    DELETE request type:
    {    
      "username": "ikerlan",
      "filename": "fileName.json"
    }
    

5.4 Data Files

/dataFiles/<user_id>

  • GET → Get a list of data file names existing under MinIO.

  • POST → Given a data file name, returns the column names and the data to be visualized.

    • Obtain column names

    • Obtain data file rows (given the number of rows to get and the starting row)

    • Obtain data file columns (given the column names to get)

    • Obtain data (given the number of rows to get)

      GET response type:
      [{    
        "id": 0,
        "name": "myFileName.csv"
      }, {}, {}, ...]
      
      POST obtain column names 
      Request type:
      {    
        "username": "ikerlan",
        "filename": "myFileName.csv",
        "colNames": true
      }
      Response type:
      {
        "filename": "myFileName.csv",
        "totalRows": int,
        "colNames": []
      }
      
      POST obtain data file rows
      Request type:
      {    
        "username": "ikerlan",
        "filename": "myFileName.csv",
        "nRows": int,
        "startingRow": int
      }
      Response type:
      {
        "filename": "myFileName.csv",
        "dfDict": {}
      }
      
      POST obtain data file columns
      Request type:
      {    
        "username": "ikerlan",
        "filename": "myFileName.csv",
        "xVar": "xVar",
        "yVars": []
      }
      Response type:
      {
        "xVarName": "xVar",
        "xVarValues": [],
        "yVarsNames": ["yVar", "yVar1", ...],
        "yVarsValues": [[],[],...]
      }
      
      POST obtain data
      Request type:
      {    
        "username": "ikerlan",
        "filename": "myFileName.csv",
        "nRows": int,
      }
      Response type:
      {
        "filename": "myFileName.csv",
        "totalRows": int,
        "colNames": [],
        "dfDict": {}
      }
      

/dataFiles/<user_id>/upload_dataFile

  • POST → Stores a list of data files (dataFile[]) in .csv, .xls, or .xlsx formats under MinIO.

  • DELETE → Deletes the selected data file under MinIO.

    DELETE request type:
    {    
      "username": "ikerlan",
      "filename": "dataFile.csv"
    }
    

5.5 MongoDB Data

/dataMongo

  • GET → Get a list of MongoDB collections in the established DB connections.

  • POST → Given a collection name, returns the column names and the data to be visualized.

    • Obtain collection data

    • Obtain collection data → given the name of the columns where the variable names, the variable values and the collection index (Time variable) are.

    • Obtain collection data by columns → given the column names to get.

      POST obtain column names 
      Request type:
      {    
        "collection": "collectionName",
        "nRows": int,
        "selectedColVarNames": "",
        "selectedColValues": "",
        "selectedColIndex": ""
      }
      Response type:
      {
        "collection": "collectionName",
        "totalRows": int,
        "colNames": [],
        "dfDict": {},
        "varsInCol": []
      }
      
      POST obtain column names 
      Request type:
      {    
        "collection": "collectionName",
        "nRows": int,
        "startingRow": int,
      }
      Response type:
      {
        "collection": "collectionName",
        "totalRows": int,
        "colNames": [],
        "dfDict": {}
      }
      
      POST obtain column names 
      Request type:
      {    
        "collection": "collectionName",
        "xVar": "",
        "yVars": [],
        "selectedColVarNames": "",
        "selectedColValues": "",
        "selectedColIndex": "",
      }
      Response type:
      {
        "xVarName": "xVar",
        "xVarValues": [],
        "yVarsNames": ["yVar", "yVar1", ...],
        "yVarsValues": [[],[],...]
      }
      

/dataMongo/connection

  • POST → Establishes a connection with a MongoDB database given a set of connection parameters.

    POST request type:
    {    
      "user": "",
      "password": "",
      "ip": "",
      "port": int,
      "dbName": ""
    }
    

5.6 Condition Evaluation Resources

/algorithmListCE

  • GET → Get a list of available algorithms to train models with.

  • POST → Given an algorithm, returns the list of parameters and their default values.

    GET response type:
    [{
      "name": "algorithm"
    }, {}, {}, ...]
    
    POST obtain column names 
    Request type:
    {    
      "selectedAlgorithm": "algorithm"
    }
    Response type:
    {
      "algorithmParamsList": ["parameter1":{
        "description": "", 
        "dataType": "", 
        "rangeMin": "", 
        "rangeMax": int, 
        "defaultValue": int}, {}, {}, ...]
    }
    

/metricsListCE

  • GET → Get a list of available metrics during model training.

    GET response type:
    [{
      "name": "metric"
    }, {}, {}, ...]
    

5.7 Training Condition Evaluation Models

/trainingCE

  • POST → Sends training parameters and obtains information about the trained model.

    POST request type:
    {    
    "username": "ikerlan",
    "selectedDataFile": "dataFile.csv",
    "selectedCollection": "collectionName",
    "selectedColVarNames": "",
    "selectedColValues": "",
    "selectedColIndex": "",
    "connectionParams": {},
    "selectedApproach": "statistical",
    "selectedVarTime": "",
    "selectedVarCycleID": "",
    "selectedCycleIDs": [],
    "selectedCharacterizingVar": "",
    "isTestRamp": bool,
    "selectedCharacterizingVarTargetValues": [],
    "selectedCharacterizingVarTargetValuesPercentage": [],
    "selectedVars": [],
    "machineConfig":  {"components": [], "variables": []},
    "explainability": bool
    }
    POST response type:
    {
    "trainingReport": "",
    "modelName": "",
    "modelCycles": [],
    "modelVars": []
    }
    

/trainingCE/results

  • POST → Get the results of the training given the desired variables.

    POST request type:
    {    
    "username": "ikerlan",
    "yVar": "",
    "cycle": int,
    }
    POST response type:
    {
    "selectedCycle": int,
    "selectedVar": "",
    "meanValuesX": [],
    "meanValuesY": [],
    "warningValuesX": {"up":[], "down":[]},
    "warningValuesY": {"up":[], "down":[]},
    "okValuesX": {"up":[], "down":[]},
    "okValuesY": {"up":[], "down":[]},
    "meanValues": [],
    "stdValues": [],
    }
    

/trainingCE/saveModel

  • POST → Stores the trained model in .pkl under MinIO folder, which is specified in config.yml file.

    POST request type:
    {    
      "username": "ikerlan",
      "modelName": "myModel.pkl",
    }
    

5.8 Condition Evaluation, testing models

/models/<user_id>

  • GET → Gets the list of Model files under MinIO folder, which is specified in config.yml file.

  • POST → Stores a list of Model files, modelFile[], in .pkl format under MinIO folder, which is specified in config.yml file.

  • DELETE → Deletes the selected Model file under MinIO folder, which is specified in config.yml file.

    GET response type:
    [{    
      "id": 0,
      "name": "myFileName.pkl"
    }, {}, {}]
    
    
    ```json
    DELETE request type:
    {    
      "username": "ikerlan",
      "filename": "model.pkl"
    }
    

/conditionEvaluation/model

  • POST → Sends the selected model and get the model information and the training results.

    POST request type:
    {    
      "username": "ikerlan",
      "selectedModel": "model.pkl",
      "machineConfig":  {"components": [], "variables": []}
    }
    POST response type:
    {
      "trainingReport": "",
      "modelName": "",
      "modelVars": []
    }
    

/conditionEvaluation

  • POST → Get the results from performing condition evaluation, given a model and a dataset.

    POST request type:
    {    
      "username": "ikerlan",
      "selectedDataFile": "myFile.csv",
      "selectedCollection": "myCollection",
      "selectedColVarNames": "",
      "selectedColValues": "",
      "selectedColIndex": "",
      "connectionParams": {},
      "selectedModel": "myModel.pkl",
    }
    POST response type:
    {
        "ceReport": "", 
        "modelCycles": [],
        "modelVars": [],
        "contextTestResults": {"testCycleID": int, "resultsByVar": [], "resultsByComponent": []}
    }
    
    resultsByVar, one per variable, example:
    {
        "var_id": 30066,
        "var_name": "Acc.RamTip.Z.rms",
        "component": "Mandrino",
        "startTS": "2023-11-14 09:28:22",
        "endTS": "2023-11-14 09:28:36",
        "percentOk": 100.0,
        "percentWarning": 0.0,
        "percentKo": 0.0,
        "status": "OK"
    }
    
    ```json
    resultsByComponentMP, one per component, example:
    [
        {
            "var_id": 10011,
            "var_name": "Coppia.Z",
            "component": "Ram",
            "startTS": "2023-11-14 09:28:22",
            "endTS": "2023-11-14 09:28:36",
            "percentOk": 100.0,
            "percentWarning": 0.0,
            "percentKo": 0.0,
            "status": "OK"
        },
        {
            "var_id": 30056,
            "var_name": "Acc.RamTip.Z.1100",
            "component": "Mandrino",
            "startTS": "2023-11-14 09:28:22",
            "endTS": "2023-11-14 09:28:36",
            "percentOk": 93.33333333333333,
            "percentWarning": 6.666666666666667,
            "percentKo": 0.0,
            "status": "WARNING"
        }
    ]
    

/conditionEvaluation/results

  • POST → Get condition evaluation results given the desired variables.

    POST request type:
    {    
        "username": "ikerlan",
        "yVar": "",
        "cycle": int
    }
    POST response type:
    {
        "selectedCycle": int,
        "selectedVar": "",
        "meanValuesX": [],
        "meanValuesY": [],
        "warningValuesX": {"up":[], "down":[]},
        "warningValuesY": {"up":[], "down":[]},
        "okValuesX": {"up":[], "down":[]},
        "okValuesY": {"up":[], "down":[]},
        "meanValues": [],
        "stdValues": [],
        "testCycles": [{"label": "", "xValues": [], "yValues": []}],
        "testResults": {"variable": "", "cycleID": int, "startTS": "", "endTS": "", "percentOk": double, "percentWarning": double, 
                        "percentKo": double, "nSamples": int, "rawValues": []},
    }
    

5.9 Cyclic Mode

/startJob

  • GET → Configures, add the cyclic task to the queue and starts the job. Sockets are used to update the UI every time a new results is obtained. If the cyclic task has been stopped, the job is resumed.

  • POST → Sends the necessary data to obtain the results from such as: the machine configuration file, the collection where data is gathered from, the model which will be evaluated and so on.

    GET response type:
    {    
      "message": ""
    }
    
    POST obtain column names 
    Request type:
    {    
      "username": "ikerlan",
      "machineConfig": {"components": [], "variables": []},
      "selectedCollection": "myCollection",
      "selectedColVarNames": "",
      "selectedColValues": "",
      "selectedColIndex": "",
      "connectionParams": {},
      "selectedModel": "myModel.pkl",
      "selectedModelVars": []
    }
    Response type:
    {
      "message": "",
    }
    

/stopJob

  • POST → Stops the cyclic task. If a job has already been scheduled, it will be proccesed.

    GET response type:
    {    
      "message": ""
    }
    

/jobResults

  • POST → Sends the results for visualization purposes.

    POST obtain column names 
    Request type:
    {    
      "yVars": []
    }
    Response type:
    [{
      "selectedCycle": "",
      "selectedVar": "",
      "centralValuesX": [],
      "centralValuesY": [],
      "warningValuesX": {"up":[], "down":[],},
      "warningValuesY": {"up":[], "down":[],},
      "okValuesX": {"up":[], "down":[],},
      "okValuesY": {"up":[], "down":[],},
      "centralValues": [],
      "deviationValues": [],
      "testCycles": [{"label": "", "xValues": [], "yValues": []}],
      "testResults": {"variable": "", "cycleID": int, "startTS": "", "endTS": "", "percentOk": double, "percentWarning": double, 
                      "percentKo": double, "nSamples": int, "rawValues": []},
      "testResultsFormatted": {"label": "", "xValues": [], "yValues": [], "rawValues": ""}
    }]
    

5.10 Sockets message (only in Cyclic Mode)

Sockets routine is handled by my_scheduled_results() function in socket_server.py. This function is executed cyclically as defined when calling /startJob method and performs the following operations

/startJob

  • Gets the data interval to get the data from the database. During the first run, current datetime is taken as the last time and one month prior as the first time to considered, both datetimes in UTC+0. In the next runs these values are updated, e.g. second run would be from current datetime to current datetime plus the interval defined.

  • Data is read from the database.

  • Results are obtained.

  • The following messages are sent:

    • Ok message:

    {
      "status": "ok",
      "message": f"Results obtained.\nFrom: {iniTS_string}, To: {endTS_string}\n{list(report.values())[-1]}",
      "condition_evalution_results": {"ceReport": "", "dataVariables": [], "outliersTableValues": [], "outliersTableColNames": [],
                                    "contextTestResults": {"resultsByVar": [], "resultsByComponent": []}}
    }
    
    • Warning message, if there is no data:

    {
      "status": "warn",
      "message": f"No data found for the current time period.\nFrom: {iniTS_string}, To: {endTS_string}"
    }
    
    • Error message, if an error or exception happened:

    {
      "status": "error",
      "message": f"Error getting data!\n{ msg['message']},\nFrom: {iniTS_string}, To: {endTS_string}"
    }
    {
      "status": "error",
      "message": f"Error getting results!\n{ msg['message']},\nFrom: {iniTS_string}, To: {endTS_string}"
    }
    {
      "status": "error",
      "message": f"Exception happened while obtaining cyclic results.\nException: {str(e)},\nFrom: {iniTS_string}, To: {endTS_string}"
    }
    

5.11. Console Commands List

  • npm install for frontend dependencies.

  • pip install -r dev.txt for backend dependencies.

  • docker-compose up --build for Docker-based deployment.

  • python server.py to launch the backend server.

  • npm run dev to start the frontend server.