When reaching line flat_entry = flatten_fhir(entry['resource']) I am always getting Jupyter issue with following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[1], line 94
91 os.mkdir(flat_file_path)
93 for file in glob.glob(in_file_glob):
---> 94 flatten_bundle(file)
Cell In[1], line 85, in flatten_bundle(bundle_file_name)
83 flat_patient = flatten_fhir(patient)
84 for i, entry in enumerate(bundle['entry']):
---> 85 flat_entry = flatten_fhir(entry['resource'])
Cell In[1], line 40, in flatten_fhir(nested_json)
37 attrib_name = name[:-1]
38 out[attrib_name] = handle_special_attributes(attrib_name, json_to_flatten)
---> 40 flatten(nested_json)
41 return out
Cell In[1], line 32, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
30 if type(json_to_flatten) is dict:
31 for sub_attribute in json_to_flatten:
---> 32 flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
33 elif type(json_to_flatten) is list:
34 for i, sub_json in enumerate(json_to_flatten):
Cell In[1], line 35, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
33 elif type(json_to_flatten) is list:
34 for i, sub_json in enumerate(json_to_flatten):
---> 35 flatten(sub_json, name + str(i) + ' ')
36 else:
37 attrib_name = name[:-1]
Cell In[1], line 31, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
29 def flatten(json_to_flatten, name=''):
30 if type(json_to_flatten) is dict:
---> 31 for sub_attribute in json_to_flatten:
32 flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
33 elif type(json_to_flatten) is list:
Cell In[1], line 31, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
29 def flatten(json_to_flatten, name=''):
30 if type(json_to_flatten) is dict:
---> 31 for sub_attribute in json_to_flatten:
32 flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
33 elif type(json_to_flatten) is list:
File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:1179, in _pydevd_bundle.pydevd_cython_darwin_39_64.SafeCallWrapper.__call__()
File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:620, in _pydevd_bundle.pydevd_cython_darwin_39_64.PyDBFrame.trace_dispatch()
File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:756, in _pydevd_bundle.pydevd_cython_darwin_39_64.PyDBFrame.trace_dispatch()
File ~/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers-pro/jupyter_debug/pydev_jupyter_plugin.py:92, in can_not_skip(plugin, pydb, pydb_frame, frame, info)
90 def can_not_skip(plugin, pydb, pydb_frame, frame, info):
91 step_cmd = info.pydev_step_cmd
---> 92 if step_cmd == 108 and _is_equals(frame, _get_stop_frame(info)):
93 return True
94 if pydb.jupyter_breakpoints:
File ~/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers-pro/jupyter_debug/pydev_jupyter_plugin.py:126, in _is_equals(frame, other_frame)
122 def _is_equals(frame, other_frame):
123 # We can't compare frames directly, because Jupyter compiles ast nodes
124 # in cell separately. At the same time, the frame filename is unique and stays
125 # the same within a cell.
--> 126 return frame.f_code.co_filename == other_frame.f_code.co_filename \
127 and ((frame.f_code.co_name.startswith('<cell line:')
128 and other_frame.f_code.co_name.startswith('<cell line:'))
129 or frame.f_code.co_name == other_frame.f_code.co_name)
AttributeError: 'NoneType' object has no attribute 'f_code'
I am running notebook locally using JetBrain Intelij IDEA and tested with the simplest JSON. Abe604_Frami345_b8dd1798-beef-094d-1be4-f90ee0e6b7d5.json
When reaching line
flat_entry = flatten_fhir(entry['resource'])
I am always getting Jupyter issue with following error: