Closed ShuaiweiYu closed 11 months ago
@ShuaiweiYu , I'm delighted you used the processpiper package in your thesis. I looked at your example, and the reason you got the error is that you are attempting to connect 'gateway_2' to more than three different elements. Consider the following code segment:
gateway_1_end->activity_04->activity_05->activity_06->gateway_2
gateway_2-"reject the request"->activity_07->gateway_2_end
gateway_2-"ask the request"->activity_08->activity_09->activity_10->gateway_2_end
gateway_2-"approve the request"->activity_11->activity_12->activity_13->gateway_2_end
gateway_2-"the vendor is not valid"->activity_14->activity_15->gateway_2_end
A gateway can have a maximum of four connections. You have one incoming connection from the activity_6 element and four outgoing connections, for a total of five connections.
I suggest you change your code to reduce the complexity of your gateway. You could add another gateway after gateway_2 like the diagram below.
Hope this help.
I will change the processpiper package in the next release to have more user friendly error message.
cool! thanks for the clear and quick response. Can you also take a look at this example?
title: debug width: 10000 colourtheme: BLUEMOUNTAIN lane: (start) as start [the loan approval process starts] as activity_10 [receiving a customer request for a loan amount] as activity_11 [invoke the risk assessment web service] as activity_12 [assess the request] as activity_13 <> as gateway_1 [approve the loan] as activity_4 [deny the loan] as activity_6 [send the request] as activity_9 <> as gateway_1_end [the customer receives feedback from the assessor or approver] as activity_14 (end) as end
start->activity_10->activity_11->activity_12->activity_13->gateway_1 gateway_1-"the loan is small, the customer is"->activity_4->gateway_1_end gateway_1-"the customer is"->activity_6->gateway_1_end gateway_1-"the customer needs further review, the loan amount is for $ 10,000 or more"->activity_9->gateway_1_end gateway_1_end->activity_14->end
the conditions here specified for each situation are actually not very well displayed. In the diagram below, as you can see, the "the loan is small, the customer is" and "the customer is" fit well, but "the customer needs further review, the loan amount is for $ 10,000 or more" seems as if it belongs to somewhere above.
Hi, unfortunately, this a defect in the processpiper package. I will try to fix it in the next release.
Meantime, this is what I have as a workaround:
title: debug
width: 10000
colourtheme: BLUEMOUNTAIN
pool: Pool
lane:
(start) as start
[the loan approval process starts] as activity_10
[the customer receives feedback from the assessor or approver] as activity_14
(end) as end
lane:
[receiving a customer request for a loan amount] as activity_11
[invoke the risk assessment web service] as activity_12
[assess the request] as activity_13
<> as gateway_1
<> as gateway_2
<> as gateway_3
lane:
[approve the loan] as approve_the_loan
[send the request] as send_the_request
[deny the loan] as deny_the_loan
lane:
<> as gateway_2_end
lane:
<> as gateway_1_end
start->activity_10->activity_11->activity_12->activity_13->gateway_1
gateway_1->gateway_2
gateway_1-"the loan is \\nsmall, the \\ncustomer is"->approve_the_loan->gateway_1_end
gateway_2->gateway_3
gateway_2-"the customer is"->send_the_request->gateway_2_end
gateway_3->deny_the_loan
deny_the_loan->gateway_2_end
gateway_2_end->gateway_1_end
gateway_1_end->activity_14->end
@ShuaiweiYu In v.0.4.2, you can now have all elements in one lane:
from processpiper import text2diagram
piperflow = """title: debug
width: 10000
colourtheme: BLUEMOUNTAIN
pool: Pool
lane:
(start) as start
[the loan approval process starts] as activity_10
[the customer receives feedback from the assessor or approver] as activity_14
(end) as end
[receiving a customer request for a loan amount] as activity_11
[invoke the risk assessment web service] as activity_12
[assess the request] as activity_13
<> as gateway_1
<> as gateway_2
[deny the loan] as deny_the_loan
[approve the loan] as approve_the_loan
[send the request] as send_the_request
<> as gateway_2_end
<> as gateway_1_end
start->activity_10->activity_11->activity_12->activity_13->gateway_1
gateway_1->gateway_2
gateway_1-"the loan is \\nsmall, the \\ncustomer is"->approve_the_loan->gateway_1_end
gateway_2->deny_the_loan
gateway_2-"the customer is"->send_the_request->gateway_2_end
deny_the_loan->gateway_2_end
gateway_2_end->gateway_1_end
gateway_1_end->activity_14->end
"""
code, img = text2diagram.render(piperflow, "debug.png")
Hi there again,
I'm using this great library for my bachelor's thesis, which is about automatic BPMN generation using NLP. (therefore, the input is sort of messy). I majorly used the "render" function, and I got interesting error messages when the diagram became larger.
for example, the input syntax as
title: debug width: 10000 colourtheme: BLUEMOUNTAIN lane: any employee (start) as start [the process of an office supply request starts] as activity_01 [submits an office supply request] as activity_02 <register the requirement?> as gateway_1 lane: immediate supervisor [receive the request] as activity_03 <> as gateway_1_end lane: supervisor [approve a change] as activity_04 [ask for a change] as activity_05 [reject the request] as activity_06 <> as gateway_2 [the process end] as activity_07 [make a change] as activity_08 [return it to the petitioner employee] as activity_09 lane: petitioner employee [review the comments for the change request] as activity_10 [request go to the purchase department] as activity_11 [making quotations] as activity_12 [select a vendor] as activity_13 lane: purchase department [have] as activity_14 [choose a different vendor] as activity_15 <> as gateway_2_end [select a vendor] as activity_16 [confirm a vendor] as activity_17 [the system generate a purchase order] as activity_18 [the system send a purchase order] as activity_19 [the system wait a purchase order] as activity_20 [deliver the product] as activity_21 [the invoice received] as activity_22 <the system in any case send a notification?> as gateway_3 lane: user [know] as activity_23 <> as gateway_3_end [approval rejection or change in any of the cases required] as activity_24 (end) as end
start->activity_01->activity_02->gateway_1 gateway_1-"yes"->activity_03->gateway_1_end gateway_1-"no"->gateway_1_end gateway_1_end->activity_04->activity_05->activity_06->gateway_2 gateway_2-"reject the request"->activity_07->gateway_2_end gateway_2-"ask the request"->activity_08->activity_09->activity_10->gateway_2_end gateway_2-"approve the request"->activity_11->activity_12->activity_13->gateway_2_end gateway_2-"the vendor is not valid"->activity_14->activity_15->gateway_2_end gateway_2_end->activity_16->activity_17->activity_18->activity_19->activity_20->activity_21->activity_22->gateway_3 gateway_3-"yes"->activity_23->gateway_3_end gateway_3-"no"->gateway_3_end gateway_3_end->activity_24->end
will lead to an error message as
/usr/local/bin/python3.10 /Users/shuaiwei_yu/Desktop/bachelor-thesis/project/BPMNrenderer.py Traceback (most recent call last): File "/Users/shuaiwei_yu/Desktop/bachelor-thesis/project/BPMNrenderer.py", line 60, in
render(input_syntax, "/Users/shuaiwei_yu/Desktop/output/text06_test.png")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/processpiper/text2diagram.py", line 303, in render
exec(generated_code)
File "", line 77, in
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/processpiper/processmap.py", line 385, in draw
lane.draw_connection(all_shapes)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/processpiper/lane.py", line 221, in draw_connection
shape.draw_connection(self.painter, all_shapes)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/processpiper/shape.py", line 729, in draw_connection
) = self.find_nearest_points_same_pool_diff_lanes(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/processpiper/shape.py", line 436, in find_nearest_points_same_pool_diff_lanes
del points_source[nearest_points["source_name"]]
KeyError: 'source_name'
sometimes when you can just change the order a bit, and this will fix the problem, but with such a large diagram, this trick doesn't work. Can you give me some hints about this? Thank you very much!