v2.0 upgrade #10

Merged
steve merged 26 commits from v2.0 into master 2024-02-09 16:00:08 +00:00
3 changed files with 10 additions and 9 deletions
Showing only changes of commit a863f5e2b9 - Show all commits

View File

@ -100,8 +100,8 @@ def DTP (**_args):
# _columns = ['to','from','type']
# return self.parse(_columns,[3],**_args)
_data = _args['data']
_data['to'] = '-'.join([_data['to'][:4],_data['to'][4:6],_data['to'][6:]])
_data['from'] = '-'.join([_data['from'][:4],_data['from'][4:6],_data['from'][6:]])
_data['end_date'] = '-'.join([_data['end_date'][:4],_data['end_date'][4:6],_data['end_date'][6:]])
_data['start_date'] = '-'.join([_data['start_date'][:4],_data['start_date'][4:6],_data['start_date'][6:]])
return _data
pass
@parser(element='PER',anchor={'IC':'submitter'},map={2:'contact',4:'phone_number',8:'email'})
@ -124,7 +124,7 @@ def CLM (**_args):
Expected Element CLM
"""
_data = _args['data']
_data['claim_amount'] = np.float64(_data['claim_amount'])
_data['claim_amount'] = np.float64(_data['claim_amount']) if _data['claim_amount'] not in ['',None] else ''
return _data
# _columns = ['claim_id','claim_amount','facility_code','facility_qualifier','frequency_code']
# return self.parse(_columns,[1,2,5,5,5],**_args)

View File

@ -30,7 +30,7 @@ def BPR (**_args):
def CLP (**_args):
_data = _args['data']
for _id in ['charge_amount','payment_amount','patient_amount']:
_data[_id] = np.float64(_data[_id])
_data[_id] = np.float64(_data[_id]) if _data[_id].strip() not in ['',None] else None
return _data
pass
@parser (element='PER',x12='835',field="billing_provider",map={2:'name',4:'phone_number'})

View File

@ -109,7 +109,7 @@ def init(**_args):
_data = format(rows= _df.iloc[_ii].to_dict(orient='records'),x12=_file_type,primary_key=_pkey)
_thread = Process(target=post,args=({'store':_store['target'],'data':_data,'default':_default},))
_thread = Process(target=post,args=({'store':_store['target'],'data':_data,'default':_default,'x12':_file_type},))
jobs.append(_thread)
if jobs :
jobs[0].start()
@ -133,18 +133,19 @@ def post(_args):
_data = _args['data']
_store = _args['store']
_default = _args['default']
_prefix = 'clm_' if _args['x12'] == '837' else 'rem_'
for _name in _data :
_store['table'] = _name
_tablename = _prefix+_name
_store['table'] = _tablename if _name not in ['remits','claims'] else _name
_store['context']='write'
writer = transport.factory.instance(**_store)
if len(_data[_name]) == 0 and _name in _default:
if len(_data[_name]) == 0 and _name in _default and not writer.has(table=_tablename):
_rows = [_default[_name]]
else:
_rows = _data[_name]
writer.write(_rows)
writer.write(pd.DataFrame(_rows).fillna(''))
if hasattr(writer,'close') :
writer.close()