adding place of service handling for 837

This commit is contained in:
Steve Nyemba 2020-03-27 14:19:33 -05:00
parent edde93dc40
commit e485477361
2 changed files with 36 additions and 8 deletions

View File

@ -19,6 +19,7 @@
"""
import os
import sys
import json
def split(row,sep='*',prefix='HI'):
"""
This function is designed to split an x12 row and
@ -32,8 +33,11 @@ def split(row,sep='*',prefix='HI'):
value += row_value.split('>')[:2]
else:
value += row_value.split('>')
value += row_value.split('>') if row.startswith('CLM') is False else [row_value]
else :
value.append(row_value)
return [xchar.replace('\r','') for xchar in value] #row.replace('~','').split(sep)
else:
@ -88,6 +92,13 @@ def format_proc(value):
def format_diag(value):
return [ {"code":item[2], "type":item[1]} for item in value if len(item) > 1]
def format_pos(value):
xchar = '>' if '>' in value else ':'
x = value.split(xchar)
x = {"code":x[0],"indicator":x[1],"frequency":x[2]} if len(x) == 3 else {"code":x[0],"indicator":None,"frequency":None}
return x
def get_map(row,config,version):
label = config['label'] if 'label' in config else None
@ -108,12 +119,20 @@ def get_map(row,config,version):
value = row[index]
if 'cast' in config and key in config['cast'] and value.strip() != '' :
value = eval(config['cast'][key])(value)
pass
if type(value) == dict :
for objkey in value :
if 'syn' in config and value[objkey] in config['syn'] :
value[objkey] = config['syn'][ value[objkey]]
value = {key:value}
else:
if 'syn' in config and value in config['syn'] :
value = config['syn'][value]
if type(value) == dict :
object_value = dict(object_value, **value)
else:
object_value[key] = value

View File

@ -7,9 +7,18 @@ import sys
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
args = {"name":"parse-edi","version":"1.0.0","author":"Vanderbilt University Medical Center","author_email":"steve.l.nyemba@vanderbilt.edu","license":"MIT","packages":["edi"],"keywords":["healthcare","edi","x12","data","transport","protocol"]}
args = {
"name":"parse-edi","version":"1.0.2",
"author":"Vanderbilt University Medical Center",
"author_email":"steve.l.nyemba@vumc.org",
"license":"MIT",
"packages":["edi"],
"keywords":["healthcare","edi","x12","analytics","835","837","data","transport","protocol"]
}
args["install_requires"] = ['data-transport@git+https://dev.the-phi.com/git/steve/data-transport.git','pymongo','numpy','cloudant','pika','boto','flask-session','smart_open']
args['url'] = 'https://hiplab.mc.vanderbilt.edu'
# args['scripts']= ['bin/parse-claims']
if sys.version_info[0] == 2 :
args['use_2to3'] = False
args['use_2to3_exclude_fixers'] = ['lib2to3.fixes.fix_import']