def pre_process_message(inputData):
    fail_messages = [1033,1034,1035,1036,1037]
    success_messages = [1009,1010,1011,1012,1047]

    # add duration
    end = inputData['W_END']
    start = inputData['W_START']
    inputData['EVENT_DURATION'] = end - start
    inputData['SUCCESS_EVENT_COUNT']= min(9,sum([ inputData['EVENT_HIST'][mc] for mc in inputData['EVENT_HIST'].keys() if int(mc) in success_messages]))
    inputData['FAIL_EVENT_COUNT']= min(9,sum([ inputData['EVENT_HIST'][mc] for mc in inputData['EVENT_HIST'].keys() if int(mc) in fail_messages]))
    inputData['TIME_OF_DAY_ENUM'] = OneHot.get_time_of_day_enum(start)
    return inputData
    def test_get_date(self):

        test_date = parser.parse("2018-11-01 16:45")
        result = OneHot.get_date(test_date)
        self.assertEqual(result, '0000111' + '0' * 33)
Esempio n. 3
0
    def test_from_scalar_overlap4_odd(self):
        pos, value_width, width = OneHot.scalar_params(2, 0, 50, 325, 2)

        self.assertEqual(pos,
                         (value_width * 2) + ((value_width) / 2) - 1 - (2 * 2))
Esempio n. 4
0
    def test_from_scalar_overlap3(self):
        pos, value_width, width = OneHot.scalar_params(2, 0, 50, 300, 2)

        self.assertEqual(pos,
                         (value_width * 2) + ((value_width - 1) / 2) - (2 * 2))
Esempio n. 5
0
    def test_from_scalar_overlap2(self):
        pos, value_width, width = OneHot.scalar_params(2, 0, 50, 152, 1)

        self.assertEqual(pos, 7)
Esempio n. 6
0
 def test_from_scalar4(self):
     pos, value_width, width = OneHot.scalar_params(1, 1, 51, 150)
     offset = int((value_width - 1) / 2)
     self.assertEqual(pos, int((150 / (51 - 1)) * (1 - 1)) + offset)
Esempio n. 7
0
 def test_from_scalar2(self):
     pos, value_width, width = OneHot.scalar_params(49, 0, 50, 150)
     offset = int((value_width - 1) / 2)
     self.assertEqual(pos, int((150 / (50 - 0)) * 49) + offset)
Esempio n. 8
0
 def test_from_scalar1(self):
     pos, value_width, width = OneHot.scalar_params(0, 0, 50, 150)
     offset = int((value_width - 1) / 2)
     self.assertEqual(pos, offset)