def check_registration(message): if pm.get_property(message.chat.id, "registered"): return True else: bot.send_chat_action(message.chat.id, STATUS_TYPING) bot.reply_to(message, "This session is not started, please start it with the /start command") return False
def get_executor_script(chat_id, pic_filename): return """log = open_xes_log_file("../../LOG_FILE"); org.processmining.plugins.InductiveMiner.mining.MiningParameters params = new org.processmining.plugins.InductiveMiner.mining.MiningParametersIMf(); org.processmining.processtree.ProcessTree tree = mine_process_tree_with_inductive_miner_with_parameters(log, params); javax.swing.JComponent component = process_tree_visualisation_inductive_visual_miner_(tree); org.processmining.plugins.graphviz.dot.Dot d = ((org.processmining.plugins.graphviz.visualisation.DotPanel) component).getDot(); export_dot_as_png(d, new File("PIC_FILE")); System.exit(0);""".replace("LOG_FILE", pm.get_property(chat_id, "current_log")).replace("PIC_FILE", pic_filename).replace("\\", "\\\\")
def precedence_matrix(message): if check_registration(message): if start_processing(message): return tracker.track(message.chat.id, "resources") pic = rexecutor.run_r_code(R_SCRIPT, R_SCRIPTS_FOLDER + "resource_frequencies.R", pm.get_property(message.chat.id, "current_log")) bot.send_chat_action(message.chat.id, STATUS_UPLOAD_PICTURE) bot.send_photo(message.chat.id, open(pic, "rb")) end_processing(message)
def relative_dotted_chart(message): if check_registration(message): if start_processing(message): return tracker.track(message.chat.id, "relativedottedchart") pic = rexecutor.run_r_code(R_SCRIPT, R_SCRIPTS_FOLDER + "relative_dotted_chart.R", pm.get_property(message.chat.id, "current_log")) bot.send_chat_action(message.chat.id, STATUS_UPLOAD_PICTURE) bot.send_photo(message.chat.id, open(pic, "rb")) end_processing(message)