def _load_encounter_data(self): """ Loads the encounters into this. """ def _clear_encounters(self): self._encounters = [] if len(self._encounters) == 0 and (self.anchor_form_id or self.other_form_ids): self._encounters = [] if self.anchor_form_id: anchor = Encounter.view("encounter/in_patient_by_form", key=self.anchor_form_id).one() # this typically means we're in reprocessing mode, just clear the encounters # and try again next time. if not anchor: return _clear_encounters(self) self._add_encounter(anchor) for form_id in self.other_form_ids: enc = Encounter.view("encounter/in_patient_by_form", key=form_id).one() # this typically means we're in reprocessing mode, just clear the encounters # and try again next time. if not enc: return _clear_encounters(self) self._add_encounter(enc)
def get_encounter(self): if not self._encounter: self._encounter = Encounter.view("encounter/in_patient", key=self.encounter_id).one() return self._encounter