src/dirbs/reports/stats_generator.py
def _calc_imsi_imei_overloading(db_config, month, year, operator=None):
    """Helper function to determine IMSI-IMEI overloading for a year, month and operator."""
    with utils.create_db_connection(db_config) as conn, conn.cursor() as cursor, utils.CodeProfiler() as cp:
        network_triplets_partition = _monthly_network_triplets_partition(conn=conn, operator=operator,
                                                                         month=month, year=year)
        cursor.execute(
            sql.SQL("""SELECT COUNT(*) AS num_imsis,
                              seen_with_imeis
                         FROM (SELECT COUNT(DISTINCT imei_norm) AS seen_with_imeis
                                 FROM {0}
                             GROUP BY imsi) imeis_per_imsi
                     GROUP BY seen_with_imeis""").format(network_triplets_partition)
        )
        results = [{'num_imsis': r.num_imsis, 'seen_with_imeis': r.seen_with_imeis} for r in cursor]
    return results, cp.duration, [cp.duration]
Helper function to determine IMSI-IMEI overloading for a year, month and operator.
Helper function to determine IMSI-IMEI overloading for a year, month and operator.
Helper function to determine IMSI - IMEI overloading for a year month and operator .
def _calc_imsi_imei_overloading(db_config, month, year, operator=None):
    with utils.create_db_connection(db_config) as conn, conn.cursor() as cursor, utils.CodeProfiler() as cp:
        network_triplets_partition = _monthly_network_triplets_partition(conn=conn, operator=operator,
                                                                         month=month, year=year)
        cursor.execute(
            sql.SQL("""SELECT COUNT(*) AS num_imsis,
                              seen_with_imeis
                         FROM (SELECT COUNT(DISTINCT imei_norm) AS seen_with_imeis
                                 FROM {0}
                             GROUP BY imsi) imeis_per_imsi
                     GROUP BY seen_with_imeis""").format(network_triplets_partition)
        )
        results = [{'num_imsis': r.num_imsis, 'seen_with_imeis': r.seen_with_imeis} for r in cursor]
    return results, cp.duration, [cp.duration]
def _calc_imsi_imei_overloading ( db_config , month , year , operator = None ) : with utils . create_db_connection ( db_config ) as conn , conn . cursor ( ) as cursor , utils . CodeProfiler ( ) as cp : network_triplets_partition = _monthly_network_triplets_partition ( conn = conn , operator = operator , month = month , year = year ) cursor . execute ( sql . SQL ( """SELECT COUNT(*) AS num_imsis,
                              seen_with_imeis
                         FROM (SELECT COUNT(DISTINCT imei_norm) AS seen_with_imeis
                                 FROM {0}
                             GROUP BY imsi) imeis_per_imsi
                     GROUP BY seen_with_imeis""" ) . format ( network_triplets_partition ) ) results = [ { 'num_imsis' : r . num_imsis , 'seen_with_imeis' : r . seen_with_imeis } for r in cursor ] return results , cp . duration , [ cp . duration ]
Helper function to determine IMSI-IMEI overloading for a year, month and operator.
Helper function to determine IMSI - IMEI overloading for a year month and operator .
"""Helper function to determine IMSI-IMEI overloading for a year, month and operator."""
db_config
month
year
operator