src/dirbs/reports/stats_generator.py
def _generate_compliance_breakdown(per_tac_results):
    """Generate aggregated total compliance breakdown, as used by the visual report."""
    results = {
        'num_compliant_imeis': 0,
        'num_noncompliant_imeis': 0,
        'num_noncompliant_imeis_blocking': 0,
        'num_noncompliant_imeis_info_only': 0,
        'num_compliant_triplets': 0,
        'num_noncompliant_triplets': 0,
        'num_noncompliant_triplets_blocking': 0,
        'num_noncompliant_triplets_info_only': 0,
        'num_compliant_imei_imsis': 0,
        'num_noncompliant_imei_imsis': 0,
        'num_noncompliant_imei_imsis_blocking': 0,
        'num_noncompliant_imei_imsis_info_only': 0,
        'num_compliant_imei_msisdns': 0,
        'num_noncompliant_imei_msisdns': 0,
        'num_noncompliant_imei_msisdns_blocking': 0,
        'num_noncompliant_imei_msisdns_info_only': 0
    }

    for tac, combinations in per_tac_results.items():
        for combination, data in combinations.items():
            if data['compliance_level'] == 0:
                results['num_noncompliant_imeis_blocking'] += data['num_imeis']
                results['num_noncompliant_imeis'] += data['num_imeis']
                results['num_noncompliant_triplets_blocking'] += data['num_subscriber_triplets']
                results['num_noncompliant_triplets'] += data['num_subscriber_triplets']
                results['num_noncompliant_imei_imsis_blocking'] += data['num_imei_imsis']
                results['num_noncompliant_imei_imsis'] += data['num_imei_imsis']
                results['num_noncompliant_imei_msisdns_blocking'] += data['num_imei_msisdns']
                results['num_noncompliant_imei_msisdns'] += data['num_imei_msisdns']
            elif data['compliance_level'] == 1:
                results['num_noncompliant_imeis_info_only'] += data['num_imeis']
                results['num_noncompliant_imeis'] += data['num_imeis']
                results['num_noncompliant_triplets_info_only'] += data['num_subscriber_triplets']
                results['num_noncompliant_triplets'] += data['num_subscriber_triplets']
                results['num_noncompliant_imei_imsis_info_only'] += data['num_imei_imsis']
                results['num_noncompliant_imei_imsis'] += data['num_imei_imsis']
                results['num_noncompliant_imei_msisdns_info_only'] += data['num_imei_msisdns']
                results['num_noncompliant_imei_imsis'] += data['num_imei_msisdns']
            else:
                results['num_compliant_imeis'] += data['num_imeis']
                results['num_compliant_triplets'] += data['num_subscriber_triplets']
                results['num_compliant_imei_imsis'] += data['num_imei_imsis']
                results['num_compliant_imei_msisdns'] += data['num_imei_msisdns']

    return results
Generate aggregated total compliance breakdown, as used by the visual report.
Generate aggregated total compliance breakdown, as used by the visual report.
Generate aggregated total compliance breakdown as used by the visual report .
def _generate_compliance_breakdown(per_tac_results):
    results = {
        'num_compliant_imeis': 0,
        'num_noncompliant_imeis': 0,
        'num_noncompliant_imeis_blocking': 0,
        'num_noncompliant_imeis_info_only': 0,
        'num_compliant_triplets': 0,
        'num_noncompliant_triplets': 0,
        'num_noncompliant_triplets_blocking': 0,
        'num_noncompliant_triplets_info_only': 0,
        'num_compliant_imei_imsis': 0,
        'num_noncompliant_imei_imsis': 0,
        'num_noncompliant_imei_imsis_blocking': 0,
        'num_noncompliant_imei_imsis_info_only': 0,
        'num_compliant_imei_msisdns': 0,
        'num_noncompliant_imei_msisdns': 0,
        'num_noncompliant_imei_msisdns_blocking': 0,
        'num_noncompliant_imei_msisdns_info_only': 0
    }
    for tac, combinations in per_tac_results.items():
        for combination, data in combinations.items():
            if data['compliance_level'] == 0:
                results['num_noncompliant_imeis_blocking'] += data['num_imeis']
                results['num_noncompliant_imeis'] += data['num_imeis']
                results['num_noncompliant_triplets_blocking'] += data['num_subscriber_triplets']
                results['num_noncompliant_triplets'] += data['num_subscriber_triplets']
                results['num_noncompliant_imei_imsis_blocking'] += data['num_imei_imsis']
                results['num_noncompliant_imei_imsis'] += data['num_imei_imsis']
                results['num_noncompliant_imei_msisdns_blocking'] += data['num_imei_msisdns']
                results['num_noncompliant_imei_msisdns'] += data['num_imei_msisdns']
            elif data['compliance_level'] == 1:
                results['num_noncompliant_imeis_info_only'] += data['num_imeis']
                results['num_noncompliant_imeis'] += data['num_imeis']
                results['num_noncompliant_triplets_info_only'] += data['num_subscriber_triplets']
                results['num_noncompliant_triplets'] += data['num_subscriber_triplets']
                results['num_noncompliant_imei_imsis_info_only'] += data['num_imei_imsis']
                results['num_noncompliant_imei_imsis'] += data['num_imei_imsis']
                results['num_noncompliant_imei_msisdns_info_only'] += data['num_imei_msisdns']
                results['num_noncompliant_imei_imsis'] += data['num_imei_msisdns']
            else:
                results['num_compliant_imeis'] += data['num_imeis']
                results['num_compliant_triplets'] += data['num_subscriber_triplets']
                results['num_compliant_imei_imsis'] += data['num_imei_imsis']
                results['num_compliant_imei_msisdns'] += data['num_imei_msisdns']
    return results
