Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 5b30757

Browse files
committed
add readme
1 parent 8671183 commit 5b30757

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Integration between `bpmn-visualization` and `pm4py`
2+
This is an example integration between [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js/) and [PM4PY](https://github.com/pm4py).
3+
4+
## Architecture
5+
The application consists of two main components: the frontend written in JavaScript and the backend written in Python.
6+
* The frontend uses **bpmn-visualization** to visualize the BPMN process model and the statistics data over it.
7+
* The backend is built using **pm4py** which processes data to perform process discovery and conformance checking. The results are then communicated to the frontend through [Flask](https://flask.palletsprojects.com/) and [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
8+
9+
In addition to bpmn-visualization and pm4py, the application also leverages two other libraries, [d3](https://d3js.org/) and [BPMN layout generators](https://github.com/process-analytics/bpmn-layout-generators).
10+
* **d3** is used to manipulate colors and add a legend to the visualized BPMN diagrams.
11+
* **BPMN layout generators** is used to generate the layout of the discovered BPMN process models produced by pm4py. ⚠️ Please note that BPMN layout generators is still in an **experimental version** and may not produce optimal or visually appealing layouts.
12+
13+
![Application architecture](./architecture/architecture.svg)
14+
15+
## Prerequisites
16+
17+
You can skip this part if your system meets all the requirements listed below 👇
18+
19+
* [Backend requirements](./backend/README.md)
20+
* [Frontend requirements](./frontend/README.md)
21+
22+
23+
## Setup
24+
* Clone the project in your preferred IDE (e.g. VScode)
25+
* Prepare the backend environment:
26+
1. Navigate to the `backend` folder: `cd backend`
27+
2. Create a virtual environment for dependencies called `venv` using the following command:
28+
```sh
29+
python -m venv venv
30+
```
31+
3. Activate the created `venv` by running:
32+
* **Windows**:
33+
```sh
34+
venv\Scripts\activate.bat
35+
```
36+
* **Unix/MacOS**:
37+
```sh
38+
venv/bin/activate
39+
```
40+
4. Install the required libraries listed in `requirements.txt` by running:
41+
```sh
42+
pip install -r requirements.txt
43+
```
44+
* Prepare the frontend environment:
45+
1. Navigate to the `frontend` folder: `cd ../frontend`
46+
2. Install the required libraries listed in `package.json` by running:
47+
```sh
48+
npm install
49+
```
50+
## Run
51+
1. Navigate to the `backend` folder: `cd backend`
52+
2. Run the application:
53+
```sh
54+
python app.py
55+
```
56+
3. Open a new terminal and navigate to the `frontend`folder: `cd frontend`
57+
4. Run the development web server:
58+
```sh
59+
npm run dev
60+
```
61+
5. Access the web application on the displayed localhost: http://localhost:5173/

architecture/architecture.svg

Lines changed: 4 additions & 0 deletions
Loading

backend/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Backend requirements
2+
3+
It is assumed that the following is installed on your system:
4+
5+
* `Python 3.6` or higher: https://www.python.org/downloads/
6+
* `pip`:
7+
* **Windows**: The Python installers for Windows include pip. You can make sure that pip is up-to-date by running:
8+
```sh
9+
py -m pip install --upgrade pip
10+
py -m pip --version
11+
```
12+
* **Unix/MacOS**: Debian and most other distributions include a [python-pip](https://packages.debian.org/stable/python/python3-pip) package. You can also install pip yourself to ensure you have the latest version by running:
13+
```sh
14+
python3 -m pip install --user --upgrade pip
15+
python3 -m pip --version
16+
```
17+
18+
* `venv`: keeps your environments clean by keeping the dependencies in a specific directory for your project. You can install virtualenv by running:
19+
* **Windows**:
20+
```sh
21+
py -m pip install --user virtualenv
22+
```
23+
* **Unix/MacOS**:
24+
```sh
25+
python3 -m pip install --user virtualenv
26+
```
27+
28+
* `Graphviz`: pm4py uses Graphviz to encode the structure of process models. It is the only software that needs to be installed on your system from https://graphviz.org/download/.

frontend/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Frontend requirements
2+
3+
You will need [Node.js](https://nodejs.org/) and [npm](https://www.npmjs.com/) to be installed on your system. Node.js `installer` is not recommended, since the Node installation process installs `npm` in a directory with local permissions and can cause permissions errors when you run npm packages globally. Node version manager like [nvm](https://github.com/nvm-sh/nvm) is usually recommended as explained below.
4+
5+
* `nvm`: Node version manager to install `Node.js` and `npm`:
6+
* **Windows**:
7+
1. Donwload the latest release of [`nvm-windows`](https://github.com/coreybutler/nvm-windows#readme).
8+
2. Click on `.exe` file to install the latest release.
9+
3. Complete the installation wizard
10+
4. When done, you can confirm that nvm has been installed by running:
11+
```sh
12+
nvm -m
13+
```
14+
* **Unix/MacOS**:
15+
1. In your terminal, run the nvm installer by using `cURL` or `Wget` commands depending on the command available on your device. These commands will clone the nvm repository to a `~/.nvm` directory on your device:
16+
```sh
17+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
18+
19+
#or
20+
21+
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
22+
```
23+
2. Update your profile configuration: Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). If it doesn't automatically add nvm configuration, you can add it yourself to your profile file:
24+
```sh
25+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
26+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
27+
```
28+
3. When done, you can confirm that nvm has been installed by running:
29+
```sh
30+
command -v nvm
31+
```
32+
4. If you run into problems, you can check the [complete documentation](https://github.com/nvm-sh/nvm#installing-and-updating).
33+
* `Node.js` and `npm`: Use `nvm` to install, and use, the current latest stable version of `Node.js` and `npm` by running:
34+
```sh
35+
nvm install --lts
36+
```
37+
Verify it worked by running:
38+
```sh
39+
node --version
40+
```
41+
```sh
42+
npm --version
43+
```

0 commit comments

Comments
 (0)