bug fix ... top_rows stuff

master
Steve L. Nyemba 4 years ago
parent ab50909152
commit c7b4341621

@ -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)
@ -507,7 +504,15 @@ class Parser (Process):
if _claim :
_claim['index'] = index #len(claims)
# claims.append(dict(DEFAULT_VALUE,**_claim))
claims.append( jsonmerge.merge(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()

@ -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,

Loading…
Cancel
Save