def _get_prop_from_forms(case, property): form = get_form(case, form_filter=lambda f: f.form.get(property, None)) return form.form[property] if form else None
def _get_time_of_visit_after_birth(case): form = get_form(case, action_filter=lambda a: a.updated_unknown_properties.get("add", None)) return form.xpath('form/meta/timeStart') if form else None
def is_recently_delivered(case): return get_form( case, action_filter=lambda a: a.xform_xmlns == REGISTRATION, form_filter=lambda f: f.form.get('recently_delivered', "") == 'yes' )
def _get_xpath_from_forms(case, path): form = get_form(case, form_filter=lambda f: f.get_data("form/%s" % path)) return form.get_data("form/%s" % path) if form else None
def has_delivered(case): return get_form( case, action_filter=lambda a: a.xform_xmlns == DELIVERY, form_filter=lambda f: f.form.get('has_delivered', '') == 'yes' )
def adopted_fp(case): def ff(f): return f.form.get('post_partum_fp', "") == 'yes' return get_form(case, form_filter=ff) and getattr(case, 'family_planning_type', "") != 'no_fp_at_delivery'