def test_resource_pool_analyzer(entry_point): log_path = entry_point / 'PurchasingExample.xes' log, log_path_csv = read(log_path) result = ResourcePoolDiscoverer(log, activity_key='concept:name', resource_key='org:resource') assert result.resource_table assert len(result.resource_table) > 0 log_path_csv.unlink()
def test_adjust_durations_purchasing_example(entry_point): log_path = Path(entry_point) / 'PurchasingExampleMultitasking.xes' log, log_path_csv = read(log_path) result = adjust_durations(log, verbose=True) assert result is not None assert (result.iloc[0]['time:timestamp'] - result.iloc[0]['start_timestamp']).total_seconds() == 330.0 assert (result.iloc[1]['time:timestamp'] - result.iloc[1]['start_timestamp']).total_seconds() == 870.0 log_path_csv.unlink()
def __run(self): # NOTE: The previous version of the TimeTablesCreator supported only default undifferentiated calendars # even though it was supposed to support calendars differentiated by resource pools. # # resource_calendar_method = self.settings.res_cal_met # NOTE: resource calendar discovery method discarded # arrival_calendar_method = self.settings.arr_cal_met # NOTE: arrival calendar discovery method discarded resource_calendar_method = CalendarType.UNDIFFERENTIATED if self.log: event_log = pd.DataFrame(self.log.data) else: event_log, log_path_csv = read(self.log_path) log_path_csv.unlink() # handling different column names: standard and Simod names columns_mapping = None if 'caseid' in event_log.columns: columns_mapping = { CASE_ID_KEY: 'caseid', ACTIVITY_KEY: 'task', RESOURCE_KEY: 'user', END_TIMESTAMP_KEY: 'end_timestamp', } resource_calendar = discover_resource_calendar( event_log, resource_calendar_method, columns_mapping=columns_mapping) arrival_calendar = discover_arrival_calendar( event_log, columns_mapping=columns_mapping) assert resource_calendar is not None, 'Resource calendar discovery failed' assert arrival_calendar is not None, 'Arrival calendar discovery failed' self.resource_timetable = resource_calendar self.arrival_timetable = arrival_calendar self.timetable = _prosimos_calendar_to_time_table( resource_calendar, arrival_calendar) self.timetable_names = { 'arrival': 'QBP_ARR_DEFAULT_TIMETABLE', 'resources': 'Discovered_DEFAULT_CALENDAR' }
def test_calendar_case_arrival_discover(entry_point, log_name): log_path = entry_point / log_name log, log_path_csv = read(log_path) result = case_arrival.discover(log) assert result log_path_csv.unlink()
def test_calendar_discover_per_resource(entry_point, log_name): log_path = entry_point / log_name log, log_path_csv = read(log_path) result = resource_calendar.discover_per_resource(log) assert result log_path_csv.unlink()
def test_adjust_durations_consulta(entry_point): log_path = entry_point / 'ConsultaDataMining201618.xes' log, log_path_csv = read(log_path) result = adjust_durations(log, verbose=False) assert result is not None log_path_csv.unlink()