77 lines
2.8 KiB
Python
77 lines
2.8 KiB
Python
import numpy as np
|
|
from .. import parser
|
|
|
|
@parser(element='ISA',x12='835',field='header', map={6:'submitter_id',8:'receiver_id',9:'date',10:'time'})
|
|
def ISA(**_args):
|
|
"""
|
|
:row raw {x12} row
|
|
:data parsed data
|
|
:meta elements containing map {index:field_name}
|
|
"""
|
|
# print (_args['data'])
|
|
pass
|
|
|
|
@parser(element='ST',x12='835', field='ISA', map={1:'x12',2:'control_number'})
|
|
def ST(**_args):
|
|
"""
|
|
:row raw {x12} row
|
|
:data parsed data
|
|
:meta elements containing map {index:field_name}
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
@parser (element='BPR',x12='835',map={2:'transaction_amount',3:'transaction_type',4:'method',6:'depository'})
|
|
def BPR (**_args):
|
|
pass
|
|
@parser(element='CLP',x12='835',
|
|
map={1:'claim_id',2:'status',3:'charge_amount',4:'payment_amount',5:'patient_amount',7:'claim_control_number',8:'bill_type',10:'patient_status',11:'drg_code'})
|
|
def CLP (**_args):
|
|
_data = _args['data']
|
|
for _id in ['charge_amount','payment_amount','patient_amount']:
|
|
_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'})
|
|
def PER (**_args):
|
|
pass
|
|
@parser(element='N1',x12='835',anchor={'PE':'billing_provider','PR':'payer'},map={2:'address_line_1',4:'id'})
|
|
def N1(**_args):
|
|
pass
|
|
@parser(element='DTM',x12='835',container='dates',map={1:'type',2:'date'})
|
|
def DTM(**_args):
|
|
pass
|
|
@parser(element='PLB',x12='835',container='provider', map={1:'id',2:'adjustment_fiscal_year',-1:'adjustment_amount'})
|
|
def PLB(**_args):
|
|
pass
|
|
@parser(element='CAS',x12='835',container='adjustments',map={2:'reason',3:'amount',4:'quantity'})
|
|
def CAS(**_args):
|
|
pass
|
|
@parser(element='SVC',x12='835',container='procedures',map={1:['code','type'],2:'charge_amount',3:'paid_amount',7:'submitted_units',4:'revenue_code',5:'paid_units_of_service'})
|
|
def SVC (**_args):
|
|
_data = _args['data']
|
|
_data['type'] = _data['type'].split('|')[0]
|
|
_data['code'] = _data['code'].split('|')[1]
|
|
_data['charge_amount'] = np.float64(_data['charge_amount'])
|
|
_data['paid_amount'] = np.float64(_data['paid_amount'])
|
|
return _data
|
|
pass
|
|
# @parser(element='N1',x12='835',anchor={'PR':'provider'},map={1:'name'})
|
|
# def N1(**_args):
|
|
# pass
|
|
@parser(element='N3',x12='835',parent='N1',map={1:'address_line_1'})
|
|
def N3(**_args):
|
|
pass
|
|
@parser(element='N4',x12='835',parent='N1',map={1:'city',2:'state',3:'zipcode'})
|
|
def N4(**_args):
|
|
pass
|
|
|
|
@parser (element='AMT',x12='835',container='amounts', map={2:'amount',1:'type'})
|
|
def AMT (**_args):
|
|
_data = _args['data']
|
|
_map = {'B6':'AMOUNT_ALLOWED','AU':'AMOUNT_COVERED','F5':'PATIENT_PAID'}
|
|
if _data['type'] in _map :
|
|
_data['type'] = _map[_data['type']]
|
|
_data['amount'] = np.float64(_data['amount'])
|
|
return _data |