예제 #1
0
def _still_birth(case):
    # birth_status = 'still_birth' on case
    # OR:
    # /data/child_info/child_cried='no' and
    # /data/child_info/child_breathing='no' and
    # /data/child_info/child_movement='no' and
    # /data/child_info/child_heartbeats='no' from delivery form
    status = getattr(case, "birth_status", None)
    if status is not None:
        return status == "still_birth"
    else:

        def filter_action(action):
            if visit_is(action, "del"):
                now = datetime.now()
                return now - timedelta(days=30) <= action.date
            return False

        for f in get_forms(case, action_filter=filter_action):
            if (
                f.xpath(" form/child_info/child_cried") == "no"
                and f.xpath(" form/child_info/child_breathing") == "no"
                and f.xpath(" form/child_info/child_movement") == "no"
                and f.xpath(" form/child_info/child_heartbeats") == "no"
            ):
                return True
            return False
예제 #2
0
 def _no_prep(case):
     for form in get_forms(case, action_filter=lambda a: visit_is(a, 'bp')):
         if form.xpath('form/bp2/wrapping') == 'no' and \
                 form.xpath('form/bp2/skin_To_skin') == 'no' and \
                 form.xpath('form/bp2/immediate_breastfeeding') == 'no' and \
                 form.xpath('form/bp2/cord_care') == 'no':
             return True
     return False
예제 #3
0
 def _no_counseling(case):
     for form in get_forms(case, action_filter=lambda a: visit_is(a, 'bp')):
         if form.xpath('form/bp2/counsel_accessible') == 'no':
             return True
     return False
예제 #4
0
 def _no_prep(case):
     for form in get_forms(case, action_filter=lambda a: visit_is(a, 'bp')):
         if form.xpath('form/bp2/maternal_danger_signs') == 'no' and \
                 form.xpath('form/bp2/danger_institution') == 'no':
             return True
     return False