From a75ed6eb9415d8e1798b2de4de85bff99f0dd547 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Tue, 6 Oct 2020 17:08:57 -0500 Subject: [PATCH] bug fix --- healthcareio/x12/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/healthcareio/x12/__init__.py b/healthcareio/x12/__init__.py index 137ae2f..6eec54e 100644 --- a/healthcareio/x12/__init__.py +++ b/healthcareio/x12/__init__.py @@ -367,10 +367,12 @@ class Parser (Process): try: file = open(filename.strip(),errors='ignore') INITIAL_ROWS = list(islice(file,4)) #.readlines(4) - + _code = "unknown" if len(INITIAL_ROWS) == 1 : file = INITIAL_ROWS[0].split('~') 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' DEFAULT_VALUE = self.get.default_value(INITIAL_ROWS,_code) @@ -421,8 +423,8 @@ class Parser (Process): # x12_file = open(filename.strip(),errors='ignore').read().split('\n') except Exception as e: - logs.append ({"parse":"claims" if _code == '837' else 'remits',"completed":False,"name":filename,"msg":e.args[0]}) - return [],logs,_code + logs.append ({"parse":_code,"completed":False,"name":filename,"msg":e.args[0]}) + return [],logs,None rate = 0 if len(claims) == 0 else (1 + index)/len(claims) logs.append ({"parse":"claims" if _code == '837' else 'remits',"completed":True,"name":filename,"rate":rate})