Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OPTIS_App
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OPTIS
OPTIS_App
Commits
efd9e114
Commit
efd9e114
authored
1 year ago
by
Aleksandra Dimitrova
Browse files
Options
Downloads
Patches
Plain Diff
backend changes
parent
d9cca530
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/eventlog.py
+4
-15
4 additions, 15 deletions
backend/eventlog.py
backend/petrinet.py
+6
-8
6 additions, 8 deletions
backend/petrinet.py
with
10 additions
and
23 deletions
backend/eventlog.py
+
4
−
15
View file @
efd9e114
...
...
@@ -127,8 +127,8 @@ def format_check(name):
def
get_active_cases
(
name
):
event_log_df
=
convert_to_dataframe
(
name
)
active_cases
=
event_log_df
.
groupby
(
'
CaseID
'
).
filter
(
lambda
x
:
'
order completed
'
not
in
x
[
'
Activity
'
].
values
)[
'
CaseID
'
].
unique
().
tolist
()
print
(
active_cases
)
active_cases
=
event_log_df
.
groupby
(
'
CaseID
'
).
filter
(
lambda
x
:
(
'
order completed
'
not
in
x
[
'
Activity
'
].
values
)
and
(
'
attempt delivery A
'
not
in
x
[
'
Activity
'
].
values
)
and
(
'
attempt delivery B
'
not
in
x
[
'
Activity
'
].
values
)
and
(
'
attempt delivery C
'
not
in
x
[
'
Activity
'
].
values
))
[
'
CaseID
'
].
unique
().
tolist
()
#
print(active_cases)
return
active_cases
...
...
@@ -272,8 +272,8 @@ def generate_event_log(time):
business_process
.
event_log_flag
=
True
env
.
process
(
model
.
run_process
(
env
,
business_process
))
env
.
run
(
until
=
time
)
export_to_csv
(
business_process
,
r
'
Frontend/export/event
log.csv
'
)
export_to_xes
(
business_process
,
r
'
Frontend/export/event
log.xes
'
)
export_to_csv
(
business_process
,
r
'
static/e
log.csv
'
)
export_to_xes
(
business_process
,
r
'
static/e
log.xes
'
)
def
show_active_cases
(
name
):
...
...
@@ -310,14 +310,3 @@ def show_active_cases(name):
reslist
.
append
(
tup
)
return
reslist
def
main
():
# generate_event_log(10000)
# print(get_state(5, "eventlog.xes"))
# print(format_check("eventlog.xes"))
print
(
show_active_cases
(
"
eventlog.csv
"
))
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
backend/petrinet.py
+
6
−
8
View file @
efd9e114
...
...
@@ -19,9 +19,6 @@ def generate_petri_net():
# print(net)
# pm4py.view_petri_net(net, initial_marking, final_marking)
for
t
in
net
.
transitions
:
print
(
"
\n
Transition:
"
+
t
.
name
)
return
net
,
initial_marking
,
final_marking
def
decorate_petri_net
(
case
,
name
):
...
...
@@ -55,10 +52,10 @@ def decorate_petri_net(case, name):
decoration
=
{}
for
t
in
net
.
transitions
:
print
(
str
(
t
.
label
))
#
print(str(t.label))
if
str
(
t
.
label
)
in
event_names
:
decoration
.
update
({
t
:
{}})
decoration
[
t
].
update
({
"
color
"
:
"
blue
"
})
decoration
[
t
].
update
({
"
color
"
:
"
#E6F1FA
"
})
decoration
[
t
].
update
({
"
label
"
:
t
.
label
})
...
...
@@ -97,19 +94,20 @@ def decorate_petri_net_with_rec(case, rec, name):
rec_name
=
activity_mapping
[
rec
]
for
t
in
net
.
transitions
:
print
(
str
(
t
.
label
))
#
print(str(t.label))
if
str
(
t
.
label
)
in
event_names
:
decoration
.
update
({
t
:
{}})
decoration
[
t
].
update
({
"
color
"
:
"
blue
"
})
decoration
[
t
].
update
({
"
color
"
:
"
#E6F1FA
"
})
decoration
[
t
].
update
({
"
label
"
:
t
.
label
})
elif
str
(
t
.
label
)
==
rec_name
:
decoration
.
update
({
t
:
{}})
decoration
[
t
].
update
({
"
color
"
:
"
green
"
})
decoration
[
t
].
update
({
"
color
"
:
"
#0072BC
"
})
decoration
[
t
].
update
({
"
label
"
:
t
.
label
})
# pm4py.view_petri_net(net, initial_marking, final_marking, decorations = decoration)
pm4py
.
save_vis_petri_net
(
net
,
initial_marking
,
final_marking
,
decorations
=
decoration
,
file_path
=
r
"
static\net.png
"
)
return
rec_name
# decorate_petri_net(646, 7, "eventlog.csv")
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment