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 os
import sys import sys
import json
def split(row,sep='*',prefix='HI'): def split(row,sep='*',prefix='HI'):
""" """
This function is designed to split an x12 row and This function is designed to split an x12 row and
@ -30,10 +31,13 @@ def split(row,sep='*',prefix='HI'):
if '>' in row_value : if '>' in row_value :
if row_value.startswith('HC') or row_value.startswith('AD'): if row_value.startswith('HC') or row_value.startswith('AD'):
value += row_value.split('>')[:2] value += row_value.split('>')[:2]
else: else:
value += row_value.split('>')
value += row_value.split('>') if row.startswith('CLM') is False else [row_value]
else : else :
value.append(row_value) value.append(row_value)
return [xchar.replace('\r','') for xchar in value] #row.replace('~','').split(sep) return [xchar.replace('\r','') for xchar in value] #row.replace('~','').split(sep)
else: else:
@ -88,13 +92,20 @@ def format_proc(value):
def format_diag(value): def format_diag(value):
return [ {"code":item[2], "type":item[1]} for item in value if len(item) > 1] 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): def get_map(row,config,version):
label = config['label'] if 'label' in config else None label = config['label'] if 'label' in config else None
omap = config['map'] if version not in config else config[version] omap = config['map'] if version not in config else config[version]
anchors = config['anchors'] if 'anchors' in config else [] anchors = config['anchors'] if 'anchors' in config else []
if type(row[0]) == str: if type(row[0]) == str:
object_value = {} object_value = {}
for key in omap : for key in omap :
index = omap[key] index = omap[key]
@ -108,13 +119,21 @@ def get_map(row,config,version):
value = row[index] value = row[index]
if 'cast' in config and key in config['cast'] and value.strip() != '' : if 'cast' in config and key in config['cast'] and value.strip() != '' :
value = eval(config['cast'][key])(value) value = eval(config['cast'][key])(value)
pass
if 'syn' in config and value in config['syn'] :
value = config['syn'][value]
if type(value) == dict : if type(value) == dict :
object_value = dict(object_value, **value)
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: else:
object_value[key] = value object_value[key] = value
else: else:

View File

@ -7,9 +7,18 @@ import sys
def read(fname): def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() 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["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['url'] = 'https://hiplab.mc.vanderbilt.edu'
# args['scripts']= ['bin/parse-claims']
if sys.version_info[0] == 2 : if sys.version_info[0] == 2 :
args['use_2to3'] = False args['use_2to3'] = False
args['use_2to3_exclude_fixers'] = ['lib2to3.fixes.fix_import'] args['use_2to3_exclude_fixers'] = ['lib2to3.fixes.fix_import']