def _generate_compliance_breakdown ( per_tac_results ) : results = { 'num_compliant_imeis' : 0 , 'num_noncompliant_imeis' : 0 , 'num_noncompliant_imeis_blocking' : 0 , 'num_noncompliant_imeis_info_only' : 0 , 'num_compliant_triplets' : 0 , 'num_noncompliant_triplets' : 0 , 'num_noncompliant_triplets_blocking' : 0 , 'num_noncompliant_triplets_info_only' : 0 , 'num_compliant_imei_imsis' : 0 , 'num_noncompliant_imei_imsis' : 0 , 'num_noncompliant_imei_imsis_blocking' : 0 , 'num_noncompliant_imei_imsis_info_only' : 0 , 'num_compliant_imei_msisdns' : 0 , 'num_noncompliant_imei_msisdns' : 0 , 'num_noncompliant_imei_msisdns_blocking' : 0 , 'num_noncompliant_imei_msisdns_info_only' : 0 } for tac , combinations in per_tac_results . items ( ) : for combination , data in combinations . items ( ) : if data [ 'compliance_level' ] == 0 : results [ 'num_noncompliant_imeis_blocking' ] += data [ 'num_imeis' ] results [ 'num_noncompliant_imeis' ] += data [ 'num_imeis' ] results [ 'num_noncompliant_triplets_blocking' ] += data [ 'num_subscriber_triplets' ] results [ 'num_noncompliant_triplets' ] += data [ 'num_subscriber_triplets' ] results [ 'num_noncompliant_imei_imsis_blocking' ] += data [ 'num_imei_imsis' ] results [ 'num_noncompliant_imei_imsis' ] += data [ 'num_imei_imsis' ] results [ 'num_noncompliant_imei_msisdns_blocking' ] += data [ 'num_imei_msisdns' ] results [ 'num_noncompliant_imei_msisdns' ] += data [ 'num_imei_msisdns' ] elif data [ 'compliance_level' ] == 1 : results [ 'num_noncompliant_imeis_info_only' ] += data [ 'num_imeis' ] results [ 'num_noncompliant_imeis' ] += data [ 'num_imeis' ] results [ 'num_noncompliant_triplets_info_only' ] += data [ 'num_subscriber_triplets' ] results [ 'num_noncompliant_triplets' ] += data [ 'num_subscriber_triplets' ] results [ 'num_noncompliant_imei_imsis_info_only' ] += data [ 'num_imei_imsis' ] results [ 'num_noncompliant_imei_imsis' ] += data [ 'num_imei_imsis' ] results [ 'num_noncompliant_imei_msisdns_info_only' ] += data [ 'num_imei_msisdns' ] results [ 'num_noncompliant_imei_imsis' ] += data [ 'num_imei_msisdns' ] else : results [ 'num_compliant_imeis' ] += data [ 'num_imeis' ] results [ 'num_compliant_triplets' ] += data [ 'num_subscriber_triplets' ] results [ 'num_compliant_imei_imsis' ] += data [ 'num_imei_imsis' ] results [ 'num_compliant_imei_msisdns' ] += data [ 'num_imei_msisdns' ] return results
Generate aggregated total compliance breakdown, as used by the visual report.
Generate aggregated total compliance breakdown as used by the visual report .
"""Generate aggregated total compliance breakdown, as used by the visual report."""
per_tac_results