processpiper 0.8.1
Processpiper. An open source python library to generate business process diagram using code.
Requires Python: >=3.10

<p align="center">
<img src="images/logo/processpiper-logo.png"  width="300">
</p>

![release](https://img.shields.io/pypi/v/processpiper?style=plastic)
![Wheel](https://img.shields.io/pypi/wheel/processpiper?style=plastic)
![Downloads](https://img.shields.io/pypi/dm/processpiper?style=plastic)
![Platforms](https://img.shields.io/badge/Platform%3A-win%20%7C%20ubuntu%20%7C%20osx-brightgreen?style=plastic)
[![license](https://img.shields.io/badge/license-mit-brightgreen.svg?style=plastic)](https://en.wikipedia.org/wiki/MIT_License)
[![CodeFactor](https://www.codefactor.io/repository/github/csgoh/processpiper/badge?style=plastic)](https://www.codefactor.io/repository/github/csgoh/processpiper)
![code size](https://img.shields.io/github/languages/code-size/csgoh/processmapper?style=plastic)
![python version](https://img.shields.io/pypi/pyversions/processpiper?style=plastic)
![stars](https://img.shields.io/github/stars/csgoh/processpiper?style=plastic)
![CI](https://github.com/csgoh/processpiper/actions/workflows/python-package.yml/badge.svg)
[![Twitter Follow](https://img.shields.io/twitter/follow/CSGohNZ?style=social)](https://twitter.com/CSGohNZ)

# ProcessPiper (Business Process Diagram as Code)
ProcessPiper is an open source python library to generate business process diagram using python code or [PiperFlow](https://github.com/csgoh/processpiper/wiki/Usage-Documentation#syntax) syntax. 

<h3 align="center">
  <b><a href="https://github.com/csgoh/processpiper/wiki/installation">Installation</a></b>
  •
  <b><a href="https://github.com/csgoh/processpiper/wiki/Usage-Documentation">Usage Guide</a></b>
  •
  <b><a href="https://github.com/csgoh/processpiper/wiki/Change-Logs">Changelogs</a></b>
</h3>

<br>

## Method 1: Generate business process diagram using English like PiperFlow syntax
This is a sample code to generate a business process diagram using  [PiperFlow](https://github.com/csgoh/processpiper/wiki/Usage-Documentation#syntax) syntax. 
```python
from processpiper.text2diagram import render

input_syntax = """
title: Sample Test Process
colourtheme: BLUEMOUNTAIN
    lane: End User
        (start) as start
        [Enter Keyword] as enter_keyword
        (end) as end
pool: System Search
    lane: Database System
        [Login] as login
        [Search Records] as search_records
        <Result Found?> as result_found
        [Display Result] as display_result
        [Logout] as logout
    lane: Log System
        [Log Error] as log_error

start->login: User \\nAuthenticate
login->enter_keyword: Authenticated
enter_keyword->search_records: Search Criteria
search_records->result_found: Result
result_found->display_result: Yes
display_result->logout->end
result_found->log_error: No
log_error->display_result

footer: Generated by ProcessPiper
"""

render(input_syntax, "my_process_map.png")

```

### Method 2: Generate business process diagram using Python code
This is a sample code to generate a business process diagram using Python code. The code is self-explanatory. The diagram is generated using the default colour theme.

```python
from processpiper import ProcessMap, EventType, ActivityType, GatewayType

with ProcessMap(
    "Sample Test Process", colour_theme="BLUEMOUNTAIN") as my_process_map:
    with my_process_map.add_lane("End User") as lane1:
        start = lane1.add_element("Start", EventType.START)
        enter_keyword = lane1.add_element("Enter Keyword", ActivityType.TASK)

    with my_process_map.add_pool("System Search") as pool1:
        with pool1.add_lane("Database System") as lane2:
            login = lane2.add_element("Login", ActivityType.TASK)
            search_records = lane2.add_element("Search Records", ActivityType.TASK)
            result_found = lane2.add_element("Result Found?", GatewayType.EXCLUSIVE)
            display_result = lane2.add_element("Display Result", ActivityType.TASK)
            logout = lane2.add_element("Logout", ActivityType.TASK)
            end = lane2.add_element("End", EventType.END)

        with pool1.add_lane("Log System") as lane3:
            log_error = lane3.add_element("Log Error", ActivityType.TASK)

    start.connect(login, "User \nAuthenticates").connect(
        enter_keyword, "Authenticated"
    ).connect(search_records, "Search Criteria")
    search_records.connect(result_found, "Result").connect(display_result, "Yes")
    display_result.connect(logout).connect(end)
    result_found.connect(log_error, "No").connect(display_result)

    my_process_map.set_footer("Generated by ProcessPiper")
    my_process_map.draw()
    my_process_map.save("my_process_map.png")
```

The generated diagram is as follows:
![Process Map](https://github.com/csgoh/processpiper/blob/main/images/test/test_auto_case1.png)

# Features
* Generate business process diagrams with Python code
* Alternatively business process diagram can be generated by using PiperFlow
* Business process diagrams contains
  * Diagram title
  * Pool(s)
  * Lane(s)
  * Elements:
    * Event: Start, End, Timer, Intermediate, Message, Signal, Conditional and Link
    * Activity: Task, Subprocess
    * Gateway: Inclusive, Exclusive, Parallel, Event
* Support for different colour themes (See [gallery](https://github.com/csgoh/processpiper/wiki/Gallery)) :
  * Default
  * GREYWOOF
  * BLUEMOUNTAIN
  * ORANGEPEEL
  * GREENTURTLE
  * SUNFLOWER
  * PURPLERAIN
  * RUBYRED
  * TEALWATERS
  * SEAFOAMS
* Diagrams can be saved to PNG or SVG image formats
* :new::fire: Diagrams can be exported to .bpmn XML file format


## Frontend Application
Two frontend applications have been developed to showcase ProcessPiper capability.
* [Piperoni](https://github.com/csgoh/Piperoni) - A desktop application
* [Piperita](https://piperita.streamlit.app/) - A Streamlit web application 

## Support and Community

ProcessPiper is still in the early days of development, if you have any problem, I will try my best to resolve it.<br>

* 📄 Find a solution in our [Wiki](https://github.com/csgoh/processpiper/wiki)
* ⚠️ Open an issue right here on [GitHub](https://github.com/csgoh/processpiper/issues)<br>

Any ideas or suggestions, please send it to me via [GitHub Discussions](https://github.com/csgoh/processmapper/discussions).

## How to Contribute

If you'd like to contribute, start by reading our [Contribution Guide](https://github.com/csgoh/processpiper/tree/main/contributions/CONTRIBUTING.md).<br>

Lets build great software together.