bug fix, adding information
This commit is contained in:
parent
0fbead54f5
commit
5716543819
|
@ -76,7 +76,8 @@ if __name__ == '__main__' :
|
||||||
logger = factory.instance(type=TYPE,args= dict(args,**{"doc":"logs"}))
|
logger = factory.instance(type=TYPE,args= dict(args,**{"doc":"logs"}))
|
||||||
files = os.listdir(SYS_ARGS['folder'])
|
files = os.listdir(SYS_ARGS['folder'])
|
||||||
CONFIG = json.loads(open(SYS_ARGS['config']).read())
|
CONFIG = json.loads(open(SYS_ARGS['config']).read())
|
||||||
SECTION= INFO[scope]['section']
|
SECTION = INFO[scope]['section']
|
||||||
|
|
||||||
for file in files :
|
for file in files :
|
||||||
if 'limit' in SYS_ARGS and files.index(file) == int(SYS_ARGS['limit']) :
|
if 'limit' in SYS_ARGS and files.index(file) == int(SYS_ARGS['limit']) :
|
||||||
break
|
break
|
||||||
|
|
|
@ -64,17 +64,27 @@ def get_config(config,row):
|
||||||
|
|
||||||
return _info
|
return _info
|
||||||
def format_date(value) :
|
def format_date(value) :
|
||||||
|
if len(value) == 8 :
|
||||||
year = value[:4]
|
year = value[:4]
|
||||||
month = value[4:6]
|
month = value[4:6]
|
||||||
day = value[6:]
|
day = value[6:]
|
||||||
return "-".join([year,month,day])[:10] #{"year":year,"month":month,"day":day}
|
return "-".join([year,month,day])[:10] #{"year":year,"month":month,"day":day}
|
||||||
|
elif len(value) == 6 :
|
||||||
|
year = '20' + value[:2]
|
||||||
|
month = value[2:4]
|
||||||
|
day = value[4:]
|
||||||
|
return "-".join([year,month,day])
|
||||||
def format_time(value):
|
def format_time(value):
|
||||||
return ":".join([value[:2],value[2:] ])[:5]
|
return ":".join([value[:2],value[2:] ])[:5]
|
||||||
def format_proc(value):
|
def format_proc(value):
|
||||||
if ':' in value :
|
for xchar in [':','<']
|
||||||
return {"type":value.split(':')[0].strip(),"code":value.split(':')[1].strip()}
|
if xchar in value and len(value.split(xchar)) == 2
|
||||||
else:
|
_value = {"type":value.split(':')[0].strip(),"code":value.split(':')[1].strip()}
|
||||||
return value
|
break
|
||||||
|
else
|
||||||
|
_value = str(value)
|
||||||
|
|
||||||
|
return _value
|
||||||
def format_diag(value):
|
def format_diag(value):
|
||||||
|
|
||||||
return [ {"code":item[2], "type":item[1]} for item in value if len(item) > 1]
|
return [ {"code":item[2], "type":item[1]} for item in value if len(item) > 1]
|
||||||
|
@ -151,6 +161,7 @@ def get_content(filename,config,section=None) :
|
||||||
|
|
||||||
# VERSION = x12_file[2].split('*')[3].replace('~','')
|
# VERSION = x12_file[2].split('*')[3].replace('~','')
|
||||||
TOP_ROW = x12_file[1].split('*')
|
TOP_ROW = x12_file[1].split('*')
|
||||||
|
CATEGORY= x12_file[2].split('*')[1].strip()
|
||||||
VERSION = x12_file[1].split('*')[-1].replace('~','')
|
VERSION = x12_file[1].split('*')[-1].replace('~','')
|
||||||
SUBMITTED_DATE = format_date(TOP_ROW[4])
|
SUBMITTED_DATE = format_date(TOP_ROW[4])
|
||||||
SENDER_ID = TOP_ROW[2]
|
SENDER_ID = TOP_ROW[2]
|
||||||
|
@ -176,7 +187,7 @@ def get_content(filename,config,section=None) :
|
||||||
# print (pointer(row))
|
# print (pointer(row))
|
||||||
tmp = get_map(row,_info,VERSION)
|
tmp = get_map(row,_info,VERSION)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if sys.verion_info[0] > 2 :
|
if sys.version_info[0] > 2 :
|
||||||
logs.append ({"version":VERSION,"filename":filename,"msg":e.args[0],"X12":x12_file[beg:end]})
|
logs.append ({"version":VERSION,"filename":filename,"msg":e.args[0],"X12":x12_file[beg:end]})
|
||||||
else:
|
else:
|
||||||
logs.append ({"version":VERSION,"filename":filename,"msg":e.message,"X12":x12_file[beg:end]})
|
logs.append ({"version":VERSION,"filename":filename,"msg":e.message,"X12":x12_file[beg:end]})
|
||||||
|
@ -188,9 +199,11 @@ def get_content(filename,config,section=None) :
|
||||||
tmp['submitted'] = SUBMITTED_DATE
|
tmp['submitted'] = SUBMITTED_DATE
|
||||||
if TOP_ROW[1] == 'HP' :
|
if TOP_ROW[1] == 'HP' :
|
||||||
tmp['payer_id'] = SENDER_ID
|
tmp['payer_id'] = SENDER_ID
|
||||||
else:
|
|
||||||
|
elif TOP_ROW[1] == 'HC':
|
||||||
tmp['provider_id'] = SENDER_ID
|
tmp['provider_id'] = SENDER_ID
|
||||||
|
|
||||||
|
tmp['category'] = {"setid": CATEGORY,"version":'X'+VERSION.split('X')[1],"id":VERSION.split('X')[0].strip()}
|
||||||
claim = dict(claim, **tmp)
|
claim = dict(claim, **tmp)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue