Skip to main content

Process Mining Service WSGI for Auto-Twin

Project description

PyPI - License PyPI - Python Version PyPI - Version

Processing Mining Service (PMS) WSGI for Auto-Twin

The processing mining service (PMS) WSGI implements a RESTful API that invokes different system discovery modules to automatically create, update and delete graph models, Petri nets and automata in a system knowledge graph (SKG).

Installation

To facilitate installation, the PMS WSGI is released as a Python module, autotwin_pmswsgi, in the PyPI repository. autotwin_pmswsgi implicitly depends on pygraphviz. This dependency however cannot be resolved automatically by pip. As a preparation, you need to install pygraphviz manually, following instructions provided here. Whenever pygraphviz is available, the latest version of autotwin_pmswsgi can be easily installed with pip.

pip install autotwin_pmswsgi

Deployment

The PMS WSGI is almost ready to be deployed for production use once autotwin_pmswsgi is installed successfully. Four environment variables are additionally required to specify the Neo4j instance that holds the SKG of the system under consideration.

Name Description
NEO4J_URI URI of the Neo4j instance, e.g. neo4j://localhost:7687
NEO4J_USERNAME Username for the Neo4j instance, e.g. neo4j
NEO4J_PASSWORD Password for the Neo4j instance, e.g. 12345678
NEO4J_DATABASE Database where the SKG is stored, e.g. neo4j

After setting the above environment variables, you can start up the PMS WSGI on a Waitress server by executing

waitress-serve autotwin_pmswsgi:wsgi

Containerization

To enable containerization, the PMS WSGI is also released as a Docker image, ghcr.io/autotwineu/proc-mining-serv, in the GHCR registry. Suppose that a Docker engine is running on your machine. Deploying the PMS WSGI on a Docker container named proc-mining-serv can be done via a single command.

docker run --detach --env NEO4J_URI=<NEO4J_URI> --env NEO4J_USERNAME=<NEO4J_USERNAME> --env NEO4J_PASSWORD=<NEO4J_PASSWORD> --env NEO4J_DATABASE=<NEO4J_DATABASE> --name proc-mining-serv --pull always ghcr.io/autotwineu/proc-mining-serv

<NEO4J_URI>, <NEO4J_USERNAME>, <NEO4J_PASSWORD> and <NEO4J_DATABASE> correspond to the values of the four environment variables required by the PMS WSGI (see Deployment).

RESTful API

The PMS WSGI listens HTTP requests on port 8080 and is accessible through a RESTful API that exposes the following endpoints for different types of models. The content types of the request and response for each API endpoint are both application/json.


API Endpoints for Graph Models

POST /graph-model (create a graph model in the SKG)

Parameters

None

Body

Definition

Name Type Description
name string Name of the system to be discovered
version string Version of the system to be discovered
neo4j:interval array[number|string] Interval of the event log to be used
model:delays:seize number|string Delay in seizing a queued part
model:delays:release number|string Delay in releasing a blocked part
model:cdf:points number Maximum number of points in CDFs

Example

{
    "name": "Pizza Line",
    "version": "V4",
    "neo4j": {
        "interval": [0, 500000000]
    },
    "model": {
        "delays": {
            "seize": 30000,
            "release": 0
        },
        "cdf": {
            "points": 100
        }
    }
}

Response

Code: 201

Definition

Name Type Description
model_id string ID of the generated graph model

Example

{
    "model_id": "4:d44864fe-b050-4f74-8157-60d999e3580b:273316"
}

API Endpoints for Petri Nets

POST /petri-net (create a Petri net in the SKG)

Parameters

None

Body

None

Response

Code: 501

Definition

Name Type Description
code string Code of the HTTP error
name string Name of the HTTP error
description string Description of the HTTP error

Example

{
    "code": 501,
    "name": "Not Implemented",
    "description": "The server does not support the action requested by the browser."
}

API Endpoints for Automata

POST /automaton (create an automaton in the SKG)

Parameters

None

Body

None

Response

Code: 501

Definition

Name Type Description
code string Code of the HTTP error
name string Name of the HTTP error
description string Description of the HTTP error

Example

{
    "code": 501,
    "name": "Not Implemented",
    "description": "The server does not support the action requested by the browser."
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autotwin_pmswsgi-0.1.0.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

autotwin_pmswsgi-0.1.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page