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