diff --git a/healthcareio/x12/__init__.py b/healthcareio/x12/__init__.py index c6290ad..6270564 100644 --- a/healthcareio/x12/__init__.py +++ b/healthcareio/x12/__init__.py @@ -490,10 +490,7 @@ class Parser (Process): # Some information in the toprows can be available and applied to claims that do not have this # This holds true for dates, N1, NM1 segments _default = (self.apply(_toprows,_code)) - # print (_default) - # print (DEFAULT_VALUE) - # print (jsonmerge.merge(DEFAULT_VALUE,_default)) - DEFAULT_VALUE = jsonmerge.merge(DEFAULT_VALUE,_default) + DEFAULT_VALUE = dict(DEFAULT_VALUE,**_default) segment.append(row) @@ -506,8 +503,16 @@ class Parser (Process): if _claim : _claim['index'] = index #len(claims) - # claims.append(dict(DEFAULT_VALUE,**_claim)) - claims.append( jsonmerge.merge(DEFAULT_VALUE,_claim)) + # claims.append(dict(DEFAULT_VALUE,**_claim)) + # + schema = [key for key in _claim.keys() if type(_claim[key]) == list] + if schema : + schema = {"properties":dict.fromkeys(schema,{"mergeStrategy":"append"})} + + else: + schema = {} + merger = jsonmerge.Merger(schema) + claims.append( merger.merge(DEFAULT_VALUE,_claim)) segment = [row] index += 1 @@ -516,7 +521,7 @@ class Parser (Process): # # Handling the last claim found if segment[0].startswith(section) : - # default_claim = dict({"name":index},**DEFAULT_VALUE) + default_claim = dict({"name":index},**DEFAULT_VALUE) claim = self.apply(segment,_code) if claim : @@ -530,8 +535,8 @@ class Parser (Process): merger = jsonmerge.Merger(schema) # top_row_claim = self.apply(_toprows,_code) - # claim = merger.merge(claim,self.apply(_toprows,_code)) - + claim = merger.merge(claim,self.apply(_toprows,_code)) + # claims.append(dict(DEFAULT_VALUE,**claim)) claims.append(merger.merge(DEFAULT_VALUE,claim)) if type(file) != list : file.close() diff --git a/setup.py b/setup.py index 08b4511..5dd158c 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ import sys def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() args = { - "name":"healthcareio","version":"1.6.2.9", + "name":"healthcareio","version":"1.6.2.10", "author":"Vanderbilt University Medical Center", "author_email":"steve.l.nyemba@vumc.org", "include_package_data":True,