A tool for extracting additional data from a person's personal identifiers
__version__ = '0.0.2'
__title__ = 'KDC6-3.7'
__package__ = 'KDC6-3.7'
__author__ = 'Dukera'
__author_email__ = 'dukeradukera@gmail.com'

__init__.py
duk3r4/KD6-3.7
from modules import albania, bosnia_herzegovina, belgium, bulgaria, denmark, france, estonia, finland, czech_republic, \
    slovakia
import click


@click.group()
def run():
    pass


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Numri i Identitetit (NID)); 10 alphanumerical '
                                      'digits')
def alb(nin):
    albania.alb_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (National Register Number); 11 digits')
@click.option('--icn', type=str, help='Identity Card Number; 9, 10, or 12 digits')
def bel(nin, icn):
    if nin:
        belgium.bel_alg_nin(nin)
    if icn:
        belgium.bel_alg_icn(icn)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Unique Master Citizen Number '
                                      '(UMCN)/Jedinstveni matični broj (JMB)/Jedinstveni matični broj građana (JMBG)); '
                                      '13 digits')
def bih(nin):
    bosnia_herzegovina.bih_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Единен граждански номер '
                                      '(ЕГН)/Edinen grazhdanski nomer (EGN)); 10 digits')
def bgr(nin):
    bulgaria.bgr_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Birth Number/Rodné Číslo (RČ)); 10 or 9 digits')
def cze(nin):
    czech_republic.cze_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Det Centrale Personregister (CPR-nummer)); '
                                      '10 digits')
def dnk(nin):
    denmark.dnk_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Isikukood (IK)); 11 digits')
def est(nin):
    estonia.est_alg_nin(nin)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Henkilötunnus (HETU)); 11 alphanumerical digits')
def fin(nin):
    finland.fin_alg_nin(nin)


@click.command()
@click.option('--ssn', type=str, help='Social Security Number (Numéro d\'inscription au répertoire des personnes '
                                      'physiques (NIRP/NIR)); 13 alphanumerical digits')
def fra(ssn):
    france.fra_alg_nin(ssn)


@click.command()
@click.option('--nin', type=str, help='National Identification Number (Birth Number/Rodné Číslo (RČ))')
def svk(nin):
    slovakia.svk_alg_nin(nin)


run.add_command(alb)
run.add_command(bel)
run.add_command(bih)
run.add_command(bgr)
run.add_command(cze)
run.add_command(dnk)
run.add_command(est)
run.add_command(fin)
run.add_command(fra)
run.add_command(svk)

if __name__ == "__main__":
    run()

cli.py
duk3r4/KD6-3.7
import pandas as pd


