bug fix, procedure code processing

This commit is contained in:
Steve Nyemba 2021-01-18 14:49:56 -06:00
parent 52fc7e4b0f
commit 086d08906f
1 changed files with 13 additions and 8 deletions

View File

@ -56,10 +56,12 @@ class Formatters :
for row_value in row.replace('~','').split(sep) :
if '>' in row_value :
if row_value.startswith('HC') or row_value.startswith('AD'):
if '>' in row_value and not row_value.startswith('HC'):
# if row_value.startswith('HC') or row_value.startswith('AD'):
if row_value.startswith('AD'):
value += row_value.split('>')[:2]
pass
else:
value += row_value.split('>') if row.startswith('CLM') is False else [row_value]
@ -159,17 +161,20 @@ class Formatters :
def procedure(self,value):
for xchar in [':','<','|'] :
for xchar in [':','<','|','>'] :
if xchar in value and len(value.split(xchar)) > 1 :
#_value = {"type":value.split(':')[0].strip(),"code":value.split(':')[1].strip()}
_value = {"type":value.split(xchar)[0].strip(),"code":value.split(xchar)[1].strip()}
if value.split(xchar) >= 3 :
if len(value.split(xchar)) >2 :
_value['modifier'] = value.split(xchar)[2]
break
else:
_value = str(value)
return _value
def diagnosis(self,alue):
def diagnosis(self,value):
return [ {"code":item[2], "type":item[1]} for item in value if len(item) > 1]
def pos(self,value):
@ -220,8 +225,7 @@ class Parser (Process):
files = os.listdir(_path)
if files :
fullname = os.sep.join([_path,files[0]])
fullname = os.sep.join([_path,files[0]])
_config = json.loads ( (open(fullname)).read() )
return _config
@ -258,7 +262,8 @@ class Parser (Process):
if config['cast'][key] in ['float','int'] :
value = eval(config['cast'][key])(value)
elif hasattr(handler,config['cast'][key]):
pointer = getattr(handler,config['cast'][key])
pointer = getattr(handler,config['cast'][key])
value = pointer(value)
else:
print ("Missing Pointer ",config['cast'][key])