Ejemplo n.º 1
0
    def drtb_hiv(self):
        if self.test_phi is not None:
            return MockLocation('FAKEDRTBHIV', 'fake_drtb_hiv_id', MockLocationType('drtb_hiv', 'drtb_hiv'))

        dto_code = '-'.join(self._phi_code.split('-')[:2])
        try:
            dto = self.nikshay_codes_to_location[dto_code]
        except KeyError:
            raise ENikshayLocationNotFound(dto_code)

        for dto_child in dto.get_children():
            if dto_child.location_type.code == 'drtb-hiv':
                return dto_child
        raise ENikshayLocationNotFound('drtb-hiv matching DTO %s' % dto_code)
Ejemplo n.º 2
0
    def phi(self):
        if self.test_phi is not None:
            return MockLocation('FAKEPHI', self.test_phi, MockLocationType('phi', 'phi'))

        try:
            return self.nikshay_codes_to_location[self._phi_code]
        except KeyError:
            raise ENikshayLocationNotFound(self._phi_code)
Ejemplo n.º 3
0
    def tu(self):
        if self.test_phi is not None:
            return MockLocation('FAKETU', 'fake_tu_id', MockLocationType('tu', 'tu'))

        tu_code = '-'.join(self._phi_code.split('-')[:3])
        try:
            return self.nikshay_codes_to_location[tu_code]
        except KeyError:
            raise ENikshayLocationNotFound(tu_code)