Beispiel #1
0
 def testLengthOfStayRangeAt24HoursLT24Hours(self):
   enc = resources_pb2.Encounter()
   enc.CopyFrom(self._enc)
   enc.period.end.value_us = 1234567891000000
   with self.assertRaises(AssertionError):
     _ = [l for l in label.LengthOfStayRangeAt24Hours(
         self._patient, enc)]
Beispiel #2
0
 def testLengthOfStayRangeAt24Hours(self, end_us, label_val):
   enc = resources_pb2.Encounter()
   enc.CopyFrom(self._enc)
   enc.period.end.value_us = end_us
   labels = [l for l in label.LengthOfStayRangeAt24Hours(
       self._patient, enc)]
   expected_label = label.ComposeLabel(
       self._patient,
       self._enc,
       label.LOS_RANGE_LABEL,
       label_val,
       # 24 hours after admission
       datetime.datetime(2009, 2, 14, 23, 31, 30))
   self.assertEqual([expected_label], labels)
Beispiel #3
0
    def process(self, bundle):
        """Iterate through bundle and yield label.

    Args:
      bundle: input stu3.Bundle proto
    Yields:
      stu3.EventLabel proto.
    """
        patient = encounter.GetPatient(bundle)
        if patient is not None:
            # Cohort: inpatient encounter > 24 hours.
            for enc in encounter.Inpatient24HrEncounters(bundle):
                for one_label in label.LengthOfStayRangeAt24Hours(
                        patient, enc):
                    yield one_label
Beispiel #4
0
    def process(
        self, bundle: resources_pb2.Bundle
    ) -> Iterator[google_extensions_pb2.EventLabel]:
        """Iterate through bundle and yield label.

    Args:
      bundle: input stu3.Bundle proto

    Yields:
      stu3.EventLabel proto.
    """
        patient = encounter.GetPatient(bundle)
        if patient is not None:
            # Cohort: inpatient encounter > 24 hours.
            for enc in encounter.Inpatient24HrEncounters(
                    bundle, self._for_synthea):
                for one_label in label.LengthOfStayRangeAt24Hours(
                        patient, enc):
                    yield one_label