def is_valid_case(self, domain, case_id): try: person_case = get_person_case(domain, case_id) return (self.include_public_cases == self._is_person_public(domain, person_case) and self.include_private_cases == self._is_person_private(domain, person_case)) except ENikshayCaseNotFound: return False
def _get_person_id_link(self, record): try: person_id = get_person_case(self.domain, record.payload_id) return '<a href="{url}" target="_blank">{case_id}</a>'.format( url=reverse('case_details', args=[self.domain, person_id]), case_id=person_id) except ENikshayException as error: return u"Error: {}".format(error)
def get_payload(self, repeat_record, adherence_case): domain = adherence_case.domain person_case = get_person_case(domain, adherence_case.case_id) adherence_case_properties = adherence_case.dynamic_case_properties() date = parse_date(adherence_case.dynamic_case_properties().get('adherence_date')) payload = { 'beneficiary_id': person_case.case_id, 'adherence_date': date.isoformat(), 'adherence_source': adherence_case_properties.get('adherence_source'), 'adherence_value': adherence_case_properties.get('adherence_value'), } return json.dumps(payload)
def _is_case_missing_person(domain, case_id): try: return not get_person_case(domain, case_id) except ENikshayCaseNotFound: return True
def _get_person_id_link(self, record): try: person_id = get_person_case(self.domain, record.payload_id).case_id return self._get_case_id_link(person_id) except ENikshayException as error: return "Error: {}".format(error)
def should_delete(domain, case_id): try: return not get_person_case(domain, case_id) except ENikshayCaseNotFound: return True