Пример #1
0
 def _runTest(
     self, patient_key: bytes, bundle: resources_pb2.Bundle,
     event_trigger_labels_list: Tuple[google_extensions_pb2.EventTrigger,
                                      List[Any]],
     expected_outcomes: Tuple[Tuple[bytes, example_pb2.SequenceExample,
                                    int], Any]):
     converter = bundle_to_seqex_converter.PyBundleToSeqexConverter(
         self._version_config, False, False)
     (begin_result, stats) = converter.begin(patient_key, bundle,
                                             event_trigger_labels_list)
     self.assertTrue(begin_result)
     got_results = list()
     next_example_and_key = converter.get_next_example_and_key()
     while next_example_and_key:
         got_results.append(next_example_and_key)
         next_example_and_key = converter.get_next_example_and_key()
     self.assertEqual(len(expected_outcomes), len(got_results))
     for expected_outcome, got_result in zip(expected_outcomes,
                                             got_results):
         (expected_key, expected_seqex, expected_length) = expected_outcome
         (got_key, got_seqex, got_length) = got_result
         self.assertEqual(expected_key, got_key)
         self.assertProtoEqual(expected_seqex, got_seqex)
         self.assertEqual(expected_length, got_length)
     return stats
Пример #2
0
 def _runTest(self, patient_key, bundle, event_trigger_labels_list,
              expected_outcomes):
   converter = bundle_to_seqex_converter.PyBundleToSeqexConverter(
       self._version_config, False, False)
   (begin_result, stats) = converter.begin(patient_key, bundle,
                                           event_trigger_labels_list)
   self.assertTrue(begin_result)
   got_results = list()
   next_example_and_key = converter.get_next_example_and_key()
   while next_example_and_key:
     got_results.append(next_example_and_key)
     next_example_and_key = converter.get_next_example_and_key()
   self.assertEqual(len(expected_outcomes), len(got_results))
   for expected_outcome, got_result in zip(expected_outcomes, got_results):
     (expected_key, expected_seqex, expected_length) = expected_outcome
     (got_key, got_seqex, got_length) = got_result
     self.assertEqual(expected_key, got_key)
     self.assertProtoEqual(expected_seqex, got_seqex)
     self.assertEqual(expected_length, got_length)
   return stats
Пример #3
0
 def start_bundle(self):
   self._converter = bundle_to_seqex_converter.PyBundleToSeqexConverter(
       version_config=self._version_config,
       enable_attribution=self._enable_attribution,
       generate_sequence_label=self._generate_sequence_label)