Example #1
0
class LivraisonFluff(fluff.IndicatorDocument):
    document_class = XFormInstance
    document_filter = FormPropertyFilter(xmlns=LIVRAISON_XMLNSES[0])

    domains = INTRAHEALTH_DOMAINS
    group_by = ('domain', )
    deleted_types = IH_DELETED_TYPES

    month = flat_field(lambda f: get_month(f, 'mois_visite'))
    duree_moyenne_livraison = report_calcs.DureeMoyenneLivraison()

    region_id = flat_field(lambda f: get_location_id_by_type(form=f, type=u'r\xe9gion'))
    district_id = flat_field(lambda f: CommCareCase.get(f.form['case']['@case_id']).location_id)
    district_name = flat_field(lambda f: CommCareCase.get(f.form['case']['@case_id']).name)
Example #2
0
class CouvertureFluff(fluff.IndicatorDocument):
    document_class = XFormInstance
    document_filter = ORFilter([
        FormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0]),
        FormPropertyFilter(xmlns=OPERATEUR_XMLNSES[1]),
    ])

    domains = INTRAHEALTH_DOMAINS
    group_by = ('domain', fluff.AttributeGetter('location_id', get_location_id))
    deleted_types = IH_DELETED_TYPES

    location_id = flat_field(get_location_id)
    region_id = flat_field(lambda f: get_location_id_by_type(form=f, type=u'r\xe9gion'))
    district_id = flat_field(lambda f: get_location_id_by_type(form=f, type='district'))
    pps_name = flat_field(lambda f: get_pps_name(f))
    district_name = flat_field(lambda f: get_district_name(f))
    month = flat_field(lambda f: get_month(f, 'real_date'))
    real_date_repeat = flat_field(get_real_date)
    registered = report_calcs.PPSRegistered()
    planned = report_calcs.PPSPlaned()