src/dirbs/reports/stats_generator.py
def _calc_top_models_imei(db_config, month, year, operator=None):
    """Helper function to calculate the top models by IMEI count."""
    with utils.create_db_connection(db_config) as conn:
        network_triplets_partition = _monthly_network_triplets_partition(conn=conn, operator=operator,
                                                                         month=month, year=year)
        return _calc_top_models_common(
            conn,
            sql.SQL("""SELECT SUBSTRING(imei_norm, 1, 8) AS tac,
                              COUNT(DISTINCT imei_norm) AS imei_count
                         FROM {0}
                        WHERE imei_norm IS NOT NULL
                     GROUP BY tac""").format(network_triplets_partition)
        )
Helper function to calculate the top models by IMEI count.
Helper function to calculate the top models by IMEI count.
Helper function to calculate the top models by IMEI count .
def _calc_top_models_imei(db_config, month, year, operator=None):
    with utils.create_db_connection(db_config) as conn:
        network_triplets_partition = _monthly_network_triplets_partition(conn=conn, operator=operator,
                                                                         month=month, year=year)
        return _calc_top_models_common(
            conn,
            sql.SQL("""SELECT SUBSTRING(imei_norm, 1, 8) AS tac,
                              COUNT(DISTINCT imei_norm) AS imei_count
                         FROM {0}
                        WHERE imei_norm IS NOT NULL
                     GROUP BY tac""").format(network_triplets_partition)
        )
def _calc_top_models_imei ( db_config , month , year , operator = None ) : with utils . create_db_connection ( db_config ) as conn : network_triplets_partition = _monthly_network_triplets_partition ( conn = conn , operator = operator , month = month , year = year ) return _calc_top_models_common ( conn , sql . SQL ( """SELECT SUBSTRING(imei_norm, 1, 8) AS tac,
                              COUNT(DISTINCT imei_norm) AS imei_count
                         FROM {0}
                        WHERE imei_norm IS NOT NULL
                     GROUP BY tac""" ) . format ( network_triplets_partition ) )
Helper function to calculate the top models by IMEI count.
Helper function to calculate the top models by IMEI count .
"""Helper function to calculate the top models by IMEI count."""
db_config
month
year
operator