فهرست منبع

bug fix: section/loop definition

Steve Nyemba 4 سال پیش
والد
کامیت
cb150f1d90
2فایلهای تغییر یافته به همراه9 افزوده شده و 8 حذف شده
  1. 2 2
      healthcareio/parser.py
  2. 7 6
      healthcareio/x12/__init__.py

+ 2 - 2
healthcareio/parser.py

@@ -287,7 +287,7 @@ def get_content(filename,config,section=None) :
                     # tmp = get_map(row,_info,VERSION)
                     # if 'parser' in _info :
                     #     pointer = eval(_info['parser'])
-                    #     print (pointer(row))
+                    
                     tmp = get_map(row,_info,VERSION)
                     
                 except Exception as e:                    
@@ -323,7 +323,7 @@ def get_content(filename,config,section=None) :
                         if label not in claim:                    
                             claim[label] = [tmp]
                         elif len(list(tmp.keys())) == 1 :
-                            # print "\t",len(claim[label]),tmp
+                            
                             index = len(claim[label]) -1 
                             claim[label][index] = dict(claim[label][index],**tmp)
                         else:

+ 7 - 6
healthcareio/x12/__init__.py

@@ -277,7 +277,7 @@ class Parser (Process):
         value = {}
         for row in content[:] :
             
-            row     = util.split(row)
+            row     = util.split(row.replace('\n','').replace('~',''))
             _info   = util.get.config(self.config[_code][0],row)
           
             if _info :
@@ -327,7 +327,8 @@ class Parser (Process):
                     
                     pass
                 except Exception as e :
-                    print ('__',e)
+                   
+                    print ('__',e.args)
                     pass
                 
         return value if value else {}
@@ -373,8 +374,8 @@ class Parser (Process):
                 INITIAL_ROWS = file[:4]
             if len(INITIAL_ROWS) < 3 :
                 return None,[{"name":filename,"completed":False}],None
-            section = 'CLM' if INITIAL_ROWS[1].split('*')[1] == 'HC' else 'CLP'            
-            _code   = '837' if section == 'CLM' else '835'
+            section = 'HL' if INITIAL_ROWS[1].split('*')[1] == 'HC' else 'CLP'            
+            _code   = '837' if section == 'HL' else '835'
             DEFAULT_VALUE = self.get.default_value(INITIAL_ROWS,_code)
             DEFAULT_VALUE['name'] = filename.strip()
             #
@@ -396,13 +397,13 @@ class Parser (Process):
                     #
                     # process the segment somewhere (create a thread maybe?)
                     # 
-                    default_claim = dict({"index":index},**DEFAULT_VALUE)
+                    # default_claim = dict({"index":index},**DEFAULT_VALUE)
                     _claim = self.apply(segment,_code)
                     # if _claim['claim_id'] == 'P1080351470' :
                     #     print (_claim)
                         # _claim = dict(DEFAULT_VALUE,**_claim)
                     if _claim :
-                        _claim['index'] = len(claims)
+                        _claim['index'] = index #len(claims)
                         claims.append(dict(DEFAULT_VALUE,**_claim))
                     segment = [row]
                     index += 1