jtlicardo / process-visualizer

Converting textual descriptions of processes into simplified BPMN diagrams
MIT License
9 stars 0 forks source link
bert bpmn nlp openai spacy

Process visualizer

This is an application that aims to convert textual descriptions of processes into simplified BPMN diagrams. The application uses NLP tools like spaCy and a fine-tuned BERT model for token classification to extract key information from the text. Additionally, the application leverages OpenAI's models such as gpt-3.5-turbo and gpt-4 to perform advanced tasks related to process description analysis. Finally, Graphviz is used to produce the final diagram.

The app supports the following BPMN elements:

How to run

  1. Clone the repo
  2. Download and install Graphviz, add Graphviz to the system PATH
  3. Install the required dependencies: pip install -r requirements.txt
  4. Download the necessary spaCy models:
    python -m spacy download en_core_web_sm
    python -m spacy download en_core_web_md
  5. Create an .env file in the root of the src folder with your OpenAI API key as an environment variable: OPENAI_KEY=<your_key>
  6. Run the script by running python .\src\main.py -t "Textual description of the process". Alternatively, you can run the script by providing a path to a file containing the textual description of the process: python .\src\main.py -f <path_to_file.txt>

Example inputs and outputs

Example #1

The process begins when the student logs in to the university's website. He then takes an online exam. After that, the system grades it. If the student scores below 60%, he takes the exam again. If the student scores 60% or higher on the exam, the professor enters the grade.

Show output


Example #2

The customer decides if he wants to finance or pay in cash. If the customer chooses to finance, the customer will need to fill out a loan application. After that, the customer sends the application to the bank. If the customer chooses to pay in cash, the customer will need to bring the total cost of the car to the dealership in order to complete the transaction. After the customer has chosen to finance or pay in cash, the customer must sign the contract before the transaction is completed.

Show output


Example #3

The manager sends the mail to the supplier and prepares the documents. At the same time, the customer searches for the goods and picks up the goods.

Show output


Example #4

The customer decides if he wants to finance or pay in cash. If the customer chooses to finance, two activities will happen in parallel: the customer will fill out a loan application and the manager will check the customer's info. If the customer chooses to pay in cash, the customer will need to bring the total amount to the dealership in order to complete the transaction.

Show output


Example #5

The process starts when the R&D team generates ideas for new products. At this point, 3 things occur in parallel: the first thing is the engineering team analyzing the ideas for feasibility. The engineering team also creates the technical specification. The second path involves the marketing team conducting market research for the ideas. At the same time, the design team creates visual concepts for the potential products. The third path sees the financial analysts reviewing the potential cost of the ideas. Once each track has completed its analysis, the management reviews the findings of the analysis.

Show output


Example #6

The company receives the order from the customer. If the product is out of stock, the customer receives a notification that the order cannot be fulfilled. If the product is in stock and the payment succeeds, the company processes and ships the order. If the product is in stock, but the payment fails, the customer receives a notification that the order cannot be processed.

Show output