src/dirbs/reports/csv_reports.py
def write_country_gsma_not_found_report(conn: callable, config: callable, month: int,
                                        year: int, country_name: str, output_dir: str) -> callable:
    """
    Helper function to write out the country-wide GSMA not found report.

    Arguments:
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        month: reporting month
        year: reporting year
        country_name: name of the country
        output_dir: output directory path
    Returns:
        Report metadata
    """
    gsma_not_found_csv_filename = '{0}_{1:d}_{2:d}_gsma_not_found.csv'.format(country_name, month, year)
    with open(os.path.join(output_dir, gsma_not_found_csv_filename), 'w', encoding='utf8') as of:
        writer = csv.writer(of)
        writer.writerow(['IMEI'])
        dim = GSMANotFound()
        sql = dim.sql(conn, config, 1, 100)
        with conn.cursor(name='gsma_not_found_report') as cursor:
            cursor.execute(sql)
            for res in cursor:
                writer.writerow([res.imei_norm])

    return _gen_metadata_for_reports([gsma_not_found_csv_filename], output_dir)

    Helper function to write out the country-wide GSMA not found report.

    Arguments:
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        month: reporting month
        year: reporting year
        country_name: name of the country
        output_dir: output directory path
    Returns:
        Report metadata
    
Helper function to write out the country-wide GSMA not found report.
Helper function to write out the country - wide GSMA not found report .
def write_country_gsma_not_found_report(conn: callable, config: callable, month: int,
                                        year: int, country_name: str, output_dir: str) -> callable:
    gsma_not_found_csv_filename = '{0}_{1:d}_{2:d}_gsma_not_found.csv'.format(country_name, month, year)
    with open(os.path.join(output_dir, gsma_not_found_csv_filename), 'w', encoding='utf8') as of:
        writer = csv.writer(of)
        writer.writerow(['IMEI'])
        dim = GSMANotFound()
        sql = dim.sql(conn, config, 1, 100)
        with conn.cursor(name='gsma_not_found_report') as cursor:
            cursor.execute(sql)
            for res in cursor:
                writer.writerow([res.imei_norm])
    return _gen_metadata_for_reports([gsma_not_found_csv_filename], output_dir)
def write_country_gsma_not_found_report ( conn : callable , config : callable , month : int , year : int , country_name : str , output_dir : str ) -> callable : gsma_not_found_csv_filename = '{0}_{1:d}_{2:d}_gsma_not_found.csv' . format ( country_name , month , year ) with open ( os . path . join ( output_dir , gsma_not_found_csv_filename ) , 'w' , encoding = 'utf8' ) as of : writer = csv . writer ( of ) writer . writerow ( [ 'IMEI' ] ) dim = GSMANotFound ( ) sql = dim . sql ( conn , config , 1 , 100 ) with conn . cursor ( name = 'gsma_not_found_report' ) as cursor : cursor . execute ( sql ) for res in cursor : writer . writerow ( [ res . imei_norm ] ) return _gen_metadata_for_reports ( [ gsma_not_found_csv_filename ] , output_dir )
Helper function to write out the country-wide GSMA not found report.
Helper function to write out the country - wide GSMA not found report .
"""
    Helper function to write out the country-wide GSMA not found report.

    Arguments:
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        month: reporting month
        year: reporting year
        country_name: name of the country
        output_dir: output directory path
    Returns:
        Report metadata
    """
None
conn
callable
DIRBS PostgreSQL connection object
DIRBS PostgreSQL connection object
config
callable
DIRBS config object
DIRBS config object
month
int
None
year
int
None
country_name
str
name of the country
name of the country
output_dir
str
output directory path
output directory path