bug fix, adding information

docker
Steve L. Nyemba 5 years ago
parent 0fbead54f5
commit 5716543819

@ -77,6 +77,7 @@ if __name__ == '__main__' :
files = os.listdir(SYS_ARGS['folder'])
CONFIG = json.loads(open(SYS_ARGS['config']).read())
SECTION = INFO[scope]['section']
for file in files :
if 'limit' in SYS_ARGS and files.index(file) == int(SYS_ARGS['limit']) :
break

@ -64,17 +64,27 @@ def get_config(config,row):
return _info
def format_date(value) :
if len(value) == 8 :
year = value[:4]
month = value[4:6]
day = value[6:]
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):
return ":".join([value[:2],value[2:] ])[:5]
def format_proc(value):
if ':' in value :
return {"type":value.split(':')[0].strip(),"code":value.split(':')[1].strip()}
else:
return value
for xchar in [':','<']
if xchar in value and len(value.split(xchar)) == 2
_value = {"type":value.split(':')[0].strip(),"code":value.split(':')[1].strip()}
break
else
_value = str(value)
return _value
def format_diag(value):
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('~','')
TOP_ROW = x12_file[1].split('*')
CATEGORY= x12_file[2].split('*')[1].strip()
VERSION = x12_file[1].split('*')[-1].replace('~','')
SUBMITTED_DATE = format_date(TOP_ROW[4])
SENDER_ID = TOP_ROW[2]
@ -176,7 +187,7 @@ def get_content(filename,config,section=None) :
# print (pointer(row))
tmp = get_map(row,_info,VERSION)
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]})
else:
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
if TOP_ROW[1] == 'HP' :
tmp['payer_id'] = SENDER_ID
else:
elif TOP_ROW[1] == 'HC':
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)

Loading…
Cancel
Save