|
|
|
@ -36,7 +36,8 @@ class Formatters :
|
|
|
|
|
self.parse = void()
|
|
|
|
|
self.parse.sv3 = self.sv3
|
|
|
|
|
self.parse.sv2 = self.sv2
|
|
|
|
|
self.sv2_parse = self.sv2
|
|
|
|
|
self.sv2_parser = self.sv2
|
|
|
|
|
self.sv3_parser = self.sv3
|
|
|
|
|
self.sv3_parse = self.sv3
|
|
|
|
|
self.format_proc = self.procedure
|
|
|
|
|
self.format_diag = self.diagnosis
|
|
|
|
@ -241,9 +242,11 @@ class Parser (Process):
|
|
|
|
|
|
|
|
|
|
# label = config['label'] if 'label' in config else None
|
|
|
|
|
handler = Formatters()
|
|
|
|
|
|
|
|
|
|
if 'map' not in config and hasattr(handler,config['apply']):
|
|
|
|
|
|
|
|
|
|
pointer = getattr(handler,config['apply'])
|
|
|
|
|
|
|
|
|
|
object_value = pointer(row)
|
|
|
|
|
return object_value
|
|
|
|
|
#
|
|
|
|
@ -355,8 +358,10 @@ class Parser (Process):
|
|
|
|
|
_cinfo = util.get.config(self._custom_config[_code],row)
|
|
|
|
|
else:
|
|
|
|
|
_cinfo = {}
|
|
|
|
|
|
|
|
|
|
if _info :
|
|
|
|
|
if 'SV3' in row :
|
|
|
|
|
print (row)
|
|
|
|
|
print (_info)
|
|
|
|
|
if _info or _cinfo:
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
@ -364,7 +369,7 @@ class Parser (Process):
|
|
|
|
|
_info = jsonmerge.merge(_info,_cinfo)
|
|
|
|
|
tmp = self.get.value(row,_info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not tmp :
|
|
|
|
|
continue
|
|
|
|
|
if 'label' in _info :
|
|
|
|
@ -394,8 +399,8 @@ class Parser (Process):
|
|
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
except Exception as e :
|
|
|
|
|
|
|
|
|
|
print ('__',e.args)
|
|
|
|
|
print (e.args[0])
|
|
|
|
|
# print ('__',(dir(e.args)))
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
return value if value else {}
|
|
|
|
@ -464,6 +469,7 @@ class Parser (Process):
|
|
|
|
|
row = row.replace('\r','')
|
|
|
|
|
if not segment and not row.startswith(section):
|
|
|
|
|
_toprows += [row]
|
|
|
|
|
|
|
|
|
|
if row.startswith(section) and not segment:
|
|
|
|
|
|
|
|
|
|
segment = [row]
|
|
|
|
@ -479,6 +485,7 @@ class Parser (Process):
|
|
|
|
|
#
|
|
|
|
|
# process the segment somewhere (create a thread maybe?)
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
_claim = self.apply(segment,_code)
|
|
|
|
|
|
|
|
|
|
if _claim :
|
|
|
|
@ -496,7 +503,11 @@ class Parser (Process):
|
|
|
|
|
|
|
|
|
|
claim = self.apply(segment,_code)
|
|
|
|
|
if claim :
|
|
|
|
|
|
|
|
|
|
claim['index'] = len(claims)
|
|
|
|
|
# for _row_ in _toprows :
|
|
|
|
|
|
|
|
|
|
# claim = jsonmerge.merge(claim,self.apply([_row_],_code))
|
|
|
|
|
claim = jsonmerge.merge(claim,self.apply(_toprows,_code))
|
|
|
|
|
claims.append(dict(DEFAULT_VALUE,**claim))
|
|
|
|
|
if type(file) != list :
|
|
|
|
|