Esempio n. 1
0
mapping['EXPIR'] = process_EXPIR
mapping['FIRST'] = lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : ''}}]
mapping['MID'] =   lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'b' : x}}]
mapping['LAST'] =  lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'c' : x+','}}]
mapping['SAL'] =   lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'d' : x}}]
mapping['LMSG'] =  lambda x: [{'tag': '117', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['NOTES'] = lambda x: [{'tag': '120', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ALTNA'] = lambda x: [{'tag': '400', 'ind1': ' ', 'ind2': ' ', 'subs': {'c' : x}}]
mapping['ROOM'] =  lambda x: [{'tag': '124', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['RTCNT'] = lambda x: [{'tag': '125', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['SEC'] =   lambda x: [{'tag': '127', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['STAMP'] = process_STAMP
mapping['TEL'] =   lambda x: [{'tag': '130', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['TEL2'] =  lambda x: [{'tag': '130', 'ind1': ' ', 'ind2': ' ', 'subs': {'b' : x}}]
mapping['TYPE'] =  lambda x: [{'tag': '132', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : fix_TYPE.get(x, x)}}]
mapping['UP'] =    process_UP()

def get_id(record):
    uid = record.get('UID', '')
    guid = record.get('GUID', '')
    pa = record.get('PA', '')
    user_id = uid
    if len(user_id) != 6:
        user_id = guid
    if len(user_id) != 6:
        user_id = pa
    if len(user_id) != 6:
        user_id = uid
        if len(user_id) != 7:
            user_id = guid
        if len(user_id) != 7:
Esempio n. 2
0
mapping['FYEAR'] = lambda x: [{'tag': '106', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['GLOUP'] = lambda x: [{'tag': '107', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['HIST'] =  lambda x: [{'tag': '108', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['IDISC'] = lambda x: [{'tag': '109', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['IPSTG'] = lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ITAX'] =  lambda x: [{'tag': '111', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ITEMS'] = lambda x: [{'tag': '112', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ODATE'] = lambda x: [{'tag': '113', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ONO'] =   lambda x: [{'tag': '114', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['ONOTE'] = lambda x: [{'tag': '115', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['PAID'] =  lambda x: [{'tag': '116', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['PAYMT'] = lambda x: [{'tag': '117', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['PSTG1'] = lambda x: [{'tag': '118', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['STATD'] = lambda x: [{'tag': '119', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['STAT'] =  lambda x: [{'tag': '120', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['UP'] =    process_UP('121')
mapping['SUBT'] =  lambda x: [{'tag': '122', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['SUBT1'] = lambda x: [{'tag': '123', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['TAX1'] =  lambda x: [{'tag': '124', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['TAXP'] =  lambda x: [{'tag': '125', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['TOTA1'] = lambda x: [{'tag': '126', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['TOTAL'] = lambda x: [{'tag': '127', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['VCODE'] = lambda x: [{'tag': '128', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['STAMP'] = process_STAMP
mapping['VNAME'] = lambda x: [{'tag': '130', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['WAIT'] =  lambda x: [{'tag': '131', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]


def format_record(recid, record=None):
    if not record:
        record = ALL[str(recid)]
Esempio n. 3
0
mapping['DES'] =   lambda x: [{'tag': '106', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['ED'] =    lambda x: [{'tag': '107', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
# mapping['EXCLM'] = lambda x: [{'tag': '108', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['EXP'] =   lambda x: [{'tag': '109', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['FREQ'] =  lambda x: [{'tag': '110', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': fix_FREQ.get(x, x)}}]
mapping['HOLD'] =  lambda x: [{'tag': '111', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': e}} for e in split_subfields(x)]
mapping['ISSN'] =  lambda x: [{'tag': '112', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['ISSUE'] = process_ISSUE #lambda x: [{'tag': '113', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['LANG'] =  lambda x: [{'tag': '114', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': languages[e.title()]}} for e in flatten_list([a.split('/') for a in split_subfields(x)])]
mapping['OS'] =    lambda x: [{'tag': '115', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['PDATE'] = lambda x: [{'tag': '116', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['PNOTE'] = lambda x: [{'tag': '117', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': '; '.join(x.strip(whitespace+'|').split('\n        |'))}}]
mapping['PSTAT'] = lambda x: [{'tag': '118', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['PUB'] =   lambda x: [{'tag': '119', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['REG'] =   lambda x: [{'tag': '120', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['STAMP'] = process_UP('121')
mapping['ROUTE'] = process_ROUTE
mapping['SUB'] =   lambda x: [{'tag': '123', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['TI'] =    lambda x: [{'tag': '124', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['TNOTE'] = lambda x: [{'tag': '125', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['TYPE'] =  lambda x: [{'tag': '126', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
# mapping['VADDR'] = lambda x: [{'tag': '127', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['VCODE'] = lambda x: [{'tag': '128', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['UP'] =    process_STAMP
# mapping['VNAME'] = lambda x: [{'tag': '130', 'ind1': ' ', 'ind2': ' ', 'subs': {'a' : x}}]
mapping['VOL'] =   lambda x: [{'tag': '131', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['XREF'] =  lambda x: [{'tag': '132', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': e}} for e in split_subfields(x)]
mapping['YEAR'] =  lambda x: [{'tag': '133', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]

mapping['OPER'] =  lambda x: [{'tag': '123', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]
mapping['FREPY'] = lambda x: [{'tag': '123', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': x}}]