Esempio n. 1
0
    def setUp(self):
        self._test_data_dir = os.path.join(absltest.get_default_test_srcdir(),
                                           _TESTDATA_PATH)
        self._enc = resources_pb2.Encounter()
        with open(os.path.join(self._test_data_dir, 'encounter_1.pbtxt')) as f:
            text_format.Parse(f.read(), self._enc)
        self._patient = resources_pb2.Patient()
        self._patient.id.value = 'Patient/1'

        self._expected_label = google_extensions_pb2.EventLabel()
        with open(os.path.join(self._test_data_dir, 'label_1.pbtxt')) as f:
            text_format.Parse(f.read(), self._expected_label)
Esempio n. 2
0
 def testGetPatient(self):
   patient = resources_pb2.Patient()
   text_format.Merge(
       """
   id: {
     value: "Patient/1"
   }
   birth_date: {
      # February 13, 2009 11:31:30 PM
       value_us : 1234567890000000
       timezone : "America/New_York"
       precision: DAY
   }
   """, patient)
   bundle = resources_pb2.Bundle()
   bundle.entry.add().resource.patient.CopyFrom(patient)
   p = util.GetPatient(bundle)
   self.assertEqual(patient, p)
Esempio n. 3
0
    def setUp(self):
        self._test_data_dir = os.path.join(absltest.get_default_test_srcdir(),
                                           _TESTDATA_PATH)
        enc = resources_pb2.Encounter()
        with open(os.path.join(self._test_data_dir, 'encounter_1.pbtxt')) as f:
            text_format.Parse(f.read(), enc)
        patient = resources_pb2.Patient()
        patient.id.value = 'Patient/1'
        self._bundle = resources_pb2.Bundle()
        self._bundle.entry.add().resource.encounter.CopyFrom(enc)
        self._bundle.entry.add().resource.patient.CopyFrom(patient)

        self._expected_label = label.ComposeLabel(
            patient,
            enc,
            label.LOS_RANGE_LABEL,
            'above_14',
            # 24 hours after admission
            datetime.datetime(2009, 2, 14, 23, 31, 30))