bug fix: submitted_date, sender_id included

This commit is contained in:
Steve Nyemba 2020-01-31 23:13:19 -06:00
parent f27e5773fd
commit a4913c0ba8
2 changed files with 18 additions and 6 deletions

View File

@ -64,13 +64,15 @@ if __name__ == '__main__' :
args['dbname'] = SYS_ARGS['db']
elif SYS_ARGS ['store'] == 'mongo':
args = {'host':SYS_ARGS['host']if 'host' in SYS_ARGS else 'localhost:27217'}
args = {'host':SYS_ARGS['host']if 'host' in SYS_ARGS else 'localhost:27017'}
if SYS_ARGS['store'] in ['mongo','couch']:
args['dbname'] = SYS_ARGS['db'] if 'db' in SYS_ARGS else 'claims_outcomes'
args['doc'] = CONTEXT
TYPE = TYPE[SYS_ARGS['store']]
writer = factory.instance(type=TYPE,args=args)
if SYS_ARGS['store'] == 'disk':
writer.init(path = 'output-claims.json')
logger = factory.instance(type=TYPE,args= dict(args,**{"doc":"logs"}))
files = os.listdir(SYS_ARGS['folder'])
CONFIG = json.loads(open(SYS_ARGS['config']).read())
@ -90,10 +92,12 @@ if __name__ == '__main__' :
logs = [{"filename":filename,"msg":e.message}]
content = None
if content :
writer.write(row= content)
writer.write(content)
if logs:
logger.write(row=logs)
logger.write(logs)
pass
else:

View File

@ -150,8 +150,10 @@ def get_content(filename,config,section=None) :
logs = []
# VERSION = x12_file[2].split('*')[3].replace('~','')
TOP_ROW = x12_file[1].split('*')
VERSION = x12_file[1].split('*')[-1].replace('~','')
SUBMITTED_DATE = format_date(TOP_ROW[4])
SENDER_ID = TOP_ROW[2]
row = split(x12_file[3])
_info = get_config(config,row)
@ -183,6 +185,12 @@ def get_content(filename,config,section=None) :
if 'label' not in _info :
tmp['version'] = VERSION
tmp['submitted'] = SUBMITTED_DATE
if TOP_ROW[1] == 'HP' :
tmp['payer_id'] = SENDER_ID
else:
tmp['provider_id'] = SENDER_ID
claim = dict(claim, **tmp)