Beispiel #1
0
class IntraHealthFluff(fluff.IndicatorDocument):
    document_class = XFormInstance
    document_filter = ANDFilter([
        FormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0]),
        IsExistFormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0],
                                  property_path="form",
                                  property_value='district_name'),
        IsExistFormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0],
                                  property_path="form",
                                  property_value='PPS_name')
    ])
    domains = INTRAHEALTH_DOMAINS
    save_direct_to_sql = True
    group_by = (fluff.AttributeGetter(
        'product_name', lambda f: get_products(f, 'product_name')), )

    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: f.form['PPS_name'])
    district_name = flat_field(lambda f: f.form['district_name'])
    location_id = flat_field(get_location_id)

    actual_consumption = report_calcs.PPSConsumption()
    billed_consumption = report_calcs.PPSConsumption(
        field='billed_consumption')
    stock = report_calcs.PPSConsumption('old_stock_total')
    quantity = report_calcs.PPSConsumption('display_total_stock')
    cmm = report_calcs.PPSConsumption('default_consumption')
Beispiel #2
0
class RecapPassageFluff(fluff.IndicatorDocument):
    document_class = XFormInstance
    document_filter = ANDFilter([
        FormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0]),
        IsExistFormPropertyFilter(xmlns=OPERATEUR_XMLNSES[0],
                                  property_path="form",
                                  property_value='PPS_name')
    ])

    domains = INTRAHEALTH_DOMAINS
    deleted_types = IH_DELETED_TYPES
    group_by = (fluff.AttributeGetter(
        'product_name', lambda f: get_products(f, 'product_name')),
                fluff.AttributeGetter(
                    'product_code',
                    lambda f: get_products_code(f, 'product_name')))
    save_direct_to_sql = True

    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'))
    real_date_repeat = flat_field(get_real_date)
    PPS_name = flat_field(lambda f: f.form['PPS_name'])

    product = report_calcs.RecapPassage()
Beispiel #3
0
class TauxDeSatisfactionFluff(fluff.IndicatorDocument):
    document_class = XFormInstance
    document_filter = ORFilter([
        FormPropertyFilter(xmlns=COMMANDE_XMLNSES[0]),
        FormPropertyFilter(xmlns=COMMANDE_XMLNSES[1])
    ])

    domains = INTRAHEALTH_DOMAINS
    group_by = (fluff.AttributeGetter(
        'product_name', lambda f: get_products(f, 'productName')), )
    save_direct_to_sql = True

    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'))
    commandes = report_calcs.Commandes()
    recus = report_calcs.Recus()