Beispiel #1
0
 def test_person_case_is_migrated_or_opted_out(self):
     self.assertFalse(
         person_case_is_migrated_or_opted_out(self.mother_person_case))
     self.assertTrue(
         person_case_is_migrated_or_opted_out(self.migrated_case))
     self.assertTrue(
         person_case_is_migrated_or_opted_out(self.opted_out_case))
def recipient_mother_person_case_from_ccs_record_case_excl_migrated_or_opted_out(case_schedule_instance):
    from custom.icds.messaging.custom_content import person_case_is_migrated_or_opted_out

    mother = recipient_mother_person_case_from_ccs_record_case(case_schedule_instance)

    if mother is None or person_case_is_migrated_or_opted_out(mother):
        return None

    return mother
 def test_person_case_is_migrated_or_opted_out(self):
     self.assertFalse(person_case_is_migrated_or_opted_out(self.mother_person_case))
     self.assertTrue(person_case_is_migrated_or_opted_out(self.migrated_case))
     self.assertTrue(person_case_is_migrated_or_opted_out(self.opted_out_case))
Beispiel #4
0
    """
    This filters to ccs record cases where the relevant child person case is both registered and not migrated.
    """
    mother = mother_person_case_from_ccs_record_case(case)
    children = child_person_cases_from_mother_person_case(mother)

    add = case.get_case_property('add')
    children = [
        child for child in children if child.get_case_property('dob') == add
    ]

    if not children:
        return False

    return any([
        not (person_case_is_migrated_or_opted_out(child)) for child in children
    ])


def child_health_case_is_availing_services(case, now):
    """
    This filters to child health cases where the relevant child person case is both registered and not migrated.
    """
    child = child_person_case_from_child_health_case(case)
    if person_case_is_migrated_or_opted_out(child):
        return False

    return case


def check_user_location_type(usercase, location_type_code):