def alb_alg_nin(nin):
    df_albania_yy = pd.read_csv('modules/data/albania_yy.csv')
    df_albania_mm = pd.read_csv('modules/data/albania_mm.csv')
    df_albania_dd = pd.read_csv('modules/data/albania_dd.csv')
    # checking the length
    length = len(nin)
    if length != 10:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the YY parameter
    yy = nin.upper()[0:2]
    if df_albania_yy['YY'].isin([yy]).any():
        bd_year = df_albania_yy.at[df_albania_yy.loc[df_albania_yy['YY'] == yy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = nin.upper()[2:4]
    if df_albania_mm['MM'].isin([mm]).any():
        bd_month = df_albania_mm.at[df_albania_mm.loc[df_albania_mm['MM'] == mm].index[0], 'Month']
        sex = df_albania_mm.at[df_albania_mm.loc[df_albania_mm['MM'] == mm].index[0], 'Sex']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the dd parameter
    dd = nin.upper()[4:6]
    if df_albania_dd['DD'].isin([dd]).any():
        bd_day = df_albania_dd.at[df_albania_dd.loc[df_albania_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    sss = nin.upper()[6:9]
    c = nin.upper()[9]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex,
          '\nSequence number of person with the same date of birth: ', int(sss), '\nChecksum symbol: ', c, '\n')
    return()

modules/albania.py
duk3r4/KD6-3.7
import pandas as pd


def bel_alg_nin(nin):
    df_belgium_yy = pd.read_csv('modules/data/belgium_yy.csv')
    df_belgium_mm = pd.read_csv('modules/data/belgium_mm.csv')
    df_belgium_dd = pd.read_csv('modules/data/belgium_dd.csv')
    # checking the length
    length = len(nin)
    if length != 11:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the YY parameter
    yy = nin[0:2]
    if df_belgium_yy['YY'].isin([yy]).any():
        bd_year = df_belgium_yy.at[df_belgium_yy.loc[df_belgium_yy['YY'] == yy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = nin[2:4]
    if df_belgium_mm['MM'].isin([mm]).any():
        bd_month = df_belgium_mm.at[df_belgium_mm.loc[df_belgium_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the DD parameter
    dd = nin[4:6]
    if df_belgium_dd['DD'].isin([dd]).any():
        bd_day = df_belgium_dd.at[df_belgium_dd.loc[df_belgium_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the XXX parameter
    xxx = nin[6:9]
    if xxx.isnumeric():
        if int(xxx) % 2 == 0:
            sex = 'Female'
        else:
            sex = 'Male'
    else:
        print('The ID number is wrong. Please, try again')
        return()
    cd = nin[9:11]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex, '\nChecksum number: ', cd)
    return()


def bel_alg_icn(icn):
    if len(icn) == 12:
        print('\nHere\'s what I got from that ID number:\nThe card owner is a Belgium citizen\n')
        return()
    elif len(icn) == 9:
        print('\nHere\'s what I got from that ID number:\nThe card owner is a third country citizen\n')
        return()
    elif len(icn) == 10:
        print('\nHere\'s what I got from that ID number:\nThe card owner is a EU/EEA/Swiss citizen\n')
        return()
    else:
        print('The ID number is wrong. Please, try again')
        return()

modules/belgium.py
duk3r4/KD6-3.7
import pandas as pd


def bih_alg_nin(nin):
    df_bih_yyy = pd.read_csv('modules/data/bosnia_herzegovina_yyy.csv')
    df_bih_mm = pd.read_csv('modules/data/bosnia_herzegovina_mm.csv')
    df_bih_dd = pd.read_csv('modules/data/bosnia_herzegovina_dd.csv')
    df_bih_rr = pd.read_csv('modules/data/bosnia_herzegovina_rr.csv')
    # checking the length
    length = len(nin)
    if length != 13:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the DD parameter
    dd = nin[0:2]
    if df_bih_dd['DD'].isin([dd]).any():
        bd_day = df_bih_dd.at[df_bih_dd.loc[df_bih_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = nin[2:4]
    if df_bih_mm['MM'].isin([mm]).any():
        bd_month = df_bih_mm.at[df_bih_mm.loc[df_bih_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the YYY parameter
    yyy = nin[4:7]
    if df_bih_yyy['YYY'].isin([yyy]).any():
        bd_year = df_bih_yyy.at[df_bih_yyy.loc[df_bih_yyy['YYY'] == yyy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the RR parameter
    rr = nin[7:9]
    if df_bih_rr['RR'].isin([rr]).any():
        status = df_bih_rr.at[df_bih_rr.loc[df_bih_rr['RR'] == rr].index[0], 'Status']
        reg = df_bih_rr.at[df_bih_rr.loc[df_bih_rr['RR'] == rr].index[0], 'Political region']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the BBB parameter
    bbb = nin[9:12]
    if bbb.isnumeric():
        if 0 <= int(bbb) <= 499:
            sex = 'Male'
        else:
            sex = 'Female'
    else:
        print('The ID number is wrong. Please, try again')
        return()
    k = nin[12]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex, '\nStatus: ', status,
          '\nPolitical region of birth (for persons born before 1976, political region where they '
          'were first registered): ', reg, '\nChecksum symbol: ', k, '\n')
    return()

modules/bosnia_herzegovina.py
duk3r4/KD6-3.7
import pandas as pd


def bgr_alg_nin(nin):
    df_bulgaria_yy = pd.read_csv('modules/data/bulgaria_yy.csv')
    df_bulgaria_mm = pd.read_csv('modules/data/bulgaria_mm.csv')
    df_bulgaria_dd = pd.read_csv('modules/data/bulgaria_dd.csv')
    df_bulgaria_xxs = pd.read_csv('modules/data/bulgaria_xxs.csv')
    # checking the length
    length = len(nin)
    if length != 10:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the MM parameter
    mm = nin[2:4]
    if df_bulgaria_mm['MM'].isin([mm]).any():
        bd_month = df_bulgaria_mm.at[df_bulgaria_mm.loc[df_bulgaria_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the YY parameter
    yy = nin[0:2]
    if df_bulgaria_yy['YY'].isin([yy]).any():
        if 1 <= int(mm) <= 12:
            bd_year = df_bulgaria_yy.at[
                df_bulgaria_yy.loc[df_bulgaria_yy['YY'] == yy].index[0], 'YYYY_1900']
        elif 21 <= int(mm) <= 32:
            bd_year = df_bulgaria_yy.at[
                df_bulgaria_yy.loc[df_bulgaria_yy['YY'] == yy].index[0], 'YYYY_1800']
        elif 41 <= int(mm) <= 52:
            bd_year = df_bulgaria_yy.at[
                df_bulgaria_yy.loc[df_bulgaria_yy['YY'] == yy].index[0], 'YYYY_2000']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the DD parameter
    dd = nin[4:6]
    if df_bulgaria_dd['DD'].isin([dd]).any():
        bd_day = df_bulgaria_dd.at[df_bulgaria_dd.loc[df_bulgaria_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the XXX parameter
    xxs = nin[6:9]
    if df_bulgaria_xxs['XXS'].isin([xxs]).any():
        reg = df_bulgaria_xxs.at[df_bulgaria_xxs.loc[df_bulgaria_xxs['XXS'] == xxs].index[0], 'Region']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    s = nin[8:9]
    if int(s) % 2 == 0:
        sex = 'Male'
    else:
        sex = 'Female'
    c = nin[9]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex, '\nPlace of birth: ', reg,
          '\nChecksum symbol: ', c, '\n')
    return()

modules/bulgaria.py
duk3r4/KD6-3.7
import pandas as pd


def cze_alg_nin(nin):
    df_cze_yy = pd.read_csv('modules/data/cze_svk_yy.csv')
    df_cze_xx = pd.read_csv('modules/data/cze_svk_xx.csv')
    df_cze_dd = pd.read_csv('modules/data/cze_svk_dd.csv')
    # checking the length
    c = 'None (for people born before 1 January 1954)'
    length = len(nin)
    if length == 10:
        c = nin[9]
    elif length == 9:
        pass
    else:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the YY parameter
    yy = nin[0:2]
    if df_cze_yy['YY'].isin([yy]).any():
        bd_year = df_cze_yy.at[df_cze_yy.loc[df_cze_yy['YY'] == yy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again YY')
        return()
    # checking the XX parameter
    xx = nin[2:4]
    if df_cze_xx['XX'].isin([xx]).any():
        bd_month = df_cze_xx.at[df_cze_xx.loc[df_cze_xx['XX'] == xx].index[0], 'Month']
        sex = df_cze_xx.at[df_cze_xx.loc[df_cze_xx['XX'] == xx].index[0], 'Sex']
    else:
        print('The ID number is wrong. Please, try again XX')
        return()
    # checking the DD parameter
    dd = nin[4:6]
    if df_cze_dd['DD'].isin([dd]).any():
        bd_day = df_cze_dd.at[df_cze_dd.loc[df_cze_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again DD')
        return()
    # checking the XXX parameter
    sss = nin[6:9]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex,
          '\nSequence number of person with the same date of birth: ', int(sss), '\nChecksum symbol: ',
          c, '\n')
    return()

modules/czech_republic.py
duk3r4/KD6-3.7
import pandas as pd


def dnk_alg_nin(nin):
    df_denmark_yys = pd.read_csv('modules/data/denmark_yys.csv')
    df_denmark_mm = pd.read_csv('modules/data/denmark_mm.csv')
    df_denmark_dd = pd.read_csv('modules/data/denmark_dd.csv')
    # checking the length
    length = len(nin)
    if length != 10:
        print('Wrong length of the ID number. Please, try again')
        return ()
    # checking the DD parameter
    dd = nin[0:2]
    if df_denmark_dd['DD'].isin([dd]).any():
        bd_day = df_denmark_dd.at[df_denmark_dd.loc[df_denmark_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again DD')
        return()
    # checking the MM parameter
    mm = nin[2:4]
    if df_denmark_mm['MM'].isin([mm]).any():
        bd_month = df_denmark_mm.at[df_denmark_mm.loc[df_denmark_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again XX')
        return()
    # checking the YY parameter
    yy = nin[4:6]
    if df_denmark_yys['YY'].isin([yy]).any():
        if 0 <= int(nin[6]) <= 3:
            bd_year = df_denmark_yys.at[df_denmark_yys.loc[df_denmark_yys['YY'] == yy].index[0],
                                        'YYYY_0-3']
        elif int(nin[6]) == 4:
            bd_year = df_denmark_yys.at[df_denmark_yys.loc[df_denmark_yys['YY'] == yy].index[0],
                                        'YYYY_4']
        elif 5 <= int(nin[6]) <= 8:
            bd_year = df_denmark_yys.at[df_denmark_yys.loc[df_denmark_yys['YY'] == yy].index[0],
                                        'YYYY_5-8']
        elif int(nin[6]) == 9:
            bd_year = df_denmark_yys.at[df_denmark_yys.loc[df_denmark_yys['YY'] == yy].index[0],
                                        'YYYY_9']
    else:
        print('The ID number is wrong. Please, try again YY')
        return()
    # checking the SSSS parameter
    ssss = nin[9]
    if int(ssss) % 2 == 0:
        sex = 'Female'
    else:
        sex = 'Male'
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex, '\n')
    return()

modules/denmark.py
duk3r4/KD6-3.7
import pandas as pd


def est_alg_nin(nin):
    df_estonia_yy = pd.read_csv('modules/data/estonia_yy.csv')
    df_estonia_mm = pd.read_csv('modules/data/estonia_mm.csv')
    df_estonia_dd = pd.read_csv('modules/data/estonia_dd.csv')
    # checking the length
    length = len(nin)
    if length != 11:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the G parameter
    g = nin[0]
    if int(g) % 2 == 0:
        sex = 'Female'
    else:
        sex = 'Male'
    # checking the YY parameter
    yy = nin[1:3]
    if df_estonia_yy['YY'].isin([yy]).any():
        if 1 <= int(g) <= 2:
            bd_year = df_estonia_yy.at[df_estonia_yy.loc[df_estonia_yy['YY'] == yy].index[0],
                                       'YYYY_1-2']
        elif 3 <= int(g) <= 4:
            bd_year = df_estonia_yy.at[df_estonia_yy.loc[df_estonia_yy['YY'] == yy].index[0],
                                       'YYYY_3-4']
        elif 5 <= int(g) <= 6:
            bd_year = df_estonia_yy.at[df_estonia_yy.loc[df_estonia_yy['YY'] == yy].index[0],
                                       'YYYY_5-6']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = nin[3:5]
    if df_estonia_mm['MM'].isin([mm]).any():
        bd_month = df_estonia_mm.at[df_estonia_mm.loc[df_estonia_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the DD parameter
    dd = nin[5:7]
    if df_estonia_dd['DD'].isin([dd]).any():
        bd_day = df_estonia_dd.at[df_estonia_dd.loc[df_estonia_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the SSS parameter
    sss = nin[7:10]
    c = nin[10]
    msg = f'\nPersonal mail for contacting government agencies: {nin}@eesti.ee'
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ', bd_month,
          '\nYear of birth: ', bd_year, '\nSex: ', sex,
          '\nSequence number of person with the same date of birth: ', int(sss), '\nChecksum symbol: ', c,
          msg, '\n')
    return()

modules/estonia.py
duk3r4/KD6-3.7
import pandas as pd


def fin_alg_nin(nin):
    df_finland_yy = pd.read_csv('modules/data/finland_yy.csv')
    df_finland_mm = pd.read_csv('modules/data/finland_mm.csv')
    df_finland_dd = pd.read_csv('modules/data/finland_dd.csv')
    # checking the length
    length = len(nin)
    if length != 11:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the DD parameter
    dd = nin[0:2]
    if df_finland_dd['DD'].isin([dd]).any():
        bd_day = df_finland_dd.at[df_finland_dd.loc[df_finland_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = nin[2:4]
    if df_finland_mm['MM'].isin([mm]).any():
        bd_month = df_finland_mm.at[df_finland_mm.loc[df_finland_mm['MM'] == mm].index[0], 'Month']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the YY parameter
    yy = nin[4:6]
    if df_finland_yy['YY'].isin([yy]).any():
        pass
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the C parameter
    c = nin.upper()[6]
    xixcent = ['+']
    xxcent = ['-', 'U', 'V', 'W', 'X', 'Y']
    xxicent = ['A', 'B', 'C', 'D', 'E', 'F']
    if c in xixcent:
        bd_year = df_finland_yy.at[df_finland_yy.loc[df_finland_yy['YY'] == yy].index[0], 'YYYY_19']
    elif c in xxcent:
        bd_year = df_finland_yy.at[df_finland_yy.loc[df_finland_yy['YY'] == yy].index[0], 'YYYY_20']
    elif c in xxicent:
        bd_year = df_finland_yy.at[df_finland_yy.loc[df_finland_yy['YY'] == yy].index[0], 'YYYY_21']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the ZZZ parameter
    zzz = nin[7:10]
    if int(zzz) % 2 == 0:
        sex = 'Female'
    else:
        sex = 'Male'
    q = nin.upper()[10]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex,
          '\nSequence number of person with the same date of birth: ', int(zzz), '\nChecksum symbol: ',
          q, '\n')
    return()

modules/finland.py
duk3r4/KD6-3.7
import pandas as pd


def fra_alg_nin(ssn):
    df_france_yy = pd.read_csv('modules/data/france_yy.csv')
    df_france_mm = pd.read_csv('modules/data/france_mm.csv')
    df_france_com = pd.read_csv('modules/data/france_com.csv', low_memory=False)
    df_france_com_comer = pd.read_csv('modules/data/france_com_comer.csv')
    df_france_pays = pd.read_csv('modules/data/france_pays.csv')
    # checking the length
    length = len(ssn)
    if length != 13:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the S parameter
    s = ssn[0]
    temp = [3, 4, 7, 8]
    if int(s) == 1:
        sex = 'Male'
    elif int(s) == 2:
        sex = 'Female'
    elif int(s) in temp:
        sex = 'Unknown (the number has been assigned to the person on a temporary basis)'
    else:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the YY parameter
    yy = ssn[1:3]
    if df_france_yy['YY'].isin([yy]).any():
        bd_year = df_france_yy.at[df_france_yy.loc[df_france_yy['YY'] == yy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the MM parameter
    mm = ssn[3:5]
    if df_france_mm['MM'].isin([mm]).any():
        bd_month = df_france_mm.at[df_france_mm.loc[df_france_mm['MM'] == mm].index[0], 'Month']
    elif 20 <= int(mm) <= 30:
        bd_month = 'Unknown (the person was registered on the basis of a civil status document not specifying the ' \
                   'month of birth)'
    elif 50 <= int(mm) <= 99:
        bd_month = 'Unknown (the person was registered on the basis of a civil status document not specifying the ' \
                   'month of birth)'
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the LLOOO parameter
    llooo = ssn.upper()[5:10]
    if df_france_com['COG'].isin([llooo]).any():
        reg = df_france_com.at[df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'REG']
        ncc_reg = df_france_com.at[df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCC_REG']
        nccenr_reg = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCCENR_REG']
        libelle_reg = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'LIBELLE_REG']
        dep = df_france_com.at[df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'DEP']
        ncc_dep = df_france_com.at[df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCC_DEP']
        nccenr_dep = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCCENR_DEP']
        libelle_dep = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'LIBELLE_DEP']
        ncc_com = df_france_com.at[df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCC_COM']
        nccenr_com = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'NCCENR_COM']
        libelle_com = df_france_com.at[
            df_france_com.loc[df_france_com['COG'] == llooo].index[0], 'LIBELLE_COM']
    elif df_france_com_comer['COG'].isin([llooo]).any():
        ncc_com_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'NCC_COM_COMER']
        nccenr_com_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'NCCENR_COM_COMER']
        libelle_com_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'LIBELLE_COM_COMER']
        comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'COMER']
        ncc_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'NCC_COMER']
        nccenr_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'NCCENR_COMER']
        libelle_comer = df_france_com_comer.at[
            df_france_com_comer.loc[df_france_com_comer['COG'] == llooo].index[0], 'LIBELLE_COMER']
    elif df_france_pays['COG'].isin([llooo]).any():
        libcog = df_france_pays.at[
            df_france_pays.loc[df_france_pays['COG'] == llooo].index[0], 'LIBCOG']
        libenr = df_france_pays.at[
            df_france_pays.loc[df_france_pays['COG'] == llooo].index[0], 'LIBENR']
        codeiso2 = df_france_pays.at[
            df_france_pays.loc[df_france_pays['COG'] == llooo].index[0], 'CODEISO2']
        codeiso3 = df_france_pays.at[
            df_france_pays.loc[df_france_pays['COG'] == llooo].index[0], 'CODEISO3']
    else:
        print('The ID number is wrong. Please, try again')
        return()
    # checking the KKK parameter
    kkk = ssn[10:12]
    mm_comment_2 = 'The person was registered on the basis of an incomplete civil status document'
    print('\nHere\'s what I got from that ID number:\nMonth of birth: ', bd_month, '\nYear of birth: ',
          bd_year, '\nSex: ', sex)
    if df_france_com['COG'].isin([llooo]).any():
        print('The region of origin: ', ncc_reg, '/', nccenr_reg, '/', libelle_reg, ' (', reg,
              ')\nThe department of origin: ', ncc_dep, '/', nccenr_dep, '/', libelle_dep, ' (', dep,
              ')\nThe commune of origin: ', ncc_com, '/', nccenr_com, '/', libelle_com)
    elif df_france_com_comer['COG'].isin([llooo]).any():
        print('The territory of origin: ', ncc_com_comer, '/', nccenr_com_comer, '/',
              libelle_com_comer, '\nThe commune of origin: ', ncc_comer, '/', nccenr_comer, '/',
              libelle_comer, ' (', comer, ')')
    elif df_france_pays['COG'].isin([llooo]).any():
        print('The country of origin: ', libcog, '/', libenr, ' (', codeiso2, '/', codeiso3, ')')
    print('Sequence number of person with the same date of birth: ', int(kkk), '\n')
    return()

modules/france.py
duk3r4/KD6-3.7
import pandas as pd


def svk_alg_nin(nin):
    df_slovakia_yy = pd.read_csv('modules/data/cze_svk_yy.csv')
    df_slovakia_xx = pd.read_csv('modules/data/cze_svk_xx.csv')
    df_slovakia_dd = pd.read_csv('modules/data/cze_svk_dd.csv')
    # checking the length
    c = 'None (for people born before 1 January 1954)'
    length = len(nin)
    if length == 10:
        c = nin[9]
    elif length == 9:
        pass
    else:
        print('Wrong length of the ID number. Please, try again')
        return()
    # checking the YY parameter
    yy = nin[0:2]
    if df_slovakia_yy['YY'].isin([yy]).any():
        bd_year = df_slovakia_yy.at[df_slovakia_yy.loc[df_slovakia_yy['YY'] == yy].index[0], 'YYYY']
    else:
        print('The ID number is wrong. Please, try again YY')
        return()
    # checking the XX parameter
    xx = nin[2:4]
    if df_slovakia_xx['XX'].isin([xx]).any():
        bd_month = df_slovakia_xx.at[df_slovakia_xx.loc[df_slovakia_xx['XX'] == xx].index[0], 'Month']
        sex = df_slovakia_xx.at[df_slovakia_xx.loc[df_slovakia_xx['XX'] == xx].index[0], 'Sex']
    else:
        print('The ID number is wrong. Please, try again XX')
        return()
    # checking the DD parameter
    dd = nin[4:6]
    if df_slovakia_dd['DD'].isin([dd]).any():
        bd_day = df_slovakia_dd.at[df_slovakia_dd.loc[df_slovakia_dd['DD'] == dd].index[0], 'Day']
    else:
        print('The ID number is wrong. Please, try again DD')
        return()
    # checking the XXX parameter
    sss = nin[6:9]
    print('\nHere\'s what I got from that ID number:\nDay of birth: ', bd_day, '\nMonth of birth: ',
          bd_month, '\nYear of birth: ', bd_year, '\nSex: ', sex,
          '\nSequence number of person with the same date of birth: ', int(sss), '\nChecksum symbol: ',
          c, '\n')
    return()

modules/slovakia.py
duk3r4/KD6-3.7