diff --git a/backend/Tests/testagent.py b/backend/Tests/testagent.py index f49e366e24e3d1c4e1cd6bc3c977297e7ec96b89..7fa0d9f30c12514473c55a7d4e503f260108bef9 100644 --- a/backend/Tests/testagent.py +++ b/backend/Tests/testagent.py @@ -50,8 +50,6 @@ activities = 16 # dqn.train(space, activities) -# dqn.train(space, activities) - '''''' # generate event log env = simpy.Environment() @@ -59,10 +57,10 @@ business_process = model.BusinessProcess(env, ressources) business_process.event_log_flag = True env.process(model.run_process(env, business_process)) env.run(until = 30000) -log.export_to_csv(business_process, r'C:\Users\nourm\OneDrive\Desktop\Nour\optis_app\backend\eventlog_test\optis.csv') +log.export_to_csv(business_process, r'..\Frontend\export\testeventlog') # extract active cases from event log -active_cases = log.get_active_cases() +active_cases = log.get_active_cases("testeventlog.csv") print(active_cases) diff --git a/backend/eventlog.py b/backend/eventlog.py index 6a92f0c1f60a05da7e922cb51d6c558366f8b69f..7acb4bdb699f9844e3353b983a5b338c179ebf6a 100644 --- a/backend/eventlog.py +++ b/backend/eventlog.py @@ -388,6 +388,8 @@ def generate_event_log(start_timestamp, time): Parameters ---------- + start_timestamp : datetime + the start date and time of the simulation time : int the time units for which the simulation is supposed to run """ @@ -435,6 +437,21 @@ def generate_event_log(start_timestamp, time): export_to_xes(business_process, r'export/elog.xes') #local def get_case_information(case_id, name): + """Generate an event log from the simulation model and export it to .csv and .xes + + Parameters + ---------- + case_id : int + the case-id of a case in the event log + name : str + name of the event log file + + Returns + ------- + pandas.DataFrame + a dataframe containing all the events that happened for a certain case + """ + event_log = convert_to_dataframe(name) # Sort the event log by case ID and start timestamp event_log.sort_values(by=['CaseID', 'StartTimestamp'], inplace=True) diff --git a/backend/petrinet.py b/backend/petrinet.py index 0424e0028aff678969d05ad879d514d65a20d057..dab423110cef14b32921511c608004514dc0a7ab 100644 --- a/backend/petrinet.py +++ b/backend/petrinet.py @@ -3,6 +3,7 @@ The module includes the following functions: * generate_petri_net() - generates a petri-net represenation of the business process + * process_petri_net(): saves the process's petri-net as a png so that it can be used as a static image * decorate_petri_net(case, name) - exports a .png of a petri-net with the case trace colored * decorate_petri_net_with_rec(case, rec, name) - exports a .png of a petri-net with the case trace and the recommendation colored """ @@ -49,6 +50,8 @@ def generate_petri_net(): return net, initial_marking, final_marking def process_petri_net(): + """Function which we use to create the business process's petri-net and save it as a png so we can use it as a static image + """ net, initial_marking, final_marking = generate_petri_net() decoration = {} for p in net.places: